3.3.1.7. Workload Identities for Hybrid and Multi-Cloud (IAM Roles Anywhere, OIDC Federation)
3.3.1.7. Workload Identities for Hybrid and Multi-Cloud (IAM Roles Anywhere, OIDC Federation)
💡 First Principle: A workload outside AWS should prove its identity with something it already has, such as a certificate from your PKI or a token from its own platform, and swap it for short-lived AWS credentials, so that no long-lived access key ever exists to leak.
Pick the mechanism by the identity the workload already holds:
| Workload | Identity it already has | AWS mechanism |
|---|---|---|
| On-premises servers, VMs or containers enrolled in a corporate PKI | X.509 certificate from your CA or "AWS Private CA" | IAM Roles Anywhere |
| CI/CD systems (GitHub Actions, GitLab), workloads in another cloud (an Azure managed identity, a Google Cloud service account) | Signed OIDC token from that platform | IAM OIDC identity provider + a role assumed with AssumeRoleWithWebIdentity |
| Kubernetes outside EKS | Service-account token (OIDC issuer) or a workload certificate | OIDC federation or Roles Anywhere (EKS Pod Identity is EKS-only) |
| An AWS workload that must call another cloud or a SaaS API | Its IAM role | IAM outbound identity federation: sts:GetWebIdentityToken returns a signed JWT the external service verifies |
| People | Corporate directory | IAM Identity Center (workforce), not a workload mechanism |
How IAM Roles Anywhere works:
- Trust anchor: a reference to your CA (an
"AWS Private CA"or an uploaded external CA certificate bundle). Any certificate that chains to it can authenticate. - Profile: names the roles that may be assumed, an optional session policy that caps the permissions, and the session duration.
- Role trust policy: trusts
rolesanywhere.amazonaws.comforsts:AssumeRole,sts:TagSessionandsts:SetSourceIdentity. Roles Anywhere maps the certificate's Subject, Issuer and SAN fields to session tags (aws:PrincipalTag/x509Subject/CN,.../x509Subject/OU,.../x509SAN/URIfor a SPIFFE ID). Add conditions on these tags and onaws:SourceArn(the trust anchor) so only the intended certificates can use each role. - On the host: the credential helper signs a
CreateSessionrequest with the private key (which can stay in a TPM or PKCS#11 module) and plugs into the SDK throughcredential_process. Revocation works through a certificate revocation list you import; Roles Anywhere does not call CRL distribution points or OCSP. - Resources are Regional and per account, and trust is account-wide unless trust-policy conditions narrow it.
OIDC federation details: create the IAM OIDC provider for the issuer (for GitHub Actions token.actions.githubusercontent.com) and condition the role on the token's aud and sub claims, for example repo:org/app:ref:refs/heads/main, so only that repository and branch can deploy. Matching on the issuer alone would let any repository on the platform assume the role.
Outbound identity federation (the reverse direction): after you enable it, the account gets an issuer URL; IAM policies decide which roles may call sts:GetWebIdentityToken and for which audiences, signing algorithms and lifetimes; and the external provider trusts that issuer. Those tokens cannot be used to sign in to AWS.
⚠️ Exam Trap: A trust anchor trusts every certificate its CA issues. Without trust-policy conditions on certificate attributes, any server holding a corporate certificate can assume the role. A session policy on the profile limits what the session can do, not who can obtain it.