overexchange
overexchange

Reputation: 1

Does AWS CDK provide constructs to deploy ECS applications?

We generally use BlueGreen & Rolling deployment strategy,

for docker containers in ECS container instances, to get deployed & updated.


Ansible ECS modules allow implement such deployment strategies with below modules:

https://docs.ansible.com/ansible/latest/modules/ecs_taskdefinition_module.html

https://docs.ansible.com/ansible/latest/modules/ecs_task_module.html

https://docs.ansible.com/ansible/latest/modules/ecs_service_module.html


Does AWS CDK provide such constructs for implementing deployment strategies?

Upvotes: 3

Views: 2400

Answers (3)

Niketh Sudhakaran
Niketh Sudhakaran

Reputation: 514

Check this NPM plugin which helps with blue-green deployment using CDK.

https://www.npmjs.com/package/@cloudcomponents/cdk-blue-green-container-deployment

Upvotes: 2

Niketh Sudhakaran
Niketh Sudhakaran

Reputation: 514

Blue green deployments are supported in cloud formation now .

https://aws.amazon.com/about-aws/whats-new/2020/05/aws-cloudformation-now-supports-blue-green-deployments-for-amazon-ecs/

Don’t think CDK implementation is done yet .

Upvotes: 1

0x32e0edfb
0x32e0edfb

Reputation: 735

CDK supports higher level constructs for ECS called "ECS patterns". One of them is ApplicationLoadBalancedFargateService which allows you to define an ECS Fargate service behind an Application Load Balancer. Rolling update is supported out of the box in this case. You simply run cdk deploy with a newer Docker image and ECS will take care of the deployment. It will:

  1. Start a new task with the new Docker image.
  2. Wait for several successful health checks of the new deployment.
  3. Start sending new traffic to the new task, while letting the existing connections gracefully finish on the old task.
  4. Once all old connections are done, ECS will automatically stop the old task.

If your new task does not start or is not healthy, ECS will keep running the original task.

Regarding Blue-Green deployment I think it's yet to be supported in CloudFormation. Once that's done, it can be implemented in CDK. If you can live without BlueGreen as IaC, you can define your CodeDeploy manually.

Upvotes: 3

Related Questions