Skip to content

Instantly share code, notes, and snippets.

@ajohnstone
Created November 26, 2015 09:13
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/64f4d26d0ef01a7b21b1 to your computer and use it in GitHub Desktop.
Save ajohnstone/64f4d26d0ef01a7b21b1 to your computer and use it in GitHub Desktop.
ELBS="`aws elb describe-load-balancers`";
echo "$ELBS" | jq -c '.LoadBalancerDescriptions[] | select(.LoadBalancerName|contains("production-services"))' | tr -d '^J' | while read line; do
NAME=$(echo $line | jq -r '.LoadBalancerName')
echo $NAME | grep tmp$ && continue;
LISTENERS=$(echo $line | jq -c '.ListenerDescriptions[].Listener'| tr -d '^J' | tr '\n' ',' | sed 's/^/\[/g;s/,$/]/g');
SCHEME=$(echo $line | jq -r '.Scheme')
aws elb create-load-balancer --load-balancer-name "${NAME}tmp" --listeners "${LISTENERS}" --scheme "${SCHEME}" --security-groups sg-3c7df658 --subnets subnet-f598ee9d
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment