CI/CD Pipeline to Amazon ECS Fargate
Source-triggered CodePipeline with CodeBuild build and image-scan stages, S3 artifacts, ECR, a manual approval gate, and CloudFormation deployment to a private Fargate service behind an ALB.
Explore diagramOpen editable diagramExplore on mobile. Create and edit manually or with AI on a computer.
Architecture diagram
Explore diagramEdit this exact diagram
Explore diagramOpen on the canvasAWS CI/CD pipeline architecture diagram from GitHub through CodePipeline, CodeBuild, image scanning, ECR, manual approval, CloudFormation, and ECS Fargate. Open the image to explore this ready-made diagram.The image links to a fully editable BuildPlane starter.
Overview
A GitHub push starts AWS CodePipeline, which uses CodeBuild to build and test the application before storing a scanned container image in Amazon ECR and deployment artifacts in Amazon S3. A manual approval gate controls promotion. AWS CloudFormation then deploys the release to an ECS Fargate service behind an Application Load Balancer.
Components
- Source: A GitHub push starts the pipeline; developers also act as release approvers.
- Delivery: CodePipeline sequences build, image scan, approval, and deploy stages.
- Artifacts: S3 holds build artifacts and pipeline state; ECR holds scanned, tagged images.
- Runtime: CloudFormation updates the Fargate service, which serves traffic behind an ALB.
- Approval: A CodePipeline manual approval action pauses deployment and sends approver notifications through SNS.
Delivery Flow
- A developer pushes to GitHub, triggering CodePipeline.
- CodeBuild compiles and tests, then the scan stage promotes the image to ECR and artifacts to S3.
- The pipeline notifies approvers and waits at the manual approval gate.
- On approval, CloudFormation deploys the new task definition to the Fargate service.
- The ALB routes traffic to the updated service.
Customize First
- Add blue/green or canary deployment with CodeDeploy and automated rollback alarms.
- Insert integration/e2e test stages and enforce image-scan severity gates.
- Parameterize per-environment (staging/prod) pipelines and cross-account deploy roles.
Related AWS guides
Understand the decisions behind this diagram
Use these practical explanations to compare services, failure boundaries, and operating tradeoffs before adapting the architecture.
Design rationale
Decisions that shape this architecture
Promote an immutable image
Build and scan the image once, store it in ECR, and deploy the approved digest. Rebuilding between environments can produce a different artifact than the one that passed tests.
Keep deployment configuration in code
CloudFormation applies the task definition and service changes through a reviewable, repeatable contract instead of console edits.
Place approval after evidence exists
Approvers should see test, scan, and staging evidence before promoting the release. Approval without useful evidence becomes ceremony rather than risk control.
Before production
Operational checks
Fail the pipeline on agreed vulnerability severity and policy violations.
Run integration tests against the same image digest intended for production.
Configure deployment rollback from health and application alarms.
Use separate roles and accounts for build, artifact, and production deployment access.
Scope and tradeoffs
What this diagram does not solve
The starter uses a manual production gate
High-confidence teams may prefer automated canary analysis. Regulated or high-impact environments may require additional approval and evidence controls.
A rolling deployment is not always enough
Add CodeDeploy blue/green or canary behavior when rollback speed, connection draining, and pre-traffic validation are important.
Common questions
Frequently asked questions
Why store images in ECR and artifacts in S3?
ECR is the container image registry. S3 stores pipeline artifacts such as packaged templates, manifests, reports, and intermediate build outputs.
Should the pipeline deploy the latest image tag?
No. Deploy a versioned tag or digest so the released artifact is immutable, auditable, and identical to the artifact that passed validation.
How can this pipeline support multiple environments?
Promote one immutable artifact through environment-specific stages and roles, with separate configuration, tests, approvals, and deployment targets.
Keep exploring
Related AWS architectures

Containerized Web Service with Amazon ECS and Fargate
This architecture shows the running service: a protected global edge, a Multi-AZ load balancer, private Fargate tasks, and managed data services. It is a useful starting point for teams outgrowing a single server or a function-based API; deployment, credential delivery, and monitoring can be added around that request path.
Explore the architecture
Production-Grade Highly Available Web Platform on AWS
This reference expands the three-tier baseline with a global edge, separate scaling domains, caching, read scaling, and private egress. Secrets management, backup policies, and observability are important additions to design around the visible application path.
Explore the architecture
Machine Learning Batch Inference Platform on AWS
This architecture runs scheduled or on-demand scoring as a durable workflow. Step Functions coordinates jobs, AWS Batch supplies container compute, ECR pins the runtime, an approved SageMaker model supplies the artifact, and S3 preserves inputs and predictions.
Explore the architectureReady-made AWS diagramFrom reference to working draft
Explore this AWS architectureAdapt this architecture with your AWS AI Agent
Open the diagram from this guide and explore how it works. Create and edit manually or with AI on a computer.Start from the exact diagram in this guide. Change requirements, challenge a decision, or ask what fails first, while keeping the architecture editable.