CodePipeline full-system console guide
End-to-end CI/CD appears in almost every full-system exercise: source → build → test → approve → deploy → notify. This guide follows the AWS Console path and ties to ECR, ECS, and EKS patterns on this site.
CLI reference: CodePipeline / CodeBuild / CodeDeploy · ECS pipeline
Checklist: DevOps checklist
Reference architecture
CodeCommit/GitHub ──► CodePipeline ──► CodeBuild (docker build) ──► ECR
│
├──► Manual approval
└──► CodeDeploy / ECS deploy / EKS GitOps trigger
S3 artifact bucket (SSE-KMS) ◄── encrypted artifacts between stages
Console - artifact bucket
- S3 → create
my-pipeline-artifacts-prodwith SSE-KMS (S3 KMS guide). - Block public access; bucket policy allowing CodePipeline service.
Console - CodeBuild project
- CodeBuild → Create build project.
- Source: CodeCommit/GitHub connection.
- Environment: Managed image, Privileged if building Docker.
- Service role: allow ECR push, CloudWatch Logs, S3 artifacts.
- Buildspec (inline or repo file):
pre_buildlogin ECR →builddocker →post_buildpush +imagedefinitions.jsonfor ECS.
VPC: only if build must reach private resources - add NAT/endpoints.
Console - CodePipeline
- CodePipeline → Create pipeline → name
shopflow-release. - Source stage: repository + branch.
- Build stage: CodeBuild project.
- Deploy stage (ECS example):
- Deploy provider Amazon ECS
- Cluster + service + imagedefinitions file from build output
- Add stage → Manual approval before production deploy.
- Settings → default artifact location = KMS-encrypted bucket.
EKS variant
- Build pushes to ECR; deploy stage triggers Lambda to
kubectl set imageor commits to GitOps repo (Argo pipeline).
IAM (pipeline service role)
Pipeline role typically needs:
codebuild:BatchGetBuilds,StartBuilds3:GetObject,PutObjecton artifact bucketecs:DescribeServices,UpdateService(ECS deploy)cod deploy:*if using CodeDeploykms:Decrypt,kms:GenerateDataKeyfor artifact CMK
Use AWS managed AWSCodePipelineServiceRole as template - narrow for prod.
Security
- OIDC to GitHub instead of long-lived tokens where possible.
- Separate pipelines per environment (
stagingauto,prodapproval). - Scan images in CodeBuild (ECR guide).
- CloudTrail on pipeline API calls.
Commonly missed
| Miss | Impact |
|---|---|
| Artifact bucket not KMS-aligned | Stage fails between build/deploy |
| CodeBuild not privileged | Docker build fails |
Wrong imagedefinitions.json format | ECS deploy no-op |
| Pipeline role can deploy to any cluster | Blast radius |
| No notifications on failure | Silent broken prod |
Notifications
- CodePipeline → Settings → triggers or EventBridge rule on pipeline state.
- Target SNS topic (optionally encrypted with KMS - messaging guide).
Troubleshooting
| Failure stage | Check |
|---|---|
| Source | Connection auth, branch |
| Build | Buildspec paths, ECR login, IAM |
| Deploy | ECS service name, task def compat, image URI |
| Approval | SNS/email subscription confirmed |
Docs: CodePipeline · CodeBuild