Deep-Dive Case Study: For the complete production architecture, fleet inventory dashboard, and FinOps zombie resource reclamation across 400+ accounts, read Automating Cloud Inventory Across 400+ AWS Accounts.IAM role assumption solves this. A single automation account holds a minimal identity. Each target account has a role that trusts that identity. The automation assumes that role when it needs to work in a target account, operates for the duration of the task, and releases the temporary credentials when done.
Automation Account (IAM User/Role)
│
├── AssumeRole → Account A (arn:aws:iam::111111111111:role/AutomationRole)
│ └── temporary credentials → scoped to Account A
│
├── AssumeRole → Account B (arn:aws:iam::222222222222:role/AutomationRole)
│ └── temporary credentials → scoped to Account B
│
└── AssumeRole → Account C ...
Each temporary credential set has a maximum lifetime (typically 1 hour). After the automation completes its work in that account, the credentials expire automatically. There are no long-lived credentials to rotate or secure per account.
In each target account, the AutomationRole has a trust policy that allows the automation account identity to assume it:
The ExternalId condition prevents confused-deputy attacks, where a third party tricks your automation into assuming a role on their behalf.
The automation executor's own credentials shouldn't be static environment variables. Use a secrets manager (HashiCorp Vault, AWS Secrets Manager) to provide the base identity:
Containerize the automation and schedule it as a Kubernetes CronJob for reliable recurring execution:
- No long-lived per-account credentials: Role assumption provides temporary, scoped access
- ExternalId for trust boundary: Prevents confused-deputy attacks
- Handle partial failures gracefully: One account failing shouldn't stop collection for others
- Schedule through Kubernetes CronJobs: Reliable, observable, and auditable execution
- Integrate secrets management: Base identity credentials should come from a secrets manager, not environment variables
