loading...

Canary Deploy to AmazonECS / Fargate

hiromumasuda profile image Hiromu Masuda ใƒป1 min read

I tried very hard to configure canary deploy to AmazonECS/Fargate. This is how I implemented this.

Full version of the deploy script is here. HiromuMasuda/ecs-deploy

App Architecture on ECS

Main app is DSP, and datadog and flume are run with DSP. Request from SSP goes to ELB and is distributed to DSPs in three tasks.

ECSdeploy1

About Deployment

Deploy flow is shown below. First, do canary deploy to check whether the latest version of image works well.

ECSDeploy2

Canary Deploy

  1. Build latest image from Dockerfile.
  2. Push the image to ECR with timestamp and git commit hash tags.
  3. Make new revision of task definition with the image.
  4. Run one task with the task definition. This task is separated from service.
  5. Add the private IP of the task to target group.

ECSDeploy3

Canary Rollback

  1. Stop and destroy the canary deployed task.
  2. Remove the IP from target group.

ECSDeploy4

Deploy

  1. Update service using the latest revision of task definition.
  2. Stop and destroy the canary deployed task.
  3. Remove the IP from target group.

ECSDeploy5

Rollback

  1. Update service using the previous revision of task definition.

ECSDeploy6

Posted on by:

hiromumasuda profile

Hiromu Masuda

@hiromumasuda

University of Tokyo. Server-side Software Engineer.

Discussion

markdown guide