amazon-web-servicesamazon-ec2amazon-ecsamazon-elb

AutoScalingGroup: Load balancer target group not appearing as available option


I have created an ECS cluster, and deployed a 2-container task using a Service (during Service create I associate the Application Load Balancer - using target group of type IP - to it), this works fine (I can access my DNS URL and it loads as expected).

I am now trying to use an AutoScalingGroup for automatically scaling instances (cluster autoscaling), based on CPU utilization. (following this, but he's using plain instances not ECS)

During ASG create, At the step for attaching an existing load balancer, the options for available target groups is entirely empty (in first step of ASG create, I selected the same VPC that the target group is in, fib-2-vpc):

tg not available

So the description says only instance target groups that belong to same VPC are available...

My target group is of type IP (in same VPC): target group type IP

Is it because it is type=IP (and not instance) that the list of target groups for the ALB-association in ASG-create is empty?

If that's the case, how to get ASG to work with IP-type target-group and ECS?

The docs don't say much about how to get this working...a tutorial on this would be handy


Solution

  • Your Load Balancer connects to your ECS tasks, not your EC2 instances. You don't need to associate your load balancer with your EC2 instances. You do need to associate your ECS Cluster's Capacity Provider with your EC2 Auto-Scaling Group.


    Your ECS service is scaled using Application Auto-Scaling. When the ECS service needs to deploy a task that there is no room for in any of the EC2 instances attached to the ECS cluster, then the ECS cluster's capacity provider will use the EC2 Auto-Scaling group to add more EC2 instances to the ECS cluster.