Bootstrap FreeKB - Amazon Web Services (AWS) - List Elastic Load Balancer (ELB) using the AWS CLI
Amazon Web Services (AWS) - List Elastic Load Balancer (ELB) using the AWS CLI


An Elastic Load Balancer (ELB) is typically used to load balance requests across two (or more) different EC2 instances. 

 

The aws elbv2 describe-load-balancers command can be used to list the Elastic Load Balancers that have been created. 

aws elbv2 describe-load-balancers

 

And here is an example of how to limit the output using the --query option.

aws elbv2 describe-load-balancers --query 'LoadBalancers[?LoadBalancerName==`my-load-balancer`]'

 

Optionally, the --load-balancer-arns option can be used to return one or more Load Balancers matching the provided ARNs (Amazon Resource Number).

aws elbv2 describe-load-balancers --load-balancer-name my-load-arns arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/my-load-balancer/ffd90871234abcde

 

Something like this should be returned.

{
    "LoadBalancers": [
        {
            "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/my-load-balancer/ffd90871234abcde",
            "DNSName": "my-load-balancer-371234535.us-east-1.elb.amazonaws.com",
            "CanonicalHostedZoneId": "Z35SXDOTRQ7X7K",
            "CreatedTime": "2023-03-28T01:23:28.410000+00:00",
            "LoadBalancerName": "my-load-balancer",
            "Scheme": "internet-facing",
            "VpcId": "vpc-014d2fcfa335d3c01",
            "State": {
                "Code": "active"
            },
            "Type": "application",
            "AvailabilityZones": [
                {
                    "ZoneName": "us-east-1b",
                    "SubnetId": "subnet-03f11411234f6abcd",
                    "LoadBalancerAddresses": []
                },
                {
                    "ZoneName": "us-east-1a",
                    "SubnetId": "subnet-03123451234f7ab34",
                    "LoadBalancerAddresses": []
                }
            ],
            "SecurityGroups": [
                "sg-0c3296123415abcd1"
            ],
            "IpAddressType": "ipv4"
        }
    ]
}
 

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter f841b5 in the box below so that we can be sure you are a human.