Join our Newsletter — 33% off our NHI Course
Home› Guides› AWS Role Chaining for Beginners: How One Role…
Guide Cloud & Workload Identity

AWS Role Chaining for Beginners: How One Role Hands Off to Another

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 4 December 2026 10 min read
On this page

AWS role chaining is when temporary access from one role is used to take on a second role.

This guide is for anyone who has heard of "assuming a role" in AWS and wants to know what happens when roles hand off to each other. You do not need to write code. If your business runs on AWS, its apps and pipelines probably do this every day.

In short

  • A role is an AWS identity with permissions but no permanent password or keys. Using it gives temporary credentials.
  • Role chaining means using one role's temporary credentials to take on another role.
  • Each hop swaps the permissions, and a chained session lasts one hour at most.
  • Chains can hide who started them, so carry a source identity through and review which roles trust which.

What you will learn

  • Explain what an AWS role is and what role chaining adds.
  • Describe why chaining can make it hard to see who did what.
  • Spot a role that is trusted by too many others.
  • Ask whether your chains carry a source identity.
Job hat (role)
an AWS identity with set permissions that people or apps can take on for a while.
Taking on a role (assuming)
asking AWS for temporary credentials to act as that role.
Short-term keys (temporary credentials)
access that expires on its own after a set time.

What is AWS role chaining?

Think of a relay race. The first runner hands the baton to the second, who hands it to the third. Each runner covers only their own stretch of track.

In AWS, a role is an identity with permissions but no lasting password or keys. When someone or something takes on a role, AWS hands out temporary credentials for that role [1]. Role chaining is when those temporary credentials are then used to take on a second role [1].

When you take on a role, you put down your own permissions and use the role's instead [1]. So at each hop, the permissions change.

Where the comparison stops working: in a relay, everyone can see who started. In AWS, the records at the last hop may show only the role before it, unless the starting identity was carried along.

Roles used by apps and pipelines are non-human identities, each with its own account and credentials. Here the credentials are dynamic: issued when needed and short-lived. See Non-Human Identities for Beginners.

Why does it matter?

Chains are normal and useful, for example to reach another AWS account. But a chain can also carry access further than anyone planned.

If you are new to cloud work

What could happen: a low-level role can take on a powerful one, and nobody noticed the link.

Check this: ask which roles are allowed to take on your most powerful roles.

Next: How to review AWS cross-account trust policies for confused deputy

If you investigate incidents

What could happen: records show a role deleted data, but not which person or app started the chain.

Check this: find out whether your chains set a source identity at the first step.

Next: AWS Role Chaining Detection

If you manage a cloud team

What could happen: chains built for an old project still link accounts long after it ended.

Check this: ask for a yearly review of roles that trust other roles or accounts.

Next: How to find unused AWS IAM roles and access keys

What does it look like?

Here is a made-up summary of one chain, written out step by step. It shows what to look for.

Example only. All values are made up.

Step 1: pipeline EXAMPLE-build-runner
        takes on role  build-role   (account 000000000000)
        source identity: build-runner-0000       (1)
Step 2: build-role
        takes on role  deploy-role  (account 000000000001)  (2)
        session length asked: 1 hour             (3)
Step 3: deploy-role writes to a FAKE storage bucket  (4)
  1. A source identity set at the start. It travels with every later hop.
  2. The second hop crosses into another account. In a real file, this line would name the role's full address.
  3. One hour is the most a chained session can last.
  4. The action at the end. Without line 1, records here would show only deploy-role.

Why this is risky: if no source identity is set, tracing step 3 back to step 1 means joining many records by hand.

The safer way: set a source identity at the first step, and only let the roles that need it take on deploy-role.

How does it work?

  1. Start with an identity. A person, app or AWS service has its own credentials.
  2. Take on the first role. The first role's trust policy (the rule listing who may take on the role) must allow the caller. AWS then returns temporary credentials [1][2].
  3. Take on the next role. Those temporary credentials are used to ask for a second role. Its trust policy must allow the first role. This is the chain [1].
  4. Work within a time limit. A chained session lasts one hour at most, whatever each role's own setting. Asking for longer makes the request fail [1][2].
  5. Carry the starting name. A source identity (a name set at the first step) passes through every chained hop and cannot be changed later. It appears in AWS's activity records, called CloudTrail [3].
Diagram titled How one role hands off to another. Four boxes joined by numbered arrows. Box 1, Starting point: a person or app with its own credentials. Arrow 1 to box 2, Role A: trusts the starting point and gives temporary credentials. Arrow 2 to box 3, Role B, highlighted in green: trusts Role A and gives new temporary credentials. Arrow 3 to box 4, The resource: for example a storage bucket in another account. A note says the starting point assumes Role A, Role A's temporary credentials assume Role B, Role B is used to reach the resource, and a chained session lasts one hour at most.
Figure 1. Each hop uses the last role's temporary credentials to take on the next role.

