Visual overview
A trusted identity assumes an IAM role, receives a temporary session, and its subsequent API activity can be attributed in CloudTrail.
Technical reference
Role-based access is a session protocol: trust must authorize assumption, STS creates the session, and multiple policies can narrow what that session may do.
The role's resource policy identifies principals and conditions that may use an AssumeRole-style path.
Temporary STS credentials require the session token in addition to the familiar access-key pair.
A supplied session policy can narrow effective permissions but cannot elevate beyond the role's available permissions.
Supported assumption flows can carry source identity into the role session and CloudTrail evidence.
Transitive or non-transitive session tags can become request attributes when trust allows sts:TagSession.
Using one role session to assume another has a stricter documented maximum duration than ordinary direct role assumptions.
Service limits and capabilities can change. Values shown here reflect the current AWS documentation; use the linked official sources below as the source of truth.
A role is an assumable identity, not a person
An IAM role is an AWS identity with permissions but without the same permanently associated credentials model as an IAM user. A trusted principal assumes the role and receives temporary security credentials for a role session. Roles are therefore suited to applications running on AWS, AWS services that need to act on a customer's behalf, cross-account access, and federated users who should not receive long-lived IAM access keys.
Two policy questions surround a role. Its trust policy is a resource-based policy that defines which principals may assume the role and under which conditions. Its permissions policies define what an authorized role session may do after assumption. In cross-account access, the trusting account's role trust and the caller's permission to invoke the relevant STS operation both matter. Conditions such as an external ID can further protect delegated third-party access from confused-deputy scenarios.
Temporary credentials are the default design for workloads
AWS compute services can deliver role credentials to workloads through service integrations such as instance profiles or execution/task roles and automatically rotate the underlying temporary credentials. Application code should use the standard SDK credential provider chain rather than copying credentials from metadata endpoints into configuration files. This separates application deployment from credential lifecycle and greatly reduces the need to create long-term IAM user access keys for machines.
Role chaining occurs when credentials from one assumed role session are used to assume another role. AWS imposes a stricter session-duration limit on chained role sessions than on many directly assumed roles. Because role and STS limits can evolve, production designs should read the current IAM and STS documentation rather than hard-code assumptions about maximum session lifetime.
- Prefer service-provided role credentials for workloads running on AWS.
- Do not store STS session tokens or long-term access keys in application source control.
- Use trust-policy conditions to constrain who can assume sensitive roles.
- Use CloudTrail plus source identity/session context when traceability across assumed roles matters.
Key takeaways
- 01
A role separates trust (who may assume it) from permissions (what a role session may do).
- 02
AWS STS issues temporary credentials for role and federation sessions.
- 03
Session policies can reduce a role session's effective permissions but cannot grant beyond the underlying role authorization.
- 04
AWS workloads should normally consume automatically refreshed temporary role credentials rather than embedded long-term keys.
- 05
Role chaining has additional session-duration constraints and should be designed deliberately.
Official AWS sources
Use these primary AWS resources for the source material behind this article and for deeper reference.