What Is an AWS Cross-Account IAM Role? Delegate Only the Access Another Account Needs
An AWS cross-account IAM role lets a principal in one AWS account temporarily assume a role created in another account and perform only the actions allowed to that role. Instead of sharing long-term access keys, the resource-owning account’s trust policy must accept the caller, and the caller’s account policy must allow `sts:AssumeRole`. The role’s permissions policy defines what the assumed role can do. Trust (who may assume) and permissions (what the role may do) must therefore be scoped separately.
An AWS cross-account IAM role lets a principal in one AWS account temporarily assume a role created in another account and perform only the actions allowed to that role. Instead of sharing long-term access keys, the resource-owning account’s trust policy must accept the caller, and the caller’s account policy must allow sts:AssumeRole. The role’s permissions policy defines what the assumed role can do. Trust (who may assume) and permissions (what the role may do) must therefore be scoped separately.
This article follows official AWS IAM and STS documentation checked on November 19, 2026. It covers ordinary role delegation between accounts in the same AWS partition, not full centralized administration with AWS Organizations or AWS IAM Identity Center. The example is a deployment role in Account A that uploads files to a limited path in an S3 bucket in Account B.
What happens when a role is assumed?
A role is an IAM identity with a trust policy and permissions policies; it is not a user or service. To use a role in Account B, a deployment role in Account A sends an AssumeRole request to AWS Security Token Service (STS). If allowed, STS returns temporary credentials: an access key ID, secret access key, and session token. They work only until their expiration. The deployment then calls Account B APIs with those credentials, subject to the assumed role’s permissions.
Account A deployment role ── sts:AssumeRole request ──▶ Account B role
│ trust policy check │
└── caller policy must allow STS returns temporary credentials
│
access Account B using role permissionsAccount A, where the caller exists, is the trusted account. Account B, which owns the role and resource, is the trusting account. These names are easy to reverse mentally, so record account IDs and role ARNs in the design.
Why are two sides of policy needed?
The caller’s identity policy in Account A must allow sts:AssumeRole on the specific role in Account B. The role’s trust policy in Account B names the external account or role allowed to assume it. Both account evaluations must allow the request. If Account A permits the call but Account B does not trust the caller, assumption fails; the reverse also fails.
After assumption, the target role’s permissions policy controls the actions available in Account B. The permissions attached to the caller’s original role are not automatically added to the target role’s permissions. The assumed session uses the target role’s permissions. Service control policies (SCPs), permissions boundaries, session policies, resource policies, and explicit denies can further constrain the result.
Suppose DeployRole in Account A assumes UploadOnlyRole in Account B, which should only upload new objects. The following policy documents are illustrative: replace the account IDs, bucket, and trusted principal for your environment and review them before deployment.
Account B trust policy — permits only Account A’s specific deployment role to assume the role.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::111122223333:role/DeployRole" },
"Action": "sts:AssumeRole"
}]
}Account B permissions policy — permits the role session to upload objects under a specific bucket path.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::example-artifacts-bucket/releases/*"
}]
}Account A caller policy — permits DeployRole to assume only the target role.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::444455556666:role/UploadOnlyRole"
}]
}These three policies perform separate checks: the caller policy limits which role Account A can request; the trust policy limits who Account B accepts; and the target permissions policy limits what the session can do. If the application also needs to list the bucket, it needs s3:ListBucket on the bucket ARN separately; that permission is absent from the example.
When is an external ID needed, and what does it protect against?
When a third-party service serves multiple customers and assumes roles in their AWS accounts, the trust policy should require an external ID. This helps mitigate the confused deputy problem: a provider handling Customer A’s request should not accidentally or maliciously assume Customer B’s role. A customer-specific value is included in the request and required by that customer’s trust policy.
An external ID is not a secret credential; AWS does not treat it as secret. Anyone authorized to view the role can see it. Its protection comes from the third party using a unique value per customer and from the STS request and trust policy checking that value—not from hiding it like a password. You do not need to add an external ID to every ordinary role delegation inside one account. Use it when the third-party, multi-tenant scenario applies.
Cross-account role or resource-based policy?
Depending on the AWS service and resource, a resource-based policy can directly allow a principal from another account. For example, an S3 bucket policy can grant access to a specific role in another account. The caller continues operating as its original principal while accessing the shared resource. By contrast, a cross-account role creates a session using the permissions of a role in Account B, which can be useful for several resources or services, including services that do not support resource policies.
| Criterion | Cross-account role | Resource-based policy |
|---|---|---|
| Where access is defined | Target role trust and permissions policies, plus caller policy | Shared resource policy and caller account policy |
| Permission context | Temporary credentials for the target account role | Caller retains its original identity while accessing the shared resource |
| Useful when | One delegated role should cover multiple resources or a service lacks resource policies | Direct access is needed to a supported resource |
| Consideration | An overly broad trust policy can expose all permissions of the role | Support and evaluation vary by service; cross-account calls may need allows on both sides |
Not every AWS service supports resource-based policies. Check the service’s official documentation for support and principal syntax. AWS role and resource-policy delegation generally works only within a single AWS partition; for example, the standard aws and aws-cn partitions cannot delegate across each other this way.
A safe setup and verification sequence
**Confirm account ownership and purpose.** Record account IDs, caller and target role ARNs, shared resources, required API actions, and data flow. For a third-party provider, determine whether this is customer-specific delegation and request a unique external ID where appropriate.
**Create the role in the resource account.** In its trust policy, prefer a specific role ARN over trusting an entire account. Add an external ID or organization condition when the situation calls for it. Limit the permissions policy to necessary actions and resource ARNs.
**Allow only the needed assumption from the caller account.** Set the caller policy’s `Resource` to the target role ARN. Avoid unnecessary `sts:AssumeRole` targets or wildcards.
**Request a temporary session.** Use the AWS CLI or an SDK to call STS `AssumeRole` for the target role ARN. Treat returned keys and session token as temporary credentials; do not put them in logs or source code. A request can fail if its duration exceeds the role’s configured maximum. Role chaining is limited to a maximum one-hour session.
**Test both allowed and denied actions.** Confirm the intended upload works and that access to other buckets, object deletion, or policy changes fails unless explicitly granted. A successful upload alone does not prove that read or list access is absent, so test each boundary separately.
**Review audit and external sharing.** In AWS CloudTrail, inspect the `AssumeRole` event and role session. Use IAM Access Analyzer external access findings to review whether role trust or resource sharing crosses the intended trust boundary. These findings analyze policy-based access possibilities; they are not proof that an external principal actually accessed the resource.
Troubleshooting denied assumptions or excessive access
**`AccessDenied` while assuming the role:** Check `sts:AssumeRole` on Account A’s caller policy, the `Principal` in Account B’s trust policy, and account IDs and role names in the ARN. If using an external ID, ensure the request and condition match exactly.
**STS succeeds but an API call is denied:** The session uses the target role’s permissions. Check the service action, resource ARN, and separate bucket/object ARNs; also review SCPs, permissions boundaries, session policies, resource policies, and explicit denies.
**Only some operations fail:** Listing and object operations may need different actions and ARNs. Identify the exact needed action instead of masking the issue with broad `s3:*` access.
**A role is exposed to an unintended account or provider:** Check for account-wide or wildcard trust, and whether external ID or organization conditions are needed. Access Analyzer findings and CloudTrail events answer different questions: policy sharing that could permit access versus recorded calls.
**The session expires sooner than expected:** Check the target role’s maximum duration, requested `DurationSeconds`, and whether role chaining is involved. Chained sessions are limited to one hour.
Operational security principles
When delegating to an external account, consider whether that account’s administrator can further delegate access to other principals in that account. Trusting an entire account may let many of its principals assume the role if they satisfy the trust policy. Prefer a specific role when possible and scope temporary access to the actual task and resource path. If the provider’s systems are compromised, the role’s allowed permissions can be misused, so grant only what the service needs and periodically confirm that access can be revoked.
Cross-account IAM roles provide temporary access across account boundaries without sharing long-term keys. Their security comes not from STS alone, but from the combination of caller permission, target trust policy, least-privilege target permissions, and organization-level restrictions. For one supported resource, compare a resource-based policy. For a third-party multi-customer service, use a customer-specific external ID condition and verify that only the intended principal can assume the role.
References
[AWS IAM: Cross-account resource access](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html)
[AWS IAM: Cross-account policy evaluation logic](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic-cross-account.html)
[AWS IAM: Third-party account access and external IDs](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_third-party.html)
[AWS STS: AssumeRole API](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html)
[AWS IAM: IAM Access Analyzer findings](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-findings.html)
[Google Cloud IAM: Service account impersonation](https://cloud.google.com/iam/docs/service-account-impersonation)