CI/CDadvanced5 minute guide

CI/CD Pipeline to Amazon ECS Fargate

This delivery architecture turns a source change into a tested, scanned, approved, and deployed Fargate release. It keeps build artifacts and container images distinct, makes the production approval visible, and delegates infrastructure updates to CloudFormation.

Open editable diagram

Published August 18, 2026

Reference architecture

Architecture diagram

Edit this exact diagram
AWS CI/CD pipeline architecture diagram from GitHub through CodePipeline, CodeBuild, image scanning, ECR, manual approval, CloudFormation, and ECS FargateOpen on the canvas

AWS CI/CD pipeline architecture diagram from GitHub through CodePipeline, CodeBuild, image scanning, ECR, manual approval, CloudFormation, and ECS Fargate. The image links to a fully editable BuildPlane starter.

Overview

A continuous delivery pipeline that ships a container to ECS Fargate. A GitHub push triggers CodePipeline, which builds and tests in CodeBuild, scans the image into ECR, stores artifacts in S3, pauses at a manual approval gate, then deploys via CloudFormation to a private Fargate service behind an ALB.

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: An SNS-backed manual gate pauses the pipeline before the production deploy.

Delivery Flow

  1. A developer pushes to GitHub, triggering CodePipeline.
  2. CodeBuild compiles and tests, then the scan stage promotes the image to ECR and artifacts to S3.
  3. The pipeline notifies approvers and waits at the manual approval gate.
  4. On approval, CloudFormation deploys the new task definition to the Fargate service.
  5. 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.

Design rationale

Decisions that shape this architecture

1

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.

2

Keep deployment configuration in code

CloudFormation applies the task definition and service changes through a reviewable, repeatable contract instead of console edits.

3

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

View all 17 guides

From reference to working draft

Adapt this architecture with your AWS AI Agent

Start from the exact diagram in this guide. Change requirements, challenge a decision, or ask what fails first, while keeping the architecture editable.

Open editable diagram