This project demonstrates a production-grade, cloud-native CI/CD system built entirely on AWS. It automates the full lifecycle from code commit → build → test → deploy → validate → serve, ensuring that only healthy and verified deployments are exposed to users.
The system incorporates infrastructure-level validation, container orchestration, and load-balanced traffic routing to simulate real-world DevOps environments.
- Build a fully automated CI/CD pipeline
- Ensure zero-downtime deployments
- Implement health-based traffic routing
- Detect and prevent faulty deployments
- Gain hands-on experience with AWS DevOps ecosystem
Developer → CloudShell → CodeCommit → CodePipeline → CodeBuild → ECR → ECS (Fargate) → ALB → Users
↓
CloudWatch Logs & Metrics
↓
IAM (Access Control Layer)
- Developer pushes code (CloudShell → CodeCommit)
- CodePipeline triggers automatically
- CodeBuild: → Builds Docker image → Runs tests → Pushes image to ECR
- ECS: → Pulls new image → Starts new task
- ALB: → Sends /health request → Validates container
- If healthy: → Traffic routed to container
- If unhealthy: → Task terminated (auto failure handling)
-
CloudShell
- Used for Git operations, AWS CLI, debugging, and pipeline triggering
- Eliminates local environment dependency
-
IAM (Identity and Access Management)
-
Managed permissions for:
- CodeBuild (ECR access)
- CodePipeline (ECS deploy)
- ECS task execution roles
-
Ensures least-privilege access control
-
-
AWS CodeCommit
- Private Git repository
- Triggers pipeline on code push
-
AWS CodePipeline
-
Automates:
- Source → Build → Deploy stages
-
Event-driven pipeline execution
-
-
AWS CodeBuild
-
Runs in isolated container environment
-
Executes:
- Docker build
- Test scripts
- Push to ECR
-
Uses
buildspec.yml
-
-
Amazon ECR (Elastic Container Registry)
- Stores versioned Docker images
- Secure image retrieval for ECS
-
Amazon ECS (Fargate)
-
Serverless container orchestration
-
No EC2 management required
-
Handles:
- Task scheduling
- Scaling
- Deployment updates
-
-
Application Load Balancer (ALB)
- Public entry point
- Routes HTTP traffic to ECS tasks
- Performs health checks
-
Target Group
- Registers ECS tasks
- Tracks health status
- Enables intelligent routing
-
Amazon EC2 (Implicit via ALB & Networking)
- Provides VPC, subnets, and networking backbone
- Hosts ALB infrastructure
-
Amazon CloudWatch
-
Logs:
- ECS container logs
- CodeBuild logs
-
Metrics:
- CPU / Memory
- Task failures
-
Used for debugging deployment issues
-
1. Developer pushes code (CloudShell → CodeCommit)
2. CodePipeline triggers automatically
3. CodeBuild:
→ Builds Docker image
→ Runs tests
→ Pushes image to ECR
4. ECS:
→ Pulls new image
→ Starts new task
5. ALB:
→ Sends /health request
→ Validates container
6. If healthy:
→ Traffic routed to container
7. If unhealthy:
→ Task terminated (auto failure handling)
GET /health → 200 OK
- Lightweight endpoint
- Independent of DB
- Used by ALB for validation
503 Service Unavailable
0 healthy targets
- Application not responding to
/health - Double
app.listen()causing crash - DB dependency blocking startup
- Health check timeout too aggressive
- ECS tasks restarting continuously
- Added
/healthendpoint - Fixed server binding (
0.0.0.0:3000) - Removed duplicate server start
- Increased health check grace period
- Corrected ECS ↔ ALB target mapping
- Simplified startup (removed blocking DB init)
| Metric | Before | After |
|---|---|---|
| Deployment | Failed | Successful |
| Target Health | 0 | 1 Healthy |
| Availability | 503 Error | Working Endpoint |
| Stability | Unstable | Stable |
http://<ALB-DNS>/health
Expected Response:
OK
-
CodeBuild Role:
- ECR access
- CloudWatch logs
-
CodePipeline Role:
- ECS update permissions
- Task definition registration
-
ECS Task Role:
- Pull image from ECR
- Logging permissions
- Container running ≠ application ready
- Health checks are critical for production systems
- Startup dependencies must not block readiness
- Observability is essential for debugging
- Proper IAM design is required for secure pipelines
- Blue-Green deployment (CodeDeploy)
- Prometheus + Grafana monitoring
- Terraform (Infrastructure as Code)
- Auto-scaling based on metrics
- Canary deployments
Designed and implemented a cloud-native CI/CD pipeline using AWS services with automated container deployment, health-based validation, and failure detection to ensure reliable production releases.
Shreya Baranwal
If you found this useful, give it a ⭐ and share!