Skip to main content

IAM compliance automation: enforce MFA and clean up access keys in AWS

Workflow preview

Workflow preview
100%
IAM compliance automation: enforce MFA and clean up access keys in AWS preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Automated AWS IAM Compliance Workflow for MFA Enforcement and Access Key Deactivation This workflow leverages AWS IAM APIs and n8n automation to ensure strict security compliance by continuous...

Best for

  • SecOps automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.awsiam, n8n-nodes-base.stickynote, n8n-nodes-base.httprequest, n8n-nodes-base.filter, n8n-nodes-base.scheduletrigger, n8n-nodes-base.slack, n8n-nodes-base.code

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Trung Tran.

Original n8n.io source

1.1 Workflow description

Title
IAM compliance automation: enforce MFA and clean up access keys in AWS
Workflow name
IAM compliance automation: enforce MFA and clean up access keys in AWS

Automated AWS IAM Compliance Workflow for MFA Enforcement and Access Key Deactivation

> This workflow leverages AWS IAM APIs and n8n automation to ensure strict security compliance by continuously monitoring IAM users for MFA (Multi-Factor Authentication) enforcement.

Who’s it for

This workflow is designed for DevOps, Security, or Cloud Engineers responsible for maintaining IAM security compliance in AWS accounts. It's ideal for teams who want to enforce MFA usage and automatically disable access for non-compliant IAM users.

How it works / What it does

This automated workflow performs a daily check to detect IAM users without an MFA device and deactivate their access keys.

Step-by-step:

  1. Daily scheduler: Triggers the workflow once a day.
  2. Get many users: Retrieves a list of all IAM users in the account.
  3. Get IAM User MFA Devices: Calls AWS API to get MFA device info for each user.
  4. Filter out IAM users with MFA: Keeps only users without any MFA device.
  5. Send warning message(s): Sends Slack alerts for users who do not have MFA enabled.
  6. Get User Access Key(s): Fetches access keys for each non-MFA user.
  7. Parse the list of user access key(s): Extracts and flattens key information like AccessKeyId, Status, and UserName.
  8. Filter out inactive keys: Keeps only active access keys for further action.
  9. Deactivate Access Key(s): Calls AWS API to deactivate each active key for non-MFA users.

How to set up

  1. Configure AWS credentials in your environment (IAM role or AWS access key with required permissions).
  2. Connect Slack via the Slack node for alerting (set channel and credentials).
  3. Set the scheduler to your preferred frequency (e.g., daily at 9AM).
  4. Adjust any Slack message template or filtering conditions as needed.

Requirements

  • IAM user or role credentials with the following AWS IAM permissions:
    • iam:ListUsers
    • iam:ListMFADevices
    • iam:ListAccessKeys
    • iam:UpdateAccessKey
  • Slack credentials (Bot token with chat:write permission).
  • n8n environment with:
    • Slack integration
    • AWS credentials (set via environment or credentials manager)

How to customize the workflow

  • Alert threshold: Instead of immediate deactivation, you can delay action (e.g., alert first, wait 24h, then disable).
  • Change notification channel: Modify the Slack node to send alerts to a different channel or add email integration.
  • Whitelist exceptions: Add a Set or IF node to exclude specific usernames (e.g., service accounts).
  • Add audit logging: Use Google Sheets, Airtable, or a database to log which users were flagged or had access disabled.
  • Extend access checks: Include console password check (GetLoginProfile) if needed.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Get many users

Type / Role
n8n-nodes-base.awsIam - awsIam
Config choices
Version 1

Block 2 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Get IAM User MFA Devices

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 10 - Filter out IAM user with MFA device

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 11 - Get User Access Key(s)

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 12 - Daily scheduler

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 13 - Send warning message(s)

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 14 - Deactivate Access Key(s)

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 15 - Filter out inactive keys

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 16 - Parse the list of user access key(s)

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 17 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - Send message and wait for response

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 19 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow IAM compliance automation: enforce MFA and clean up access keys in AWS
Complexity advanced
Nodes 19
Categories SecOps, Multimodal AI
Author Trung Tran
Published 19 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7598/7598.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does IAM compliance automation: enforce MFA and clean up access keys in AWS do?

Automated AWS IAM Compliance Workflow for MFA Enforcement and Access Key Deactivation This workflow leverages AWS IAM APIs and n8n automation to ensure strict security compliance by continuous...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your SecOps, Multimodal AI use case.