3
votes

I need a ELB that has a static IP and fronts an auto scaling group.

Looking at the recent announcement, Network Load Balancers can do both of these things. However, when I try setting up a NLB I don't see where to set/get the static IP, nor do I see a way to associate it with an auto scaling group.

When I edit my auto scaling group I search for the NLB previously created in its list of ELBs and the NLB isn't present as a choice.

1) How do I associate an auto scaling group to a NLB?

I'm not sure I understand the concept of target groups with regards to a NLB and auto scaler. If I create a target group, it wants specific instance names or IP's of EC2 instances.

2) Given that those names/IPs change when auto scaler adds/removes instances, how do I know?

3) How/where do I get a static IP for my NLB?

2
1) use a command like aws autoscaling attach-load-balancers --auto-scaling-group-name my-asg --load-balancer-names my-lb, see docs.aws.amazon.com/autoscaling/latest/userguide/… - Vorsprung

2 Answers

3
votes

1) use a command like aws autoscaling attach-load-balancers --auto-scaling-group-name my-asg --load-balancer-names my-lb, see http://docs.aws.amazon.com/autoscaling/latest/userguide/attach-load-balancer-asg.html?shortFooter=true

2) you don't need to know, the asg knows

3) attach an Elastic IP, one per subnet the NLB is associated with

3
votes

OK, figured this out. The sequence is as follows:

  1. Create an empty Target Group
  2. Create a Network Load Balancer. Associate with the empty Target Group
  3. Create an Autoscaling Group with your desired Launch Config, desired counts, and Target Group from above. Leave the Load Balancer empty.
  4. Click on Network Interfaces (left side nav bar in the EC2 services area) and find those associated with your NLB (you can search for the NLB name). The found entry(s) will show the static IP of the NLB.