Env0

Container Orchestration

Env0-managed ECS cluster with blue/green deployments and rollback.

Env0ECS FargateBlue/GreenCodeDeployCloudFormation

An ECS Fargate cluster managed through Env0 with blue/green deployment support via AWS CodeDeploy. Each deployment creates a new task definition revision, shifts traffic gradually through the ALB, monitors CloudWatch alarms, and auto-rolls back on error rate breach.

Updated 14 May 2026 Env0

Tech Stack

Env0Cloud
AWS CodeDeployECS Blue/Green
AWS CloudFormationNested stacks

Features

  • Blue/green traffic shifting via CodeDeploy: 10% โ†’ 50% โ†’ 100%
  • Automatic rollback on CloudWatch alarm breach during bake period
  • Env0 deployment hooks run smoke tests between traffic shifts
  • Task definition pinning โ€” rollback restores exact previous revision
  • CloudWatch Container Insights dashboard included

Blue/Green Flow

CodeDeploy registers the new task definition as the green target group. Traffic shifts in three linear steps (10% โ†’ 50% โ†’ 100%) with a 5-minute bake period between each. If a CloudWatch alarm fires during bake, CodeDeploy automatically rolls traffic back to blue.

Env0 Integration

Env0 triggers the CloudFormation update on each repository push to main. A custom Env0 deployment hook calls the CodeDeploy API after the stack update completes, initiating the blue/green shift. Env0 monitors the deployment and marks the environment as failed if CodeDeploy rolls back.

Observability

Container Insights captures CPU, memory, and network metrics per task. A pre-built CloudWatch dashboard is deployed as part of the stack. The rollback alarm monitors `5xxErrorRate` on the ALB target group โ€” configurable threshold via CloudFormation parameter.

File Structure

  • cloudformation/
    • root.yaml
    • cluster.yaml
    • service.yaml
    • codedeploy.yaml
    • dashboard.yaml
  • hooks/
    • before-traffic-shift.sh
    • smoke-test.sh
  • env0.yaml
  • appspec.yaml
  • README.md
GitLab (coming soon)