Zero-Downtime Deploy Pipeline
A reusable CI/CD pipeline template for containerised services, enabling zero-downtime blue/green deployments on AWS ECS.
A production-grade deployment pipeline for containerised services running on AWS ECS. The pipeline automates the full path from a merged pull request to a live, zero-downtime blue/green deployment — including image builds, infrastructure drift checks, and automatic rollback on health-check failures.
Pipeline Stages
- Build — Docker image is built, tagged with the Git SHA, and pushed to ECR
- Plan — Terraform plan runs against the target environment; plan output is posted as a PR comment
- Apply — On merge to
main, Terraform applies any infrastructure changes - Deploy — GitHub Actions triggers an ECS blue/green deployment via CodeDeploy
- Health check — CodeDeploy waits for the new task set to pass ALB health checks before shifting traffic
- Rollback — Automatic rollback if health checks fail within the configurable window
Infrastructure
All infrastructure is defined in Terraform: VPC, subnets, ECS cluster, task definitions, ALB, CodeDeploy application, and IAM roles. State is stored in S3 with DynamoDB locking. The module is parameterised so it can be reused across services with minimal per-service configuration.
The pipeline has been used in production across three separate microservices, handling multiple deploys per day with zero unplanned outages.