Evaluating Cross-Account Access Management: SAP-C02 Study Guide
Evaluating cross-account access management
Evaluating Cross-Account Access Management
Cross-account access management is a cornerstone of complex AWS architectures. It allows organizations to share resources and centralize security while maintaining the isolation benefits of a multi-account strategy.
Learning Objectives
- Distinguish between Trusting Accounts and Trusted Accounts.
- Configure IAM role Trust Policies for cross-account principals.
- Evaluate the trade-offs between Resource-based Policies and Identity-based Access Delegation.
- Understand the role of STS (Security Token Service) in generating temporary credentials.
- Determine the appropriate use of ABAC (Attribute-Based Access Control) for federated cross-account access.
Key Terms & Glossary
- Trusting Account: The account that owns the resource and defines who is allowed to access it.
- Trusted Account: The account containing the principal (user/role) that needs to access resources in another account.
- Trust Policy: A resource-based policy attached to an IAM role that defines which principals can assume the role.
- STS (Security Token Service): The AWS service that provides temporary security credentials for IAM users or federated users.
- ABAC (Attribute-Based Access Control): An authorization strategy that defines permissions based on attributes (tags), rather than static roles.
- SCIM (System for Cross-domain Identity Management): A protocol used to automate the exchange of user identity information between identity domains.
The "Big Idea"
In a complex organization, security is achieved through Access Delegation. Instead of creating duplicate IAM users in every account, we establish a Trust Relationship. A user in a "Developer Account" (Trusted) can assume a role in a "Production Account" (Trusting) to perform specific tasks. This minimizes long-lived credentials and centralizes identity management.
Formula / Concept Box
| Mechanism | Action Requirement | Credential Type |
|---|---|---|
| IAM Role Assumption | sts:AssumeRole | Temporary (Session-based) |
| Resource-based Policy | Directly granted on resource | Original User Credentials |
| Federation | SAML 2.0 / OIDC | Temporary (via STS) |
[!IMPORTANT] For cross-account access to succeed, the Trust Policy in the Trusting Account must ALLOW the access, and the Identity Policy in the Trusted Account must also ALLOW the
sts:AssumeRoleaction.
Hierarchical Outline
- IAM Roles as a Bridge
- Dual Nature: Roles act as both an identity (when used) and a resource (when being assumed).
- Trust Policies: Define who can assume the role (Resource-based policy for the role).
- Permissions Policies: Define what the role can do (Identity-based policy for the role).
- Cross-Account Mechanics
- Account A (Trusting): Creates the role and defines the trust policy.
- Account B (Trusted): Contains the user who calls
sts:AssumeRole.
- Scaling with Federation
- AWS IAM Identity Center (SSO): Best for organization-wide federation.
- Direct IAM Federation: Best for individual account-to-IdP links.
- ABAC Strategy: Using session tags passed via SAML/OIDC to manage permissions dynamically.
Visual Anchors
Cross-Account Trust Flow
Relationship Architecture
\begin{tikzpicture}[node distance=2cm, every node/.style={rectangle, draw, minimum width=2.5cm, minimum height=1cm, align=center}] \node (Trusted) {Trusted Account \ (Account B)}; \node (Trusting) [right=3cm of Trusted] {Trusting Account \ (Account A)}; \node (Resource) [below=1.5cm of Trusting] {AWS Resource \ (S3, RDS, etc.)};
\draw[->, thick] (Trusted) -- node[above] {sts:AssumeRole} (Trusting); \draw[->, thick] (Trusting) -- node[right] {Access} (Resource);
\node[draw=none, below=0.1cm of Trusted] {\tiny Holds the Principal}; \node[draw=none, below=0.1cm of Trusting] {\tiny Holds the Role}; \end{tikzpicture}
Definition-Example Pairs
- Trust Policy: A JSON policy document attached to a role that specifies which accounts or users can assume it.
- Example: Account A (Storage) allows
arn:aws:iam::123456789012:root(Account B) to assume theCrossAccountAdminrole.
- Example: Account A (Storage) allows
- Session Tags: Key-value pairs passed during role assumption to enable ABAC.
- Example: A developer logs in via Okta with a
Project: Alphatag; AWS uses this tag to grant access only to S3 buckets taggedProject: Alpha.
- Example: A developer logs in via Okta with a
Worked Examples
Scenario: Sharing a Central S3 Bucket
Goal: User DevUser in Account 2222 needs to read logs in Account 1111.
-
In Account 1111 (Trusting Account):
- Create a role named
LogReaderRole. - Trust Policy:
json
{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::2222:user/DevUser" }, "Action": "sts:AssumeRole" }] } - Permissions Policy: Attach
AmazonS3ReadOnlyAccessto this role.
- Create a role named
-
In Account 2222 (Trusted Account):
- Attach a policy to
DevUserallowing them to callsts:AssumeRoleon the ARN ofLogReaderRolein Account 1111.
- Attach a policy to
Checkpoint Questions
- Why is using an IAM Role preferred over a Resource-based policy for services like EC2?
- What is the specific STS API call used to gain temporary credentials for a role?
- In a cross-account scenario, which account pays for the resources used by the assumed role?
- What is the difference between SCIM and SAML in the context of IAM Identity Center?
Muddy Points & Cross-Refs
- Role Chaining: You can assume a role from a role, but the session is limited to a maximum of 1 hour by default and cannot be extended.
- Resource-based Policy Support: Not all services support resource-based policies (e.g., S3, SNS, and SQS do; EC2 does not). If the service doesn't support it, you must use IAM roles for cross-account access.
- Confused Deputy: Remember to use
ExternalIdin trust policies when allowing third-party (SaaS) access to your account to prevent the confused deputy security risk.
Comparison Tables
| Feature | Resource-based Policy | Cross-Account IAM Role |
|---|---|---|
| Mechanism | Attached directly to the resource. | User switches identity to a role. |
| Permission Flow | Single point of control (Resource). | Double-check (Trust + Identity). |
| Principal | Remains the original user. | Becomes the Role's identity. |
| Service Support | Limited (S3, KMS, SQS, etc.). | Universal across AWS services. |
| Use Case | Simple sharing (e.g., one S3 bucket). | Complex access (e.g., managing EC2). |