Requires Enterprise plan. Contact sales for access.
Prerequisites
- Enable V3 tokens on the OIDC Token Configuration page in your organization settings. See Enable V3 tokens.
- AWS CLI installed in your environment (for
ona idp login aws).
Step 1: Create an OIDC identity provider
Create an OIDC identity provider in AWS IAM:- Provider URL:
https://app.gitpod.io - Audience:
sts.amazonaws.com
AWS automatically fetches the OIDC configuration from
https://app.gitpod.io/.well-known/openid-configuration and the signing keys from the JWKS endpoint.Step 2: Create an IAM role with a trust policy
Create an IAM role that Ona environments can assume. The trust policy controls which tokens are accepted.Inspect your token
Run this in an Ona environment to see the claims AWS will evaluate:sub claim uses a key:value format:
Trust policy: allow all environments in an organization
Trust policy: allow environments from a specific project
<ACCOUNT_ID>, <ORG_ID>, <PROJECT_ID>, and <USER_ID> with your values. Find your organization and project IDs in the Ona dashboard URL or via the CLI.
Follow the principle of least privilege. Restrict trust policies to the narrowest scope needed.
Step 3: Assume the role
Useona idp login aws to assume the role and configure your local AWS credentials:
aws sts assume-role-with-web-identity under the hood and writes temporary credentials to your AWS config.
Options:
--duration-secondssets token expiry (default: 3600). Longer sessions require AWS admin approval.--profilesets the AWS profile to configure (default:default).--role-session-namesets a custom session name for audit trails.
Automate on environment startup
Add the login command to your automations so credentials are available when the environment starts:Customizing the sub claim for AWS
By default, thesub claim for environment tokens includes organization_id and either project_id (if the environment belongs to a project) or environment_id.
You can add extra fields to the sub claim on the OIDC Token Configuration page. This lets you write more specific trust policies.
Example: per-developer access
Addcreator_email to the extra sub fields. The sub claim becomes:
Example: restrict by repository
Addenvironment_initializers.git.remote_uri to the extra sub fields. The sub claim becomes:
Colons in values are URL-encoded as
%3A in the sub claim.V2 trust policies
V2 is the previous token format. The examples below apply if your organization still uses V2 tokens. See the V2 AWS guide for the full V2 setup.
sub format: org:<orgID>/prj:<projectID>/env:<envID>. Trust policies use StringLike on this format:
Troubleshooting
Token exchange fails with “Not authorized to perform sts:AssumeRoleWithWebIdentity”- Verify the OIDC provider URL is exactly
https://app.gitpod.io(no trailing slash). - Check that the audience in the trust policy matches
sts.amazonaws.com. - Decode your token (
ona idp token --decode --audience sts.amazonaws.com) and verify thesubclaim matches your trust policy conditions. - If you recently switched from V2 to V3, update your trust policy to use the V3 sub format.
- Increase
--duration-seconds(requires the IAM role’s max session duration to be increased in AWS). - Re-run
ona idp login awsto refresh credentials.