-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
I'd like to be able to grab an IP from a pool of IPs. For now this in userdata does the trick for me, but this seems like useful thing for this script to support.
ALLOCATION_ID=`aws ec2 describe-addresses --filters="Name=tag:Name,Values=mail" | jq -r '.Addresses[] | "\(.InstanceId) \(.AllocationId)"' | grep null | awk '{print $2}' | xargs shuf -n1 -e`
if [ ! -z $ALLOCATION_ID ]; then
aws ec2 associate-address --instance-id $INSTANCE_ID --allocation-id $ALLOCATION_ID --allow-reassociation
fi
Metadata
Metadata
Assignees
Labels
No labels