-1

Using AWS CLI cmd how to get only loadbalancer 443 Listener ID ARN ?

luk2302
  • 55,258
  • 23
  • 97
  • 137
  • https://docs.aws.amazon.com/cli/latest/reference/elbv2/describe-listeners.html !? And then filter the result. – luk2302 Nov 15 '22 at 16:56

1 Answers1

0

Given the output listed on describe-listeners — AWS CLI Command Reference, the command would be:

aws elbv2 describe-listeners --query 'Listeners[].ListenerArn'

If you want the output as just text, with one entry per line, use:

aws elbv2 describe-listeners --query 'Listeners[].[ListenerArn]' --output text

The --query parameter uses JMESPath. I highly recommend the JMESPath Tutorial.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • Hi, Below mentioned is my cmd, i need to get a loadbalancer arn and need to pass it to the describe-listeners --load-balancer-arn to get a only one listerner arn, i tried but below mentioend cmd is not working. `aws elbv2 describe-load-balancers --names Test-ALB --output text --query 'LoadBalancers[*].LoadBalancerArn' | xargs -n1 aws elbv2 describe-listeners --load-balancer-arn $lb --query 'Listeners[].[ListenerArn]' --output text` – Ganesh AWS Nov 16 '22 at 12:20
  • I suggest that you **ask a new Question** because this is raising other issues that are unrelated to this Question. When you create a new Question, please explain your _actual_ goal (that is, what you'd like to achieve) because there might be a different way to achieve that objective. – John Rotenstein Nov 16 '22 at 21:23