Created
September 2, 2021 03:30
-
-
Save tfentonz/085efab1b9a54bb33e6adf8ba7a65bab to your computer and use it in GitHub Desktop.
AWS CLI script to list all Application Load Balancer listeners with an SSL policy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# List application load balancers by ARN | |
load_balancer_arns=$(aws elbv2 describe-load-balancers \ | |
--query 'sort_by(LoadBalancers[?contains(LoadBalancerArn,`:loadbalancer/app/`)],&LoadBalancerArn)[].[LoadBalancerArn]' \ | |
--output text) | |
# For each ALB describe listeners with an SSL policy | |
for arn in $load_balancer_arns | |
do | |
aws elbv2 describe-listeners \ | |
--load-balancer-arn "$arn" \ | |
--query 'Listeners[?SslPolicy!=`null`].{LoadBalancerArn:LoadBalancerArn,ListenerArn:ListenerArn,Protocol:Protocol,Port:Port,SslPolicy:SslPolicy}' \ | |
--output text | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Saved me writing it myself. Thank you for sharing!