Automated monitoring and alerting for IAM user creation activities across AWS accounts.
This CloudFormation template sets up real-time alerts for critical IAM events:
- CreateUser - New IAM user creation
- CreateAccessKey - Access key generation
- CreateLoginProfile - Console access enablement
Notifications can be delivered via email (SNS) and/or Slack to monitor unauthorized or unexpected IAM activity.
- AWS account with CloudTrail enabled (management events)
- AWS CLI installed and configured
- (Optional) Slack Incoming Webhook URL
cd cloudformation-iam-alerts
./deploy.shEmail notifications:
aws cloudformation create-stack \
--stack-name iam-activity-alerts \
--template-body file://iam-alerts-cloudformation.yaml \
--parameters \
ParameterKey=NotificationEmail,ParameterValue=your-email@example.com \
ParameterKey=ExcludedUserNames,ParameterValue="service-account1,service-account2" \
--capabilities CAPABILITY_IAMSlack notifications:
aws cloudformation create-stack \
--stack-name iam-activity-alerts \
--template-body file://iam-alerts-cloudformation.yaml \
--parameters \
ParameterKey=SlackWebhookUrl,ParameterValue=https://hooks.slack.com/services/YOUR/WEBHOOK/URL \
ParameterKey=ExcludedUserNames,ParameterValue="service-account1,service-account2" \
--capabilities CAPABILITY_IAMiam-alerts-cloudformation.yaml- Main CloudFormation templatedeploy.sh- Interactive deployment scriptparameters-example.json- Sample parameters fileIAM-ALERTS-README.md- Detailed documentation
- Real-time monitoring via EventBridge
- Flexible notifications (Email, Slack, or both)
- Customizable user exclusions (for service accounts)
- Rich alert details (event type, user, timestamp, source IP, etc.)
- Easy to share across AWS accounts
- Minimal cost (< $1/month)
- Secure (Slack webhook stored with NoEcho)
| Parameter | Description | Default |
|---|---|---|
NotificationEmail |
Email for SNS alerts | (empty) |
SlackWebhookUrl |
Slack webhook URL | (empty) |
ExcludedUserNames |
Users to exclude from alerts | portalsvc1,klam-sts-user |
AlertRuleName |
EventBridge rule name | iam-user-creation-alert |
Each alert includes:
- Event type and timestamp
- Target username
- AWS Account ID and region
- Principal who performed the action
- Source IP address
Test your deployment:
# Create a test user (will trigger alert)
aws iam create-user --user-name test-alert-user
# Clean up
aws iam delete-user --user-name test-alert-userRemove all resources:
aws cloudformation delete-stack --stack-name iam-activity-alerts- Security Monitoring - Detect unauthorized IAM user creation
- Compliance - Audit trail for IAM changes
- Team Awareness - Keep security teams informed of IAM activities
- Multi-Account Deployment - Standardize alerting across AWS Organization
- Webhook URLs protected with NoEcho (not visible in console/logs)
- Minimal IAM permissions (Lambda only has CloudWatch Logs access)
- SNS topic policy restricts publishing to EventBridge only
- No credentials stored or transmitted
For detailed documentation, troubleshooting, and advanced configuration, see IAM-ALERTS-README.md.