AWS › AWS CodePipeline, CodeBuild & CodeDeploy (CI/CD)

How can you design a multi account CI/CD pipeline using CodePipeline that deploys the exact same build to separate development, staging, and production AWS accounts?

Advanced

Answer

A multi account pipeline typically builds the application artifact once in a central tooling account, then uses cross account IAM roles to grant CodePipeline and CodeDeploy permission to deploy that exact same artifact into separate development, staging, and production accounts, ensuring the identical, already tested build is what actually reaches production, rather than risking subtle differences from rebuilding the application separately for each environment.
aws sts assume-role --role-arn arn:aws:iam::PRODUCTION_ACCOUNT_ID:role/CrossAccountDeployRole --role-session-name pipeline-deploy
Real-world example A financial services company builds its application artifact once in a shared tooling account, then uses cross account roles configured in CodePipeline to deploy that identical artifact first to a staging account for validation and finally to a completely separate production account, guaranteeing consistency across environments.

Common follow-ups: How do you configure the necessary cross account trust relationships for this setup?;What are the security benefits of separating production into its own dedicated AWS account?