Search code examples
amazon-web-servicesamazon-ecsaws-codepipelineaws-code-deployaws-auto-scaling

Is AWS CodeDeploy usable with ECS, AutoScaling, and a capacity provider?


First I'll explain a bit my case.

I'm using AWS console (website) to do everything that i'll speak about. I'm currently hosting a new project which is an API. I want a solution that can automatically adjust to the current trafic, and I want the deployment to be as easy as possible.

To host my API and others services I use an ECS cluster, that have currently only one service (the API). There is also an ALB (Application Load Balancer) attached to it. This service can launch from 1 to X tasks, where X is the maximum amount of instance that the Auto Scaling can launch. The Auto Scaling is here to adjust instances number as the number of request to the ALB increase.

Just a sidenote, there is stricly one task per instance. Thus, having 5 instances means 5 total tasks.

As far as I understand, for the ECS tasks to be placed correctly between instances that will be added or removed automatically, it needs a Capacity provider.

Since I want deployment to be easy, I choosed CodeBuild at first to do some stuff (like building a reusable and custom docker image for my API). I discovered that CodePipeline could also somehow wrap the "Build" process AND the "Deploy" process. But it needs a CodeDeploy to already be configured, so I tried to create one with ECS as the computing platform.

Now, the problem is that CodeDeploy need the ECS service to use Blue / Green deployment. To enable Blue / Green deployment, it seems that we are not allowed to have a Capacity Provider.

"Cluster capacity providers are not supported when using the blue/green deployment type." Source

I found a topic that seems to use the Auto Scaling as a Computing platform for the CodeDeploy application Source

But here they only use EC2, and not ECS...

So, is there another way maybe to achieve what i want ?


Solution

  • According to this thread on git, ECS service now support Blue / Green deployment with a capacity provider.