The name given to each session is chosen by whoever makes the request [2]. That makes it useful for tidy records, but weak as proof of who started a chain. A source identity is harder to change, and a role's trust policy can insist on it [3].

Diagram titled Can you tell who started the chain? Two panels. Risky: records at Role B show only a Role A session; session names are chosen by the caller and easy to fake; tracing back means joining many log entries by hand. Safer, highlighted in green: a source identity is set at the first step; it is carried through every hop and cannot be changed; the role's trust rules can insist on having it.
Figure 2. A source identity keeps the starting name visible at every hop.

A worked example

This story is made up to show the idea.

Zoe Atkinson is a cloud engineer at Brightwell Foods. The company has one AWS account for building software and another for the live shop. Their build pipeline takes on a build role, then chains to a deploy role in the live account.

One morning a storage bucket in the live account has old files deleted. The records show deploy-role did it. Zoe's manager, Aisha Grant, asks the obvious question: who was behind deploy-role?

Zoe checks. Three different roles are allowed to take on deploy-role, including one left over from a project that ended last year. The session name says "pipeline", but anyone making the request could have typed that.

After a few hours of joining records by hand, Zoe traces it to a planned clean-up job that ran with the wrong folder setting. It was a mistake, not an attack. But it took far too long to find.

Zoe and Aisha agree on three changes. First, deploy-role will trust only the build role. Second, the pipeline will set a source identity at its first step, and deploy-role's trust policy will require it. Third, they will review role trust links every quarter.

A month later a test run shows the pipeline's name at every hop in the records. Zoe can now answer Aisha's question much faster, using the records available to her.

Myths and mistakes

What people thinkWhat is true
Role chaining is a hacker trick.It is a normal AWS feature, often used to reach other accounts. It needs care, not banning.
Temporary credentials make chains safe.They expire, but while they last they carry the full permissions of the role.
You can set a long session on a chained role.A chained session is capped at one hour, whatever the role's own setting.[1]
The session name proves who started it.The caller picks the session name. A source identity is a stronger record.
Once set up, trust links can be left alone.Old links can let a forgotten role reach a powerful one. Review them.

What can I do this week?

  • Pick your most powerful role and list every role or account that can take it on.
  • Ask whether your pipelines set a source identity at their first step.
  • Find any trust link to a project or team that no longer exists.
  • Check that your AWS activity records cover every region you use.

Checklist

  • I can explain what an AWS role is and what chaining adds.
  • I know a chained session lasts one hour at most.
  • Powerful roles are trusted only by the roles that need them.
  • Our chains set a source identity, and key roles require it.
  • We do not rely on session names as proof of who acted.
  • Role trust links are reviewed on a schedule.
  • Activity records are kept for every account in a chain.

Common questions

Why would anyone chain roles on purpose?

To keep access separate. A team might sign in to one central account, then take on a role in each other account they need. That avoids giving one identity permanent access everywhere. Chaining is how one temporary role leads to the next.

Why is a chained session limited to one hour?

AWS sets that limit. Its documentation says role chaining caps the session at one hour, whatever the maximum set on each role. If a chained request asks for longer, it fails [1]. The short life limits how long chained credentials stay useful.

What is a source identity?

A name set at the first step of a chain. AWS carries it through every chained hop and records it, and it cannot be changed later in that session. A role's trust policy can require it, so the starting person or app stays visible [3].

Can attackers use role chaining?

Yes, if they get hold of credentials. They can follow trust links from a weak role to a stronger one, and the chain can blur their trail. Tight trust policies, source identity and alerts on unusual hops help defenders spot and limit this.

Where next?

Ready for the detail? Read the practitioner guide: AWS Role Chaining Detection. It goes further into the CloudTrail fields that link hops, rebuilding a chain, and alert rules for unusual role use.

Also useful:

Related NHI Mgmt Group resources: Non-Human Identities for Beginners, Least Privilege for Beginners and How to review AWS cross-account trust policies for confused deputy.

Key terms

IAM role
An AWS identity that gives temporary credentials instead of a permanent password or keys.
Role chaining
Using one role's temporary credentials to take on another role.
AssumeRole
The AWS request that returns temporary credentials for a role, if its trust policy allows the caller.
Trust policy
The rule on a role that says who may take it on, and under which conditions.
Temporary security credentials
Short-lived access issued for a session, often by taking on a role.
Source identity
A name set at the start of a role session that AWS carries through chained hops and records.

Sources and further reading

  1. Amazon Web Services, "IAM roles" (including "Roles terms and concepts"), AWS Identity and Access Management User Guide. https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html (accessed 4 Dec 2026).
  2. Amazon Web Services, "AssumeRole", AWS Security Token Service API Reference. https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html (accessed 4 Dec 2026).
  3. Amazon Web Services, "Monitor and control actions taken with assumed roles", AWS Identity and Access Management User Guide. https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html (accessed 4 Dec 2026).

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.