AWS Architecture Guide

Roles, Trust, and Temporary Credentials

Goal

Explain why role assumption and temporary credentials are the preferred access pattern for both humans and workloads in AWS.

This section builds around one durable idea:

Roles separate who is asking from what access they can safely assume for a limited time.

The Short Version

An IAM role is an identity with permissions that is meant to be assumed when needed. It does not carry standard long-term credentials such as a password or access key. When a principal assumes the role, AWS Security Token Service issues temporary credentials for that session.

That design is one of the most important AWS mental models:

Caller
  -> trusted to assume role
  -> receives temporary credentials
  -> acts with role permissions for a limited session
  -> session expires

Roles reduce the need to distribute permanent secrets and let the team grant access that is temporary, scoped, and easier to audit.

Two Different Questions: Trust and Permission

Many IAM problems come from mixing up two different questions.

QuestionPolicy that answers it
Who may assume this role?Trust policy
What may the assumed role do after assumption?Permission policies attached to the role

This is why the role model is powerful. It cleanly separates entry conditions from post-entry permissions.

In AWS documentation, the Principal element inside a role trust policy defines who can assume the role. That trusted principal might be:

  • an IAM user or role in the same account,

  • an IAM role or account from another account,

  • a federated identity from an external identity provider,

  • or an AWS service principal such as EC2 or Lambda.

Why Temporary Credentials Are Safer

AWS documentation highlights several advantages of temporary credentials:

  • they are short-lived,

  • they are generated dynamically,

  • they do not need to be embedded into applications in the same way as long-lived keys,

  • and they naturally support delegation, federation, and cross-account access.

That matters operationally.

If a permanent access key is copied into a pipeline, build server, or application config, the team must protect it, rotate it, track where it was distributed, and clean it up after people or systems change. If a role is assumed instead, the credential naturally expires and can be reissued only if the caller is still allowed to assume the role.

The Main Role Patterns

Human access

AWS guidance recommends human users use federation with an identity provider and temporary credentials. In practical architecture terms, humans should usually arrive through a federated sign-in path, then assume environment-appropriate roles such as read-only, operator, or deployment roles.

Workload access

Applications running on AWS compute services such as EC2 and Lambda should normally receive role-based temporary credentials instead of embedded IAM user keys. The runtime gets credentials for the attached role, and the application uses those credentials through the AWS SDK.

Automation access

Pipelines, deployment systems, and external automation should assume tightly scoped roles for deployment, artifact access, or state inspection. That keeps automation explicit and revocable.

Example: CI/CD and Incident Response

A CI/CD pipeline needs to deploy infrastructure to several non-production accounts and occasionally to production through an approved path. An incident responder also needs elevated access, but only during a real event.

The safer pattern is not "give both actors a shared admin user." It is:

  • one deployment role per target account with narrow permissions,

  • one incident-response role with elevated but time-bound access,

  • clear trust policies defining who may assume each role,

  • and temporary credentials for every session.

This creates separate audit trails and smaller blast radius.

Where Teams Go Wrong

Roles are safer than long-lived keys, but only if the trust side is designed carefully.

Common failure modes include:

  • making the trust policy too broad,

  • letting too many users or accounts assume a powerful role,

  • treating a role as if it were just another named user,

  • and leaving permanent access keys in pipelines because the first implementation was faster.

The hard boundary is often the trust policy, not the permissions policy. If the wrong caller can assume the role, the rest of the design may already be compromised.

Common Mistakes

  • Treating roles as just another synonym for users.

  • Designing a strong permissions policy but a weak trust policy.

  • Leaving long-lived access keys in pipelines, scripts, or applications.

  • Forgetting that privileged access should often be time-boxed and separately reviewed.

If Someone Asks You

Why does AWS push teams toward roles and temporary credentials?

A good answer is:

Because roles let AWS separate trust from permission and issue temporary credentials only when needed. That reduces long-lived secret risk, supports federation and cross-account access, and makes sessions easier to scope and audit.

What to Remember

In AWS, safe access usually means assuming the right role for the right duration instead of carrying permanent credentials.

Questions to Check Understanding

  1. What question does a trust policy answer?

  2. Why are temporary credentials operationally safer than long-lived keys?

  3. Which types of actors should normally assume roles in AWS?

Further Study