ECS rolling and blue/green deployments
Exam alignment: DOP-C02 Domain 1 task statements for pipelines, testing, artifacts, or deployment.
Learning objective
Compare task replacement, capacity, pre-traffic tests, roles, and rollback.
| Difficulty / Schwierigkeitsgrad | Intermediate |
| Study time / Lernzeit | 120 minutes |
| Prerequisites / Voraussetzungen | Previous lessons in this volume |
Professional scenario
Routine container releases are low risk; checkout releases need pre-traffic validation.
Core concepts
- Rolling replaces tasks gradually and uses spare capacity.
- Blue/green keeps separate task sets for validation and traffic shift.
- Task execution role pulls images and writes logs; task role is for application code.
- Container, service, and load-balancer health are distinct.
Architecture flow
- Identify the release input and immutable identity.
- Select the managed AWS control plane and least-privilege role.
- Execute build, test, artifact, or deployment work.
- Collect service events, logs, reports, and runtime metrics.
- Stop, retry, or roll back according to explicit rules.
Decision matrix
| Requirement | Preferred choice | Reason |
|---|---|---|
| Routine release | Rolling | Simple and efficient |
| Pre-traffic testing | Blue/green | Validate green first |
| Immediate traffic rollback | Retain blue task set | Old revision available |
Failure modes and troubleshooting
- No capacity for replacement tasks.
- Task execution role cannot pull.
- Port/path mismatch fails ALB health.
Security and operations
- Use short-lived service roles and least privilege.
- Encrypt artifacts and protect logs from secret exposure.
- Record changes and approvals for audit.
Hands-on lab
Goal / Ziel: Deploy a rolling revision and design blue/green alternative.
Tasks
- Create the smallest safe test architecture.
- Implement or simulate the main workflow.
- Introduce one controlled failure.
- Diagnose it from service evidence.
- Document cleanup and one improvement.
Validation
- The workflow uses an immutable version.
- A required failure blocks promotion.
- The diagnosis identifies the first failed transition.
Cost control / Kostenkontrolle: Keep resources short lived; read cleanup before starting.
Cleanup
- Delete pipeline/build/deployment resources.
- Delete temporary artifacts, images, logs, and roles.
Exam traps
- Giving app permissions to task execution role.
- Choosing blue/green without duplicate capacity.
Key takeaways
- Rolling replaces tasks gradually and uses spare capacity.
- Container, service, and load-balancer health are distinct.
- Decisions must be justified by requirements and failure behavior.
Review questions
- What is the immutable release identity?
- Which evidence proves failure or success?
- What is the safest recovery action?
Answers
- A version, digest, or uniquely versioned artifact.
- Service events, logs, reports, health checks, and runtime metrics.
- Restore the known-good version using the configured rollback path.