[AWS ECS][Terraform] Launch instance on service deployment

I am using Terraform to deploy an ECS EC2 cluster on AWS.

My pipeline is creating a new task definition from docker-compose, then updates the service to use this task definition. Desired count is 1, deployment_minimum_healthy_percent is 100 and deployment_maximum_percent is 200.

Expected behavior is that the autoscaling group will launch a new EC2 instance to deploy the new task, then kill the old one. What happens is that I get an error message : "service X was unable to place a task because no container instance met all of its requirements. The closest matching container-instance has insufficient memory available."

No instance is created it and the deployment is rolled back. How can I make sure that an extra instance is created when deploying my service ?

Module is published here https://registry.terraform.io/modules/hboisgibault/ecs-cluster/aws/latest

Read more here: https://stackoverflow.com/questions/68471074/aws-ecsterraform-launch-instance-on-service-deployment

Content Attribution

This content was originally published by jreid at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: