View a markdown version of this page

Authenticate to services outside AWS - AWS Identity and Access Management

Authenticate to services outside AWS

Preview release

Agent and workload identity is in preview release for AWS Identity and Access Management (IAM) and is subject to change.

A workload with an identity can prove it to services outside AWS, such as your own APIs, a Model Context Protocol (MCP) server, a service mesh, or a third-party service, without a stored secret. It requests a short-lived credential for the identity that its role session already carries:

Credential

API

Lifetime

Signed by

JSON Web Token SPIFFE Verifiable Identity Document (JWT-SVID)

sts:GetWebIdentityToken with TokenType JWT_SVID

60–3,600 seconds, and never longer than the remaining role session

One of your provider's IAM-managed keys (ES384 or RS256)

X.509 SPIFFE Verifiable Identity Document (X.509-SVID)

sts:GetCertificate

1–12 hours. The default is 12 hours.

Your AWS Private Certificate Authority (AWS Private CA)

The subject of both credentials is the workload's identifier, the same value as aws:OriginIdentity/Subject. Both are available only under a provider that uses the Secure Production Identity Framework for Everyone (SPIFFE) scheme.

On Amazon Elastic Kubernetes Service (Amazon EKS), the Pod Identity Agent requests and renews these credentials for you. For more information, see Amazon EKS. There are no console steps for this task, because workloads request credentials at runtime.

Prerequisites

You don't need to turn on outbound identity federation for your account to get JWT-SVIDs.

Get a JWT-SVID

AWS CLI

aws sts get-web-identity-token \ --token-type JWT_SVID \ --signing-algorithm RS256 \ --audience https://api.example.com \ --duration-seconds 900
{ "WebIdentityToken": "<compact JWT>", "Expiration": "2026-12-01T11:30:00Z" }
  • --audience is required. For a JWT-SVID, pass exactly one value. It becomes the token's aud claim. Set the audience to the specific relying party, so a token can't be replayed to another service.

  • --signing-algorithm is required. Choose the algorithm the relying party accepts, ES384 or RS256.

  • If --duration-seconds is longer than the remaining role session, the request fails with SessionDurationEscalation.

The token's iss claim is your provider's OpenID Connect (OIDC) issuer URL, and its kid header selects the key in the provider's JSON Web Key Set (JWKS). The token contains these claims: sub, the workload's identifier; aud; iss; iat, the time the token was issued; exp; and jti, a unique ID for each token.

Services that accept each token only once

Some relying parties accept a token with a given jti only once and reject it if it's presented again. The EKS Pod Identity Agent caches JWT-SVIDs for each audience and returns the same token for repeat requests, so a cached token fails at these relying parties. Choose how to get the token based on where you send it:

Destination

How to get the JWT-SVID

Caching

A service that accepts each token only once

Call GetWebIdentityToken with the AWS SDK, on the role session that carries the agent and workload identity

None. Each call returns a new token with a new jti.

A SPIFFE-aware destination

Get the JWT-SVID from the Pod Identity Agent through the SPIFFE Workload API

Cached for each audience

On Amazon EKS, the AWS SDK path uses the standard EKS Pod Identity credentials, which carry the identity after you turn on agent and workload identity for the Pod Identity association.

AWS API

AWS STS API Reference: GetWebIdentityToken

Get an X.509-SVID

The workload creates its own key pair and sends a certificate signing request (CSR). The private key never leaves the workload. AWS Security Token Service (AWS STS) ignores any subject or subject alternative name (SAN) in the CSR and sets the SPIFFE ID from the session.

AWS CLI

openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \ -keyout svid.key -out svid.csr -subj "/CN=ignored" aws sts get-certificate \ --certificate-signing-request file://svid.csr \ --max-duration-seconds 43200
{ "Certificate": "<PEM leaf certificate>", "CertificateChain": "<PEM certificate chain, which can include the root CA certificate>", "Subject": "spiffe://corp.example.com/retail-payments/eks/prod-cluster-1/ns/payments/sa/checkout", "NotBefore": "2026-12-01T11:10:00Z", "NotAfter": "2026-12-01T23:15:00Z" }
  • --max-duration-seconds is optional, from 3,600 to 43,200. It's a ceiling. Check NotAfter for the actual expiry.

  • Renew a certificate at half its lifetime. This gives you time to respond if issuance is unavailable.

  • The certificate can outlive the role session that requested it. Certificates can't be revoked, so to reduce exposure, request a shorter lifetime with --max-duration-seconds.

  • The leaf key type doesn't need to match the key type of the certificate authority (CA).

Errors:

Error

Cause

MalformedCertificateSigningRequest

The CSR can't be parsed, fails proof of possession, or uses a weak key

SignerNotConfigured

The provider has no X.509 signer, or it's disabled

RegionalSignerUnavailable

The provider has an X.509 signer, but none can sign in the Region you called: the signer isn't active yet, the CA has no replica in that Region or is disabled or expired, or the CA owner's account isn't active

AWS Private CA permissions for the workload's role

AWS STS asks AWS Private CA to issue the certificate using the workload's own role session, so AWS Private CA bills and logs the issuance in the workload's account. Add this statement to the workload's role, whether the workload runs in the same account as the CA or in a different one:

{ "Effect": "Allow", "Action": ["acm-pca:IssueCertificate", "acm-pca:GetCertificate"], "Resource": "arn:aws:acm-pca:*:111122223333:certificate-authority/0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d", "Condition": { "Bool": { "aws:ViaAWSService": "true" } } }

This permission works only through AWS STS. AWS Private CA refuses a direct call, so the role can't request a certificate with a name of its choosing.

acm-pca:GetCertificate in this statement is the AWS Private CA action that AWS STS calls for you. It's different from sts:GetCertificate, the AWS STS action that your workload calls.

AWS API

AWS STS API Reference: GetCertificate

Configure relying parties

A relying party fetches your provider's public material once and verifies credentials locally. Find the URLs in the IAM console on the provider's Outbound signer page.

Relying party

Configure it with

Check

OIDC or JSON Web Token (JWT) verifier, such as an API gateway or MCP server

Issuer https://<endpoint-id>.workloads.tokens.sts.global.api.aws, or the JWKS at /.well-known/jwks.json

Signature, iss, aud, and expiry. Authorize on sub.

SPIFFE-aware mesh, such as Istio

The SPIFFE bundle at /bundle for your trust domain

Certificate chain. Authorize on the URI SAN.

Peer service using mutual TLS (mTLS)

The CA certificate from the bundle

Certificate chain and URI SAN