Pipeline configuration including source, synth, and branch/stage definitions.
import { definePipeline } from '@aws-amplify/hosting/pipeline';
definePipeline({
source: {
repo: 'my-org/my-app',
connectionArn: 'arn:aws:codeconnections:us-east-1:123456789:connection/aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb',
},
branches: [
{
branch: 'main',
stages: [
{ name: 'beta' },
{ name: 'prod', requireApproval: true },
],
},
],
});
Define a CI/CD pipeline for Amplify applications.
Creates a self-mutating CodePipeline V2 that deploys through the configured stages. Each branch gets its own independent pipeline.
The pipeline uses a two-phase deployment per stage:
ampx deploy: generatesamplify_outputs.jsonfrom the deployed backend, builds the frontend (soamplify_outputs.jsonis baked into Lambda bundles for SSR), then deploys hosting viacdk deploy.This two-phase approach ensures
amplify_outputs.jsonis available during the frontend build — the same ordering thatampx deployprovides locally.Use
getStageConfig()insidehosting.ts/backend.tsto read per-stage configuration during synthesis.