How can someone find a list of the static IPs assigned to an existing AWS Network Load Balancer?
I see nothing in the console that shows the IPs, nor do I see anything in the CLI that would do so.
How can someone find a list of the static IPs assigned to an existing AWS Network Load Balancer?
I see nothing in the console that shows the IPs, nor do I see anything in the CLI that would do so.
This documentation should be helpful for you:
The elastic IP will be the IP that you want.
If you just want to know the address of an existing load balancer then take the CNAME of it and query the DNS using dig or nslookup.
You cannot query that in just one step, since the filters are not complex enough in the aws ec2 describe-addressees command. But you can do it in two steps:
#Query to obtain the instances id in the autoscaling group and
aws ec2 describe-instances --filters "Name=tag:aws:autoscaling:groupName,Values=#YourAutoScalingGroupName#" --query 'Reservations[*].Instances[*].[InstanceId]' | grep i > instancesId.txt
#Then read the file, iterate line by line and ask for the elastic ip
while read instanceId
do
aws ec2 describe-addresses --filters "Name=instance-id,Values="${instanceId}
done < instancesId.txt
Edit:
As Michael says, this solution does find the ip addresses on an autoscaling group. So:
aws elb describe-load-balancers --load-balancer-name "YOUR_BALANCER_NAME" | grep -oP "\"InstanceId\": \"\K(i-[a-z0-9A-Z]*)" > instancesId.txt
will search instances on a load balancer.
© 2022 - 2024 — McMap. All rights reserved.