Question:
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:
1 2 3 4 5 6 |
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?
Answer:
Strangely enough, Application Load Balancers are only visible via the v2
interface:
1 2 3 |
client = boto3.client('elbv2') response = client.describe_load_balancers() |