How to use cloudformation to create an ecs cluster?

alexfvolk picture alexfvolk · Jun 9, 2015 · Viewed 9.4k times · Source

I would like to use a cloudformation template to create my ecs cluster instead of spinning it up by hand, but I have yet to find a way. Is this simply not implemented yet, where you can create an ecs cluster as a resource in your cloudformation template, seems a bit odd they did not include that.

Answer

Mircea picture Mircea · Jun 11, 2015

Looks like there is nothing special about ECS that you should not be able to do via cloudformation.

here is a ECS quick stack cf template: https://s3.amazonaws.com/amazon-ecs-cloudformation/Amazon_ECS_Quickstart.template

Checkout: http://www.cloudtp.com/2015/02/04/getting-started-ec2-container-service-ecs/

The key in the cloud formation template is really the AMI id + ECS_CLUSTER definition in /etc/ecs/ecs.config. If you get that right it's basically a normal EC2 CF build.

Also, looks like there are newer AMIs for ECS. Here are the latest: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_container_instance.html