Use short-lived role credentials and no long-lived access keys for the agent
Facts read 10 Nov 2026. Page reviewed 16 Nov 2026.
Check 2 of 30: Use short-lived role credentials and no long-lived access keys for the agent. A key stored in code, a config file or a container image stays valid until someone rotates it, so a leak gives an attacker lasting access. Temporary credentials from a role expire on their own.
The whole checklist ยท The map
Why it matters
A key stored in code, a config file or a container image stays valid until someone rotates it, so a leak gives an attacker lasting access. Temporary credentials from a role expire on their own.
How, in each cloud
- AWS
- Have the workload use temporary credentials through an IAM role rather than IAM user access keys.
- Google Cloud
- Use workload identity or an attached service account instead of service account keys, which Google describes as powerful credentials that can present a security risk.
- Azure
- Use a managed identity; Microsoft documents that you do not manage its credentials.
What the documentation says
- "Require workloads to use temporary credentials with IAM roles to access AWS" (source)
- "security burden associated with service account keys." (source)
- "You don't need to manage credentials." (source)
- Previous: Give each agent its own role or service account, not a shared one
- Next: Limit who can pass, attach or impersonate the agent's role
Related pages
- Limit who can pass, attach or impersonate the agent's role: the check, and how in AWS, Google Cloud and Azure
- Scope the role's trust to the specific agent, service account or workload: the check, and how in AWS, Google Cloud and Azure
- Do not run the agent as a default or pre-granted account: the check, and how in AWS, Google Cloud and Azure
Sources
- docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html, read 10 Nov 2026
- cloud.google.com/iam/docs/workload-identity-federation, read 10 Nov 2026
- learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/over, read 10 Nov 2026
Last reviewed 16 Nov 2026.