Founding prices until 15 December: 30% off Pro, locked for life. See pricing

$ … AccessDenied: User is not authorized to perform: sts:AssumeRole

'not authorized to perform sts:AssumeRole': trust policies

The role's trust policy doesn't name the caller, or the caller may not call sts:AssumeRole.

Cloud

What it means

Assuming a role needs two things: the caller allowed to call sts:AssumeRole on the role, and the role's trust policy listing the caller as a principal (with any conditions met, such as MFA or external ID).

Causes and fixes

Most likely first. Run the check, and if it matches, apply the fix.

1. The trust policy names another principal, or the wrong account

Check:

aws iam get-role --role-name <role> --query Role.AssumeRolePolicyDocument

Fix: Add the caller's ARN (or its account) as the Principal.

2. A condition isn't met (MFA, ExternalId, source)

Check:

Read the Condition block in the trust policy

Fix: Meet the condition (pass --serial-number/--token-code or --external-id).

Fix it yourself

A live machine in your browser with this problem already on it. The grader checks the result.

Open the lab

No account needed for your first tries.

Related errors