Skip to content

Assign from a pool of EIP #31

@flickerfly

Description

@flickerfly

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions