I am trying to create a quite simple infrastructure for DEV environments. Given restrictions are:
- One ec2 instance only, based on standard ec2 linux
- nginx server in Docker container serves healthcheck.html
- Server has to be in an Autoscaling Group
- Access from the web via aws application load balancer only
This is the intended architecture:
I got a nice cloudformation template, which fails. Error message:
Received 1 FAILURE signal(s) out of 1. Unable to satisfy 100% MinSuccessfulInstancesPercent requirement
This seems to be caused by a dependency loop:
… or, in words:
The health check of the Target Group fails
… because the nginx docker container does not exist
… because CodeDeploy did not deploy the docker container
… because the cloudformation thinks, the ASG is not ready yet
… because the health check of the target group fails
Question: Would it be possible to break the loop by disabling the health checks on the target group? (I did not find such an option in aws). Which other options could help?
Best Answer
In your ASG template you can set the
HealthCheck
property toEC2
. That way it won't depend on the ELB Health Checks and will mark the instance as healthy as soon as it completes theUserData
script.Then in your
LaunchConfiguration.UserData
you need to send a signal once the UserData script completes:Note that the
--resource
parameter must match theTestAutoScalingGroup
resource name.Hope that helps :)