AWS cross-account role assumption: configure trust and permissions on both sides
AWS cross-account role assumption lets a principal in one account obtain temporary credentials for a role in another. The role trust policy determines who may assume it; the role permissions policy determines what the resulting session may do. The caller also needs permission to call sts:AssumeRole, and other applicable controls must not deny the request.
How role assumption works
Consider a deployment role in a development account that needs read-only access through a role in a production account.
The production account creates the target IAM role and its permissions policy.
Its trust policy names the permitted principal from the development account and any required conditions.
An administrator in the development account grants the deployment role identity-based permission to call `sts:AssumeRole` on the exact target role ARN.
The caller sends an AWS STS AssumeRole request. AWS evaluates the caller account and target account policies, including applicable boundaries and organization controls.
If allowed, STS returns temporary credentials for the target role session. The workload uses them only for the required tasks and refreshes them safely before expiration.
Naming an account in a trust policy does not automatically let every identity in that account assume the role. Its administrator must grant the caller permission too. Conversely, caller permission alone is insufficient if the target role does not trust that principal.
Review each policy layer
| Layer | Check | Common mistake |
|---|---|---|
| Target role trust policy | Does it name only the necessary account or role and constrain the request? | Trusting a broader principal than needed |
| Caller identity policy | Does it allow sts:AssumeRole on the exact role ARN? | Using an unnecessarily broad resource |
| Target role permissions | Are only required actions and resources allowed? | Granting broad administrator access |
| Additional controls | Do permissions boundaries, session policies, Organizations SCPs/RCPs, or explicit denies restrict access? | Treating one Allow as the final decision |
| Session audit | Are session name, source identity, MFA, or session tags needed and recorded? | Losing the link to the original caller |
| Credential lifetime | Are credentials short-lived and refreshed safely? | Storing role credentials long-term |
For a multi-tenant third-party service, an ExternalId condition can help prevent the confused deputy problem. The service should generate a unique ExternalId for each customer, and the customer should require it in the role trust policy. ExternalId is not a secret or a substitute for restricting the trusted principal and permissions. The service should always send the correct customer-specific value with AssumeRole.
Apply and verify safely
Separate roles across development, test, and production accounts. Review and audit policy changes.
Prefer a specific role principal and verifiable conditions over trusting an entire account when practical.
For third-party access, link each customer’s role ARN to its unique ExternalId.
Before storing or using that ARN, verify that a request with the correct ExternalId succeeds and requests with a missing or incorrect value fail. If the role can be assumed without the correct value, wait until the trust policy is fixed.
Use an identifiable session name and source identity so logs connect the caller to the assumed-role session.
Test expected Allows and Denies in a non-production account or policy simulator. Simulation may not capture every organization or runtime control, so it does not guarantee the live result.
For example, a monitoring provider that only needs metrics could be trusted as a specific principal, require a customer-specific ExternalId, and receive only the required monitoring actions and resources. This describes a policy design; it is not a performed deployment or policy evaluation.
References
[AWS IAM: Cross-account resource access](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html)
[AWS IAM: Update a role trust policy](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_update-role-trust-policy.html)
[AWS IAM: Third-party account access](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_third-party.html)
[AWS IAM: Cross-account policy evaluation](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic-cross-account.html)