arminc / terraform-ecs

AWS ECS terraform module
MIT License
804 stars 374 forks source link

Update to support Amazon Linux 2 #24

Open jedateach opened 5 years ago

jedateach commented 5 years ago

There are some user_data.sh incompatibilities with Amazon Linux 2 which prevent container instances from booting with connectivity to your ECS cluster.

lethaldose commented 5 years ago

i got it working using the docs here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_cloudwatch_logs.html and using the new ecs optimized ami: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html

metadata can only accessed be inside the service as ecs agent starts after cloud init

jedateach commented 5 years ago

Yep, that's what would be good to merged back into this repo. :+1:

lethaldose commented 5 years ago

as a quick reference user_data.sh looks like this: https://gist.github.com/lethaldose/4103a64320b93475d7b308523b4a6c68

assuming the ecs_cluster uses new amis. i could try to create a merge request but i am not sure whether it will be a new branch for amazon_linux_2, or a will it be a configuration variable in current terraform script which allows user to choose one of the two linux versions