
The Hidden Complexity of Cross-Account Access in AWS
Learn how AWS cross-account access works and why it can be challenging to configure securely. This article explains IAM roles, trust and permission policies, role chaining, and common access issues, with a practical example and best practices for using temporary credentials and least-privilege permissions.
The Hidden Complexity of Cross-Account Access in AWS
Introduction
As AWS environments grow, organizations often use multiple accounts to separate development, testing, production, and security workloads. This approach can improve isolation and help teams manage resources independently. However, it also introduces a challenge: how can a user or application in one AWS account securely access resources in another?
Cross-account access makes this possible, but it requires careful configuration of identities, permissions, and trust relationships. A small mistake can prevent legitimate access—or grant more access than intended.
What Is Cross-Account Access?
Cross-account access allows an identity from one AWS account to access resources in another account. For example, a developer in a development account may need to read logs stored in a centralized logging account.
Instead of sharing long-term credentials, AWS commonly uses IAM roles. A role can be assumed by an authorized identity, providing temporary credentials with the permissions defined by the role.
How It Works
A typical cross-account access flow involves three main steps:
- The target account creates an IAM role. The role contains permissions describing which actions can be performed on which resources.
- The role defines a trust policy. This policy identifies which external account, user, or role is allowed to assume it.
- The trusted identity assumes the role. After authorization, AWS Security Token Service (AWS STS) provides temporary credentials that can be used to access permitted resources.
The trust policy answers, “Who can assume this role?” The permissions policy answers, “What can the role do?” Both must be configured correctly.
Why Cross-Account Access Can Be Difficult
1. Trust and permissions are separate
A role may trust an account but still lack permission to perform the requested action. Conversely, a role may have the correct permissions but reject the identity attempting to assume it because the trust policy is incorrect.
Troubleshooting requires checking both sides of the relationship.
2. Broad permissions increase risk
Granting access to an entire account or using overly broad permissions can make configuration easier, but it can also expose resources unnecessarily. Restrict trust to specific roles or identities where possible, and grant only the actions and resources required.
3. Role chaining can complicate access
Sometimes a user assumes a role in one account and then assumes another role in a different account. This is called role chaining. Each step introduces another trust relationship and permission boundary that must be understood and maintained.
4. Policies can interact in unexpected ways
Identity policies, resource-based policies, permissions boundaries, and organization-level controls may all affect whether an action is allowed. An explicit deny in an applicable policy can block access even when another policy allows it.
A Practical Example
Imagine a company has two AWS accounts:
- Application account: Runs an application on Amazon EC2.
- Logging account: Stores centralized logs in Amazon S3.
The application needs permission to write logs to a specific S3 bucket. The logging account can create an IAM role that trusts the application’s EC2 role and grants only the required S3 actions on the designated bucket.
The application then assumes the logging role and receives temporary credentials. It can write logs without storing permanent access keys in the application.
This design limits access to the required resource and keeps the two accounts separate.
Best Practices
- Use IAM roles and temporary credentials instead of sharing long-term access keys.
- Restrict trust policies to specific accounts and identities.
- Apply least-privilege permissions to the role.
- Review both trust policies and permission policies when troubleshooting.
- Use external IDs when appropriate for third-party access scenarios.
- Monitor role activity with AWS CloudTrail.
- Review cross-account permissions regularly and remove access that is no longer needed.
Conclusion
Cross-account access is an important part of building secure, scalable AWS environments. It helps organizations separate workloads while still allowing teams and applications to collaborate.
The key is to understand that trust and permissions are different controls. By using IAM roles, temporary credentials, least-privilege policies, and regular monitoring, organizations can make cross-account access both practical and secure.
Cross-account access is not simply about allowing one account to reach another—it is about defining exactly who can access what, and under which conditions.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article