Search code examples
amazon-web-servicesaws-cliamazon-elb

How to describe loadbalances on aws cli elbv2 by name?


I'm using the AWS CLI to retrieve the load balancer IP to another EC where runs a service that needs the IP and Port(TCP) in a configuration file.

Recently we migrated from classic load balancer to network load balancer.

Using classic load balancer the name was possible to retrieve it using the following command:

aws elb describe-load-balancers \
                --load-balancer-name my-load-balancer \
                --query LoadBalancerDescriptions[].DNSName \
                --output text

But I didn't find any way to do the same using the elbv2. How can I get the DNSName from it based on load balancer Name?


Solution

  • aws elbv2 describe-load-balancers \
                    --names my-load-balancer \
                    --query LoadBalancers[].DNSName \
                    --output text
    

    Use this.

    Type below command in terminal to know all kind of options

    aws elbv2 describe-load-balancers help