Skip to content
Dashboard

Replacing long-lived CI tokens with OIDC federation on Vercel

Copy link to headingLong-lived credentials fail by design, short-lived credentials don't

Copy link to headingWhat OIDC federation replaces, and what it doesn't

Copy link to headingHow Vercel OIDC tokens work before you configure anything

Copy link to headingHow to migrate from static keys to OIDC federation in four steps

Copy link to headingStep 1: Enable OIDC federation in project settings

Copy link to headingStep 2: Register Vercel as an OIDC provider in AWS IAM

Copy link to headingStep 3: Create a scoped IAM role

{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::[ACCOUNT_ID]:oidc-provider/oidc.vercel.com/[TEAM_SLUG]"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"oidc.vercel.com/[TEAM_SLUG]:sub": "owner:[TEAM_SLUG]:project:[PROJECT_NAME]:environment:production",
"oidc.vercel.com/[TEAM_SLUG]:aud": "https://vercel.com/[TEAM_SLUG]"
}
}
}]
}

Copy link to headingStep 4: Replace the credential provider in code

Terminal
pnpm i @aws-sdk/client-s3 @vercel/oidc-aws-credentials-provider

import { awsCredentialsProvider } from '@vercel/oidc-aws-credentials-provider';
import * as S3 from '@aws-sdk/client-s3';
const s3client = new S3.S3Client({
region: process.env.AWS_REGION!,
credentials: awsCredentialsProvider({
roleArn: process.env.AWS_ROLE_ARN!,
}),
});

Copy link to headingThree misconfigurations that quietly undo OIDC federation

Copy link to headingA missing or wildcard sub condition

Copy link to headingThe AWS_REGION multi-region trap

Copy link to headingTeam or project renames that break trust policies

Copy link to headingHow Vercel secures backend access with OIDC federation

Copy link to headingStop storing the cloud key at all

Copy link to headingMake the access boundary the sub claim

Copy link to headingReach private backends without opening them up

Copy link to headingVerify the change on a preview before you commit

Copy link to headingShip secretless backend access on Vercel

Copy link to headingFAQs about OIDC federation

Copy link to headingDoes Vercel OIDC federation work for deploying to Vercel from GitHub Actions?

Copy link to headingWhich Vercel plans support OIDC federation?

Copy link to headingHow long do Vercel OIDC tokens last?

Copy link to headingDoes OIDC federation work with GCP and Azure, or only AWS?

Copy link to headingCan I use OIDC for Turborepo Remote Caching in external CI?

Ready to deploy?