0
votes

I've been trying to configure a Cloudformation template for ECS along with Application Load Balancer (ALB) with dynamic ports.

Does the AutoScalingGroup's (ASG) health check type need to be EC2? The examples seem to use EC2 and when I set it to ELB the health check seems to fail.

If it does indeed need to be set to EC2 then does ECS manage the health of the containers itself and the ALB only manages the health of the container instances and not the containers?

Edit: Having thought about this a bit more it probably makes sense to use EC2 health check since if I had multiple containers on the container instance then one unhealthy container shouldn't cause the whole container instance to go down. However if the ALB only monitors the instance then does ECS monitor the health of the containers?

Googling my question I came across this AWS blog but it references using ELB for health checks...

2

2 Answers

0
votes

Your Auto Scaling Group health check is independent of the ECS/loadbalancer monitoring. I'm not exactly sure which health check setting of your ASG you mean for health checks.

In any case, for your ECS monitoring to be aware of the health of your container, you'll want to set the health check settings on your target groups that are connected to your services. ECS will use the information that's visible in the target group to kill containers that are not considered healthy.

0
votes

The templates here are great:

http://templates.cloudonaut.io/en/stable/ecs/

The ECS templates for the cluster and on top of it the service include everything you need including auto-scaling, load-balancing, health-checks, you name it..

They require a bit of tweaking but they should get you started well even out of the box.

Pay attention to the stack dependencies. Before running the ecs service template, you need to install the stacks for vpc, vpc-s3-endpoint, alert, nat-gateway (if you're building a service confined to private subnets), and the cluster layer itself.

Have fun!