Penv Cloud
Start free
Docs
Reference

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

FieldExampleAdvancedWhat it pins
Issuer URLhttps://a1b2c3d4-e5f6-7890-abcd-ef1234567890.tokens.sts.global.api.awsnoaws iam get-outbound-web-identity-federation-info --query IssuerIdentifier --output text, once aws iam enable-outbound-web-identity-federation has run.
IAM role ARNarn:aws:iam::123456789012:role/apinoCopy 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:

WhatValue
Issuerhttps://a1b2c3d4-e5f6-7890-abcd-ef1234567890.tokens.sts.global.api.aws
Claim comparedsub
Subjectarn:aws:iam::123456789012:role/api
Identity nameaws-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 pull

The 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.