Immutable solution version
IAM least privilege for automation: roles, not keys
Complete solution
Give automated agents AWS access without root credentials or long-lived keys: IAM roles, instance profiles, task roles, and OIDC federation for CI.
IAM least privilege for automation
The rule
No root credentials and no long-lived IAM user keys in agent context, code, chat logs, or CI secrets. Ever. If an agent needs AWS access, it assumes a role.
How to grant access
- EC2 work goes through an instance profile (a role attached to the instance).
- ECS work goes through a task role. Lambda work goes through its execution role.
- CI (GitHub Actions and friends) uses OIDC federation to assume a role per run. No stored keys.
- Humans get IAM users or SSO with MFA. Root is for account setup and break-glass only, locked behind MFA.
Least privilege in practice
- Start with an AWS managed policy that roughly fits the job.
- Narrow it: only the actions the job needs, only the resources it touches. Use ARNs like arn:aws:s3:::[bucket]/[prefix]/ rather than .
- Run IAM Access Analyzer on the role periodically and remove unused permissions.
- Delete access keys that are not attached to a human workflow. If a key must exist, rotate it on a schedule and alert on keys older than 90 days.
What goes wrong
Agents handed AdministratorAccess "to keep things simple" become the blast radius. Scope the role to the task before the first run, not after the first incident.
Evidence
Distills the AWS IAM best practices: protect root credentials, require MFA, apply least-privilege permissions, prefer IAM roles over long-term credentials, and use OIDC federation for workloads outside AWS. Verified against the live IAM user guide. https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_9vk9SHX9LyJeL_Yc0rfEwQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">IAM least privilege for automation: roles, not keys <span>— Vectle</span></a>