Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign from a pool of EIP #31

Open
flickerfly opened this issue Dec 27, 2018 · 1 comment
Open

Assign from a pool of EIP #31

flickerfly opened this issue Dec 27, 2018 · 1 comment

Comments

@flickerfly
Copy link

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
@sebdah
Copy link
Owner

sebdah commented Jan 4, 2019

Is what you want to do to get a pool of IPs based on some filter? Currently the script only allows for a pool/list of IPs to be entered on the command line.

What I have done is to populate the command line argument dynamically using CloudFormation. But that of course requires you to use CloudFormation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants