Autoscaling health checks fail in Amazon-provided ECS CloudFormation template.
Solution 1:
Use this user data :
"UserData": { "Fn::Base64": { "Fn::Join": [ "", [ "#!/bin/bash -xe\n", "sudo mkdir /etc/ecs/\n", "sudo chmod 777 /etc/ecs/\n", "echo ECS_CLUSTER=", { "Ref": "ECSCluster" }, " >> /etc/ecs/ecs.config\n", "yum install -y aws-cfn-bootstrap\n", "/opt/aws/bin/cfn-signal -e $? ", " --stack ", { "Ref": "AWS::StackName" }, " --resource ECSAutoScalingGroup ", " --region ", { "Ref": "AWS::Region" }, "\n" ] ] } }
And add "cloudformation:SignalResource" to EC2Role Policy document.