Certablo
← Knowledge Base

IAM Roles, AWS STS & Temporary Credentials

The preferred AWS pattern for delegated and workload access: role trust, AssumeRole, short-lived sessions, session policies, role chaining and traceable temporary credentials instead of embedded long-term keys.

CLF-C02AIF-C01AIP-C01SAA-C03

Visual overview

DEFENSE IN DEPTHIdentity, data, network, detection, and audit controls protect different boundaries
IDENTITYAuthenticate + authorizePrincipals · policies · temporary credentials
DATAEncrypt + protect secretsKeys · certificates · application secrets
DETECT & AUDITFind threats + retain evidenceFindings · API history · configuration state
No single security service replaces the others. Strong AWS security combines preventive, detective, and evidence-producing controls around the workload.
AWS SERVICE MAPTemporary access path

A trusted identity assumes an IAM role, receives a temporary session, and its subsequent API activity can be attributed in CloudTrail.

IAM roleTrust and permissions for the session
Federated identityCommon human source for role-backed account access
CloudTrailRecords assumed-role API activity
EXAM-RELEVANT MECHANICS

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.

Trust controlRole trust policy

The role's resource policy identifies principals and conditions that may use an AssumeRole-style path.

Credential tupleAccess key + secret key + session token

Temporary STS credentials require the session token in addition to the familiar access-key pair.

Session restrictionRole permissions ∩ session policy

A supplied session policy can narrow effective permissions but cannot elevate beyond the role's available permissions.

TraceabilitySourceIdentity / session context

Supported assumption flows can carry source identity into the role session and CloudTrail evidence.

ABAC inputSession tags

Transitive or non-transitive session tags can become request attributes when trust allows sts:TagSession.

Role chainingAdditional duration constraint

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.

AWS STS turns authorization into a time-bounded session

AWS Security Token Service (AWS STS) operations such as AssumeRole return temporary credentials containing an access key ID, secret access key, and session token. SDKs and AWS compute integrations can obtain and refresh these credentials without placing a long-lived secret in application source code. The credentials expire, which reduces the window of usefulness if they are exposed, although short lifetime is not a substitute for least privilege or detection.

The caller can sometimes supply a requested session duration, session tags, source identity, or a session policy depending on the operation and configuration. Session policies restrict a session; they cannot expand it beyond the permissions available to the role. Source identity and session context can make CloudTrail activity easier to connect back to the original human or workload, while session tags support attribute-based authorization patterns when the trust and permission policies allow them.

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

  1. 01

    A role separates trust (who may assume it) from permissions (what a role session may do).

  2. 02

    AWS STS issues temporary credentials for role and federation sessions.

  3. 03

    Session policies can reduce a role session's effective permissions but cannot grant beyond the underlying role authorization.

  4. 04

    AWS workloads should normally consume automatically refreshed temporary role credentials rather than embedded long-term keys.

  5. 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.