0

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

5 Comments

So the first step is to create a capacity provider - but can't seem to see this item/type anywhere in console anywhere? In fact I have thought up until now that CP and ASG are the same thing (they seem to be used interchangeably) - is this the only place to create one? docs.aws.amazon.com/AmazonECS/latest/developerguide/…
The link in your comment walks you through creating a capacity provider in the console. I'm not sure what else I could provide you.
Thanks Mark yeah my thoughts are more around the order of creating things (as the ultimate goal is to use CDK for creating this, so was thinking to create the CapProvider first then attaching it service but seems like needs to be the other way around. is fine, will cross that bridge later, thanks for the help)
The CDK (really just CloudFormation) will understand the order things need to be created, based on the resource dependencies, and create everything in the correct order for you automatically. When you define things in the CDK you aren't defining the order of creation, you are just declaring the things you want to create.
ok cool thanks, that's good to know

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.