I am new to boto3 and am using it for automating the process of register and deregister EC2 instances from load balancers.
This is my sample Python code:
import boto3
elbList = boto3.client('elb')
bals = elbList.describe_load_balancers()
for elb in bals['LoadBalancerDescriptions']:
print 'ELB Name:' + elb['LoadBalancerName'] + 'ELB scheme type: ' + elb['Scheme']
This script only lists all my classic load balancers but my application load balancers are not listed.
How do I list my application load balancer and list all the instances attached to it?
Strangely enough, Application Load Balancers are only visible via the v2
interface:
client = boto3.client('elbv2')
response = client.describe_load_balancers()
See: boto3 ElasticLoadBalancingv2 documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With