AutomationFlowsEmail & Gmail › Automate AWS IAM User Management Through Email

Automate AWS IAM User Management Through Email

ByOneclick AI Squad @oneclick-ai on n8n.io

This automated n8n workflow manages AWS IAM users (create, delete, update, assign to groups) directly from email commands with automatic confirmation responses. The workflow processes email requests via a GET Email Request node. Data extraction from emails is handled to identify…

Manual trigger★★★★☆ complexity13 nodesEmail SendAws IamEmail Read Imap
Email & Gmail Trigger: Manual Nodes: 13 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #7241 — we link there as the canonical source.

This workflow follows the Emailreadimap → Emailsend recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "CIJpDmGwbF9xSHqc",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Manage AWS IAM Users via Email",
  "tags": [],
  "nodes": [
    {
      "id": "6a3a0d65-00c8-4760-aef1-778dc216a38b",
      "name": "Extract Data from Email",
      "type": "n8n-nodes-base.code",
      "position": [
        220,
        920
      ],
      "parameters": {
        "jsCode": "const emailBody = $json[\"textPlain\"] || \"\";\n\n// Helper function to match patterns\nfunction matchFirst(patterns) {\n  for (const pattern of patterns) {\n    const match = emailBody.match(pattern);\n    if (match) return match[1];\n  }\n  return null;\n}\n\n// Detect user name\nconst userName = matchFirst([\n  /user[:\\s*]*([a-zA-Z0-9._-]+)/i,\n  /username\\s+([a-zA-Z0-9._-]+)/i\n]);\n\n// Detect group name\nconst groupName = matchFirst([\n  /group[:\\s*]*([a-zA-Z0-9._-]+)/i,\n  /groupname\\s+([a-zA-Z0-9._-]+)/i\n]);\n\n// Decide task type\nlet task_type = null;\nif (/create user/i.test(emailBody)) task_type = \"create_user\";\nelse if (/delete user/i.test(emailBody)) task_type = \"delete_user\";\nelse if (/add user to group/i.test(emailBody)) task_type = \"add_user_to_group\";\nelse if (/get user$/i.test(emailBody)) task_type = \"get_user\";\nelse if (/get many users/i.test(emailBody)) task_type = \"get_many_users\";\nelse if (/remove user from group/i.test(emailBody)) task_type = \"remove_user_from_group\";\nelse if (/update user/i.test(emailBody)) task_type = \"update_user\";\n\nreturn [\n  {\n    json: {\n      userName,\n      groupName,\n      task_type\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "aa61fe8f-53f3-4f5f-bdcf-a7c439586215",
      "name": "Make massage For Email",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        920
      ],
      "parameters": {
        "jsCode": "const taskType = $json.task_type || \"\";\nconst userName = $json.userName || \"\";\nconst groupName = $json.groupName || \"\";\nconst status = $json.status || \"\"; // \"success\" or \"fail\"\nconst errorMsg = $json.error || \"\";\n\n// Create readable task name\nconst taskMap = {\n  create_user: \"Create User\",\n  delete_user: \"Delete User\",\n  add_user_to_group: \"Add User to Group\",\n  get_user: \"Get User\",\n  get_many_users: \"Get Many Users\",\n  remove_user_from_group: \"Remove User from Group\",\n  update_user: \"Update User\"\n};\n\nlet message = \"\";\n\nif (status === \"success\") {\n  message = `\u2705 ${taskMap[taskType] || \"Task\"} completed successfully.\\n`;\n  if (userName) message += `User: ${userName}\\n`;\n  if (groupName) message += `Group: ${groupName}\\n`;\n} else {\n  message = `\u274c ${taskMap[taskType] || \"Task\"} failed.\\n`;\n  if (userName) message += `User: ${userName}\\n`;\n  if (groupName) message += `Group: ${groupName}\\n`;\n  if (errorMsg) message += `Error: ${errorMsg}\\n`;\n}\n\nreturn {\n  json: {\n    subject: `${status === \"success\" ? \"Success\" : \"Failure\"} - ${taskMap[taskType] || \"IAM Task\"}`,\n    body: message\n  }\n};\n"
      },
      "typeVersion": 2
    },
    {
      "id": "798b73f3-92d4-43ad-9f3b-1221f885c7b1",
      "name": "Send Email Response",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1100,
        920
      ],
      "parameters": {
        "text": "={{$json[\"message\"]}}",
        "options": {
          "replyTo": "={{ $('GET Email Request').item.json.from }}"
        },
        "subject": "={{$json[\"subject\"]}}",
        "toEmail": "={{ $('GET Email Request').item.json.from }}",
        "fromEmail": "user@example.com",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f38dc5ba-90e8-41c3-bc73-c2efcbf9ceaf",
      "name": "Create user",
      "type": "n8n-nodes-base.awsIam",
      "position": [
        660,
        320
      ],
      "parameters": {
        "userName": "={{ $json.username }}",
        "operation": "create",
        "requestOptions": {},
        "additionalFields": {}
      },
      "credentials": {
        "aws": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f8f3a743-d919-49ad-ba78-9873dd034e8f",
      "name": "Delete user",
      "type": "n8n-nodes-base.awsIam",
      "position": [
        660,
        520
      ],
      "parameters": {
        "user": {
          "__rl": true,
          "mode": "userName",
          "value": "={{ $json.username }}"
        },
        "operation": "delete",
        "requestOptions": {}
      },
      "credentials": {
        "aws": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "be25ba9c-2362-43d4-a670-d98a39515130",
      "name": "Add user to group",
      "type": "n8n-nodes-base.awsIam",
      "position": [
        660,
        720
      ],
      "parameters": {
        "user": {
          "__rl": true,
          "mode": "userName",
          "value": "={{ $json.username }}"
        },
        "group": {
          "__rl": true,
          "mode": "groupName",
          "value": "={{ $json.groupname }}"
        },
        "operation": "addToGroup",
        "requestOptions": {}
      },
      "credentials": {
        "aws": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2dc04cc3-224f-433b-bada-f04584f57321",
      "name": "Get user",
      "type": "n8n-nodes-base.awsIam",
      "position": [
        660,
        920
      ],
      "parameters": {
        "user": {
          "__rl": true,
          "mode": "userName",
          "value": "={{ $json.username }}"
        },
        "operation": "get",
        "requestOptions": {}
      },
      "credentials": {
        "aws": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "198b262e-fe75-454b-9609-b84a824a0880",
      "name": "Get many users",
      "type": "n8n-nodes-base.awsIam",
      "position": [
        660,
        1120
      ],
      "parameters": {
        "requestOptions": {},
        "additionalFields": {}
      },
      "credentials": {
        "aws": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3bd5fda6-0669-4dd0-a15b-5fb10ee23bd2",
      "name": "Remove user from group",
      "type": "n8n-nodes-base.awsIam",
      "position": [
        660,
        1320
      ],
      "parameters": {
        "user": {
          "__rl": true,
          "mode": "userName",
          "value": "={{ $json.username }}"
        },
        "group": {
          "__rl": true,
          "mode": "groupName",
          "value": "={{ $json.groupname }}"
        },
        "operation": "removeFromGroup",
        "requestOptions": {}
      },
      "credentials": {
        "aws": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "dbc30150-ccb6-492f-b956-e86da72dcf6c",
      "name": "Update user",
      "type": "n8n-nodes-base.awsIam",
      "position": [
        660,
        1520
      ],
      "parameters": {
        "user": {
          "__rl": true,
          "mode": "userName",
          "value": "={{ $json.username }}"
        },
        "userName": "={{ $json.newusername }}",
        "operation": "update",
        "requestOptions": {},
        "additionalFields": {}
      },
      "credentials": {
        "aws": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d0635da5-3ac9-494c-944a-e3352dcaa685",
      "name": "GET Email Request",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        0,
        920
      ],
      "parameters": {
        "options": {
          "customEmailConfig": "[\"UNSEEN\", [\"SUBJECT\", \"iam\"]]"
        }
      },
      "credentials": {
        "imap": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "53281026-4fc1-40d8-834a-1085e049f011",
      "name": "Check Type Of Task",
      "type": "n8n-nodes-base.switch",
      "position": [
        440,
        836
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "99e9f0b2-e19b-45c5-a60e-317d772e6291",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "{{ json.task_type}}",
                    "rightValue": "create_user"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4e72b4c7-eed9-4039-84c7-773a4dee2eb6",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ json.task_type}}",
                    "rightValue": "delete_user"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "aef1b8b8-9175-4819-9cb8-87209e4b2954",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ json.task_type}}",
                    "rightValue": "add_user"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a256941b-0882-4ee1-9126-491da78f5fb4",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ json.task_type.}}",
                    "rightValue": "get_user"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a502de56-2efa-4766-b883-65d8cefaab1a",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ json.task_type}}",
                    "rightValue": "get_many_user"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "62aae8fd-71f2-4194-af78-b8d42179a2d0",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ json.task_type}}",
                    "rightValue": "remove_user"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e70fb51d-7d2e-4ed2-bdde-7edd03059033",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ json.task_type}}",
                    "rightValue": "update_user"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "32ac6b9c-62b5-4493-9f8d-d0de9fca4211",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        520
      ],
      "parameters": {
        "color": 5,
        "width": 680,
        "height": 340,
        "content": "## How It Works\n- **GET Email Request** - Captures incoming email requests.\n- **Extract Data from Email** - Parses email content to extract user management commands.\n- **Check Type of Task** - Validates the type of task (e.g., create, delete, update).\n- **Get User** - Retrieves user details from AWS IAM.\n- **Get Many Users** - Fetches multiple user details if required.\n- **Create User** - Creates a new IAM user.\n- **Delete User** - Deletes an existing IAM user.\n- **Add to Group** - Assigns a user to a group.\n- **Remove from Group** - Removes a user from a group.\n- **Update User** - Updates user details.\n- **Make Message for Email** - Prepares a confirmation email.\n- **Send Email Response** - Sends the confirmation email."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a67ad521-0006-4818-a40d-8cc3d753bdb9",
  "connections": {
    "Get user": {
      "main": [
        [
          {
            "node": "Make massage For Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create user": {
      "main": [
        [
          {
            "node": "Make massage For Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete user": {
      "main": [
        [
          {
            "node": "Make massage For Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update user": {
      "main": [
        [
          {
            "node": "Make massage For Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many users": {
      "main": [
        [
          {
            "node": "Make massage For Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add user to group": {
      "main": [
        [
          {
            "node": "Make massage For Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET Email Request": {
      "main": [
        [
          {
            "node": "Extract Data from Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Type Of Task": {
      "main": [
        [
          {
            "node": "Create user",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Delete user",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Add user to group",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get user",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get many users",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Remove user from group",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Make massage For Email": {
      "main": [
        [
          {
            "node": "Send Email Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove user from group": {
      "main": [
        [
          {
            "node": "Make massage For Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Data from Email": {
      "main": [
        [
          {
            "node": "Check Type Of Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This automated n8n workflow manages AWS IAM users (create, delete, update, assign to groups) directly from email commands with automatic confirmation responses. The workflow processes email requests via a GET Email Request node. Data extraction from emails is handled to identify…

Source: https://n8n.io/workflows/7241/ — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Email & Gmail

If you are a postmaster or you manage email server, you can set up DKIM and SPF records to ensure that spoofing your email address is hard. On your domain you can also set up DMARC record to receive X

Email Read Imap, MySQL, Compression +3
Email & Gmail

This automated n8n workflow automates AWS S3 bucket and file operations (create, delete, upload, download, copy, list) by parsing simple email commands and sending back success or error confirmations.

Email Read Imap, AWS S3, Email Send
Email & Gmail

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Email Read Imap, Execute Command, Email Send
Email & Gmail

This n8n workflow helps users easily discover nearby residential construction projects by automatically scraping and analyzing property listings from 99acres and other real estate platforms. Users can

Email Read Imap, HTTP Request, Email Send
Email & Gmail

Nathan is a proof of concept framework for creating a personal assistant who can handle various day to day functions for you.

Email Read Imap, Read Binary File, Spreadsheet File +2