GitHub: https://github.com/Rithikasri-code/aws-iam-identity-center
One prompt → complete zero-trust human access management for an AWS Organization. 8 permission sets with session policies, 7 groups, 21 account assignments, BreakGlass monitoring that fires in 60 seconds, and SOC 2 audit evidence generation — with 15 proof-gate tests across 4 categories.
Prompt: prompt.md
Every AWS multi-account organization eventually reaches the same crisis point:
- Engineers have IAM users with long-lived access keys that never rotate
- "Temporary" access granted during an incident is never revoked
- The security team has no way to answer "who has production access right now?"
- External auditors get admin access because nobody has time to scope it properly
- Break-glass access exists as a shared root password in a spreadsheet
- SOC 2 auditors ask for an access review report and it takes a week to produce
This prompt closes every gap. Zero IAM users. Zero long-lived keys. Every session time-bounded. Every elevated action MFA-gated. BreakGlass use triggers an immediate alert. SOC 2 evidence generated on demand.
Paste into Claude Code, Kiro IDE, or Cursor. Answer 8 questions. Get:
- IAM Identity Center configured with ABAC (CostCenter, Team, Environment attributes)
- 7 groups: aws-engineers, aws-platform, aws-security, aws-finance, aws-oncall, aws-auditors, aws-breakglass
- 8 permission sets with session policies blocking backdoor creation in every one
- 21 account assignments implementing the principle of least privilege
- BreakGlass CloudWatch alarm that fires within 60 seconds of emergency access use
- Monthly automated access review report for SOC 2 compliance
- 15-test verify.sh across 4 categories: Infrastructure, Zero-Trust, BreakGlass, SOC 2
| Group | Management | Security | Logging | Shared Services | Production | Development |
|---|---|---|---|---|---|---|
| aws-engineers | — | ReadOnly | ReadOnly | — | ReadOnly | PowerUser |
| aws-platform | — | ReadOnly | — | Admin | ReadOnly | — |
| aws-security | — | Investigator | Investigator | Investigator | Investigator | — |
| aws-finance | BillingOnly | — | — | — | — | — |
| aws-oncall | — | — | — | — | IncidentResponder | — |
| aws-auditors | — | ReadOnly | ReadOnly | — | — | — |
| aws-breakglass | EMERGENCY | EMERGENCY | EMERGENCY | EMERGENCY | EMERGENCY | EMERGENCY |
IAM Identity Center (Global)
│
├── ABAC Configuration
│ ├── CostCenter → from enterprise.costCenter attribute
│ ├── Team → from enterprise.department attribute
│ └── Environment → from enterprise.employeeType attribute
│
├── 7 Groups → 8 Permission Sets → 21 Account Assignments
│
├── Permission Sets (session policies block backdoors in ALL 8)
│ ├── PS-01 EngineeringReadOnly 8h, no MFA, ReadOnlyAccess + logs
│ ├── PS-02 EngineeringPowerUser 4h, MFA required, dev only
│ ├── PS-03 PlatformAdmin 4h, MFA required, shared-services only
│ ├── PS-04 SecurityInvestigator 8h, no MFA, GuardDuty + SecurityHub read
│ ├── PS-05 FinanceReadOnly 8h, no MFA, billing only — denies all compute
│ ├── PS-06 IncidentResponder 4h, MFA required, production only + SSM
│ ├── PS-07 ExternalAuditorReadOnly 1h, MFA required, audit evidence S3 only
│ └── PS-08 BreakGlass 1h, MFA mandatory, IP-restricted, alert on use
│
└── Monitoring
├── CloudWatch Metric Filter → BreakGlassAccessEvents
├── CloudWatch Alarm → fires within 60s → SNS → email alert
├── EventBridge Rule → real-time detection
└── Monthly Access Review Lambda → SOC 2 evidence S3
Most SSO setups assign managed policies and call it done. A malicious insider with any of these permission sets could still create an IAM user with an access key and exfiltrate data indefinitely after their SSO session expires.
This prompt adds a session policy to every single permission set that explicitly denies:
iam:CreateUser— cannot create IAM usersiam:CreateAccessKey— cannot create long-lived credentialsiam:AttachUserPolicy— cannot escalate privilegesorganizations:*— cannot modify org structure (except management account root)cloudtrail:StopLogging/cloudtrail:DeleteTrail— cannot hide their tracks
Even AdministratorAccess (BreakGlass, PlatformAdmin) cannot create IAM users or delete CloudTrail. The session policy layer enforces this independently of the managed policy.
Every use of the BreakGlass permission set triggers:
- CloudWatch alarm fires within 60 seconds — metric filter on CloudTrail detects SSO login event, alarm evaluates, SNS fires
- EventBridge rule fires within seconds — real-time detection without waiting for CloudWatch period
- SNS email to security team — immediate human notification
- Full CloudTrail audit trail — every API action during the break-glass session logged
The verify.sh proof-gate tests this by publishing a synthetic BreakGlassAccessEvents metric and verifying the alarm transitions to ALARM state within 70 seconds.
- Identity Center instance: Active, 1 instance
- Permission sets: 8 created with session policies
- ABAC: 3 attributes configured (CostCenter, Team, Environment)
- Account assignments: 21 group-permission-set-account triples
- BreakGlass alarm: OK state, transitions to ALARM within 70 seconds of synthetic metric
- SOC 2 report:
access-review-production.jsongenerated on demand terraform validateclean;terraform planshows 47 resources to add
Cost: IAM Identity Center is free for AWS accounts. Monitoring (CloudWatch alarm + EventBridge + SNS + Lambda): ~$1-2/month.
- 5 Terraform modules: identity-center, permission-sets, groups-and-users, account-assignments, monitoring
- 18 Terraform files (~1,600 lines of deployable HCL)
deploy.sh— 6-step deployment with Identity Center prerequisite checkverify.sh— 15 tests across 4 categories, outputsverify-results.jsonrunbook.md— break-glass emergency access procedure (SOC 2 evidence artifact)access-review-production.json— generated by verify.sh, SOC 2 audit evidence- Total: 27 files, MIT licensed
Security: Zero IAM users in workload accounts — verified by verify.sh AR-02. Session policies block backdoor creation in all 8 permission sets. BreakGlass IP-restricted and MFA-enforced. All sessions time-bounded (1-8 hours). ABAC enforces tag-based resource scoping.
Operational Excellence: Full Terraform IaC — adding a new engineer is one Terraform resource. Access review is automated monthly. BreakGlass runbook is versioned in the repo. verify.sh generates SOC 2 evidence artifacts automatically.
Reliability: BreakGlass access exists for when Identity Center fails. Dual detection (CloudWatch + EventBridge) ensures BreakGlass alerts even if one path is degraded. Monthly access review catches stale access before it becomes a liability.
Performance Efficiency: Identity Center sessions cached — engineers don't re-authenticate every API call. Session duration tuned per risk level: 8h for read-only, 4h for write, 1h for emergency.
Cost Optimization: Identity Center is free. Monitoring costs ~$1-2/month. Eliminates cost of managing IAM user lifecycle (rotation, auditing, revocation).
Sustainability: Serverless — no EC2, no always-on compute. EventBridge and Lambda trigger only on access events.
This prompt configures the IAM Identity Center access layer. It does not:
- Configure SAML federation with Okta, Azure AD, or Google Workspace (scaffolded with comments, requires external IdP setup)
- Handle MFA device enrollment (users self-enroll in the SSO portal)
- Create the development account (assumes BUIDL #01 org structure)
- Constitute a SOC 2 certification — that requires a third-party auditor
Part of a 3-prompt series:
- #01 AWS Multi-Account Organization Bootstrap — org structure + SCPs
- #02 Production Bedrock AI Observability Stack — AI cost + performance monitoring
- #03 AWS IAM Identity Center Zero-Trust Access ← this submission
- AWS management account with IAM Identity Center enabled (AWS Console → IAM Identity Center → Enable)
- Terraform 1.7+, AWS CLI v2, jq
- 6 AWS account IDs from BUIDL #01 deployment (or any existing org)
- Email addresses for security alerts and example users
Disclaimer: BreakGlass permission set grants AdministratorAccess. Restrict var.breakglass_allowed_cidrs to corporate office/VPN IPs only. Review and update the runbook quarterly.