What You'll Learn
You'll learn how to securely share resources between different cloud accounts using cross-account roles instead of duplicating credentials.
The Problem: Account Boundaries
In cloud environments, organizations often run multiple accounts—one for development, another for production, maybe a third for security auditing. But what happens when a service in Account A needs to access a resource in Account B? Sharing passwords or access keys is dangerous and hard to manage.
What Are Cross-Account Roles?
Cross-account roles are IAM roles that allow identities in one cloud account to temporarily assume permissions in another account. Think of it like a hotel keycard: the front desk (Account A) gives you a card that works in your room (Account B), but only for your stay, and only for your room.
Instead of creating duplicate user credentials in every account, you create a role in the target account that trusts the source account. Users or services from the trusted account can then "step into" that role and gain its permissions—temporarily.
How It Works
- Account B (the resource owner) creates a role with a trust policy that says "Account A can assume this role"
- Account A grants its users or services permission to assume that role
- When needed, Account A requests temporary credentials for the role
- Account A uses those temporary credentials to access Account B's resources
- The credentials expire automatically (typically 1-12 hours)
This follows the principle of least privilege: access is temporary, auditable, and scoped to exactly what's needed.
Use Cases
- Security teams auditing production accounts
- CI/CD pipelines deploying to multiple environments
- Centralized logging or monitoring services
Key Takeaway: Cross-account roles enable secure, temporary access between cloud accounts without sharing permanent credentials, using a trust-based delegation model.