Identity Federation & SSO
Identity Federation & SSO
In a multi-account AWS organization, every team, application, and automated pipeline needs to authenticate. Naively, this means thousands of IAM users scattered across dozens of accounts — each with its own password policy, MFA state, and access-key rotation schedule. At scale that model collapses: a single off-boarded employee might still hold active credentials in seven accounts. Identity federation solves this by making your company's existing identity provider (IdP) the single source of truth and issuing short-lived AWS credentials on demand. No persistent IAM users, no long-lived access keys, no off-boarding gaps.
The Core Concept: Federated Trust
Federation works by establishing trust between two parties: an Identity Provider (IdP) — Okta, Azure AD, Google Workspace, or any SAML/OIDC-compliant system — and a Service Provider (SP), in this case AWS. The IdP asserts who a user is (authentication) and what groups they belong to (attributes). AWS maps those assertions to IAM roles and issues temporary STS credentials valid for 1–12 hours. When the session expires the user re-authenticates; there is nothing to revoke because the credentials never persist.
SAML 2.0 vs OIDC — When to Use Which
SAML 2.0 (Security Assertion Markup Language) is the older, XML-based standard. It is the right choice when your corporate IdP is Okta, Azure AD, or PingFederate and you are federating human users into the AWS console or the IAM Identity Center portal. SAML tokens are large but the round-trip is browser-based so size is not a practical constraint.
OIDC (OpenID Connect) is the modern, JSON/JWT-based protocol built on OAuth 2.0. It is the right choice for machine identities: a GitHub Actions workflow, a GitLab CI job, or a Kubernetes service account that needs to assume an IAM role without storing a long-lived access key. OIDC tokens are compact, verifiable with a public JWKS endpoint, and fit naturally into automated pipelines.
AWS IAM Identity Center (Successor to AWS SSO)
IAM Identity Center is the AWS-native control plane for federated access. It lives in the management account, syncs with your IdP via SCIM (automatic user/group provisioning), and lets you assign Permission Sets to groups across accounts. An engineer in the platform-engineers Okta group can get AdministratorAccess in sandbox accounts and ReadOnlyAccess in production — all from a single portal URL, no account-specific IAM user needed.
Setting up Okta as an external IdP for IAM Identity Center involves three steps: register the AWS app in Okta, download the Okta SAML metadata, and upload it to IAM Identity Center. Then enable SCIM so group membership changes in Okta propagate automatically within minutes rather than requiring manual IAM updates.
OIDC Federation for CI/CD Pipelines
The most important machine-identity pattern in modern DevOps is OIDC federation for CI/CD. Instead of storing AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as repository secrets (which rotate poorly and leak through log accidents), your pipeline exchanges a short-lived OIDC token issued by GitHub Actions (or GitLab CI, CircleCI, etc.) for temporary AWS credentials via sts:AssumeRoleWithWebIdentity. The IAM trust policy scopes which repos and branches can assume the role — a leaked token from a fork cannot assume your production deploy role.
sub condition to repo:acme-org/* (wildcard over all repos) or omitting the branch restriction entirely. This means any repository in your GitHub org — including a compromised or newly-created one — can assume your production deploy role. Always scope to the specific repo and branch. For multi-environment setups, create separate roles per environment with branch-scoped conditions: refs/heads/main for prod, refs/heads/release/* for staging.AWS CLI Profile Setup for SSO
Engineers authenticate through the IAM Identity Center portal and then use aws sso login to populate local credentials. The AWS CLI v2 natively supports SSO-backed profiles. Each profile maps to an account + permission set combination, enabling engineers to switch contexts with --profile or the AWS_PROFILE environment variable.
Governance and Audit Considerations
Every AssumeRole call lands in AWS CloudTrail with the federation source identity attached (sourceIdentity field). This means you can answer "who accessed the production database at 2 AM" with a single Athena query across your org's CloudTrail lake — the human's corporate email address, not an anonymous role ARN. Enforce sts:SetSourceIdentity in your IAM Identity Center permission set boundary and require it in all service control policies so no pipeline can assume a role without propagating the originating identity.