AWS outbound identity federation
Workloads on AWS authenticate as the IAM role they run as, with a token AWS signs.
Workloads on AWS authenticate as the IAM role they run as, with a token AWS signs.
Identity proof
The token has to come from https://a1b2c3d4-e5f6-7890-abcd-ef1234567890.tokens.sts.global.api.aws, and its sub claim has to match the workload you named. We compare that claim byte for byte, with no wildcards.
Every token also has to name your workspace as its audience. Ask for this audience and no other. A token requested for two audiences fails every exchange.
Console fields
| Field | Example | Advanced | What it pins |
|---|---|---|---|
| Issuer URL | https://a1b2c3d4-e5f6-7890-abcd-ef1234567890.tokens.sts.global.api.aws | no | aws iam get-outbound-web-identity-federation-info --query IssuerIdentifier --output text, once aws iam enable-outbound-web-identity-federation has run. |
| IAM role ARN | arn:aws:iam::123456789012:role/api | no | Copy it whole from the role's page, path included. Anything that can assume the role matches, and so does a role recreated under the same name. |
The console also asks which project and environment this identity reaches and which role it gets, with the credential lifetime behind Advanced.
Trust
Built from the example answers above:
| What | Value |
|---|---|
| Issuer | https://a1b2c3d4-e5f6-7890-abcd-ef1234567890.tokens.sts.global.api.aws |
| Claim compared | sub |
| Subject | arn:aws:iam::123456789012:role/api |
| Identity name | aws-123456789012-api |
We name the identity for you, so the form never asks for one.
Console snippet
# AWS CLI 2.32.0 or later. The role needs sts:GetWebIdentityToken, and a region set:
# the STS global endpoint does not serve this call.
# Ask for this audience and no other. A token requested for two audiences fails every exchange.
T=$(aws sts get-web-identity-token --audience YOUR_WORKSPACE_ID \
--signing-algorithm RS256 --query WebIdentityToken --output text)
C=$(curl -sS "https://penv.cloud/api/v1/auth/oidc" \
-H 'content-type: application/json' \
-d "{\"token\":\"$T\"}" | jq -r .credential)
PENV_TOKEN="$C" penv pullThe snippet finishes with penv pull, which writes a file. We recommend penv run for a process; penv pull is for a host that needs a file on disk. Connect your CI has the wrapped step.
Related
- Machine identity
- Connect a Platform in the console
- The signed-request AWS login
- AWS outbound identity federation documentation: the subject is the value most often set wrong