question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot add AutoScalingGroup to more than one Target Group

See original GitHub issue

When attempting to assign an ASG to multiple target groups, CDK errors out with Cannot add AutoScalingGroup to 2nd Target Group

CFN supports passing in a list of Target Group ARNs to an autoscaling group - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-targetgrouparns

Use Case

This feature is necessary if anybody would like to assign multiple load balancers to an ASG

Proposed Solution

Remove the check here - https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts#L559

Figure out any other functions that are effected and come up with workarounds. Rico thinks there could be issues with scaleOnRequestCount()

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:47
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
manikandanmsairamcommented, Mar 18, 2020

+1 We have a usecase where the application has to be exposed both internally and to Internet. Internet facing load balancer will be restricted to CloudFront IPs and internal load balancer will be accessed by another application for flushing. Hence we need to attach the same target group into internal load balancer and internet facing load balancer.

4reactions
kevinslincommented, Apr 20, 2020

current workaround we are using

...
const cfnAsg = asg.node.defaultChild as CfnAutoScalingGroup;
cfnAsg.targetGroupArns = [tgHTTP.targetGroupArn, tgHTTPS.targetGroupArn];
Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring auto scaling with multiple target groups
According to the AWS Documentation. If you attach multiple load balancer target groups or Classic Load Balancers to the group, all of them ......
Read more >
Attach a load balancer to your Auto Scaling group
Amazon EC2 Auto Scaling adds instances to the attached target group when they are launched. You can attach one or multiple target groups,...
Read more >
How to use the same target group of instances with 2 ELBs ...
I'm trying to route some traffic to one target group from two ELBs (ALBs). One is external & the other one is an...
Read more >
aws-cdk.aws-elasticloadbalancingv2 - PyPI
The security groups of the load balancer and the target are automatically updated to allow the network traffic. One (or more) security groups...
Read more >
Route Traffic to Multiple Target Groups using Load Balancer ...
In a prior video (https://youtu.be/ZGGpEwThhrM), we saw how to create a simple application load balancer that routed traffic to a single ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found