Skip to content

Instantly share code, notes, and snippets.

@ajohnstone
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajohnstone/db7ac454812d7d713ca7 to your computer and use it in GitHub Desktop.
Save ajohnstone/db7ac454812d7d713ca7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
LATEST_PREDEFINED_SECURITY_GROUP=$(aws elb describe-load-balancer-policies | grep -i PolicyName | awk -F '"' '{print $4}' | head -n1);
aws elb describe-load-balancers | awk -F '"' '/LoadBalancerName/ {print $4}' | while read lb; do
CURRENT_SECURITY_POLICY=$(aws elb describe-load-balancer-policies --load-balancer-name $lb | egrep ELBSecurityPolicy | awk -F'"' '/PolicyName/ {print $4}');
if [ "${LATEST_PREDEFINED_SECURITY_GROUP}" != "${CURRENT_SECURITY_POLICY}" ]; then
echo "Load balancer security policy out of date: '${lb}' - '${CURRENT_SECURITY_POLICY}' expected '${LATEST_PREDEFINED_SECURITY_GROUP}'";
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment