Volume 3 · Chapter 8 — Identity, Security and Compliance
Advanced Roles, Cross-Account Access, and Federation
8.1 Introduction
Roles are the backbone of AWS access, and beyond the basics the exam tests the varieties of roles (service roles, service-linked roles, instance profiles), the safe cross-account patterns (external ID, the confused deputy), role chaining, and the federation options (SAML, web identity, IAM Identity Center) plus AWS Directory Service. This chapter provides that depth for designing enterprise identity.
8.2 Role Varieties
Several kinds of role appear on the exam. Aservice roleis a role a service assumes to act on your behalf (e.g. a role that lets Lambda write logs or that lets CodePipeline deploy). Aservice-linked roleis a predefined role owned and managed by a specific service, with permissions the service requires, that you can’t arbitrarily edit - it simplifies letting a service operate. Aninstance profileis the container that delivers a role’s credentials to an EC2 instance (attaching a role to an instance actually attaches an instance profile). Roles for workloads deliver temporary credentials via the instance/container/function metadata, which is why “workloads use roles, not keys” works. Knowing that service-linked roles are service-managed and that instance profiles bridge roles to EC2 are tested details.
8.3 Cross-Account Access, External ID, and the Confused Deputy
Cross-account access works by creating a role in the target account whosetrust policyallows a principal in the source account to assume it; the source principal is grantedsts:AssumeRoleand gets temporary credentials in the target. Two security details matter. Theconfused deputyproblem occurs when a third party (like a SaaS vendor) assumes a role on your behalf and could be tricked into acting against the wrong customer’s resources; the mitigation is anexternal ID- a shared secret the third party must present when assuming the role - or, for AWS-service callers, theaws:SourceArn/aws:SourceAccountconditions.Role chaining(assuming a role, then using it to assume another) is possible but resets the session duration and has limits. These are the patterns for safe delegation across accounts and to vendors.
sequenceDiagram participant Src as Source account principal participant STS participant Role as Target account role (trust policy + external ID) participant Svc as Target resources Src->>STS: AssumeRole (+ external ID) STS->>Role: trust policy allows Src AND external ID matches? Role-->>STS: allowed STS-->>Src: temporary credentials Src->>Svc: act in target account (scoped, temporary)
8.4 Federation: SAML, Web Identity, and IAM Identity Center
Federation lets external identities use AWS without IAM users.SAML 2.0 federationintegrates a corporate IdP (Active Directory via AD FS, Okta) so employees assume roles after authenticating with the IdP - the traditional enterprise SSO to AWS.Web identity federationlets users authenticate with an external provider (Google, Facebook, or any OIDC provider) and assume a role, typically via Amazon Cognito for mobile/web apps.IAM Identity Center(covered in Volume 1) is the modern, recommended way to centralize workforce access across many accounts with permission sets, connecting to an external IdP or its own directory. The exam pattern: for workforce/employee access across accounts use IAM Identity Center (or SAML); for customer/app users use web identity federation via Cognito.
8.5 AWS Directory Service
AWS Directory Serviceprovides managed directories.AWS Managed Microsoft ADis a full managed Active Directory in AWS (supports trusts to on-premises AD, for apps needing real AD).AD Connectoris a proxy that redirects directory requests to your existing on-premises AD without storing data in AWS (for using on-prem AD with AWS services).Simple ADis a low-cost, small-scale, Samba-based directory for basic needs. The exam distinction: Managed Microsoft AD for a full AWS-hosted AD with on-prem trust, AD Connector to proxy to existing on-prem AD, Simple AD for simple standalone needs.
8.6 Banking Production Scenario
A bank’s employees access AWS through IAM Identity Center federated to the corporate Active Directory, assuming least-privilege permission sets per account with MFA. Applications on EC2 use instance profiles delivering role credentials; managed services use service-linked roles. A SaaS monitoring vendor is granted cross-account access via a role that requires an external ID to prevent confused-deputy attacks. A legacy application needing real Active Directory runs against AWS Managed Microsoft AD with a trust to the on-premises domain. Customer-facing mobile apps authenticate through Cognito web identity federation, exchanging tokens for scoped temporary AWS credentials. This full federation and role architecture - workforce via Identity Center, apps via Cognito, vendors via external-ID roles - is the enterprise identity design the certification expects.
8.7 Chapter Revision Notes
- Service roles (a service acts on your behalf), service-linked roles (service-managed), instance profiles (deliver a role to EC2).
- Cross-account = role in target with a trust policy for the source; use an external ID (or aws:SourceArn) to prevent the confused-deputy problem; role chaining resets session duration.
- Federation: SAML for corporate SSO, web identity (via Cognito) for app/customer users, IAM Identity Center for centralized workforce access across accounts.
- Directory Service: Managed Microsoft AD (full AD in AWS, on-prem trust), AD Connector (proxy to on-prem AD), Simple AD (small standalone).
- Workforce → Identity Center/SAML; customers/apps → Cognito web identity federation.