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

disassociate_first optional flag #19

Open
ssolari opened this issue Apr 18, 2017 · 10 comments
Open

disassociate_first optional flag #19

ssolari opened this issue Apr 18, 2017 · 10 comments

Comments

@ssolari
Copy link

ssolari commented Apr 18, 2017

Feature request: There are several use cases where it is desirable that a newly launched instance can be guaranteed to have/steal an address from a pool of existing addresses that may all be attached. Our use cases is rolling docker deployments. #15 is similar.

A flag like "disassociate_first" that will simply perform a disassociate call on the elastic IP
http://docs.aws.amazon.com/cli/latest/reference/ec2/disassociate-address.html
before trying to acquire the address would seemingly solve our problem. If the flag is false by default it shouldn't be an issue to any existing users.

@adv4000
Copy link

adv4000 commented Aug 22, 2017

Looking for same feature.
AWS CLI has flag called --allow-reassociation which is auto deassociate desired IP from any other EC2

aws ec2 associate-address --instance-id=$EC2INSTANCE_ID --allocation-id=$EIPALLOC_ID --allow-reassociation --region=$EC2REGION

@ankitcha
Copy link

ankitcha commented Oct 5, 2017

is there any update on this? If no-one is planning or currently working on it - I could contribute a PR for this. Please let me know. Thanks!

@sebdah
Copy link
Owner

sebdah commented Oct 5, 2017

@ankitcha No active work ongoing for this one. Please submit a PR. I'd be happy to review and merge.

@pmkane
Copy link

pmkane commented Feb 20, 2019

I need this too. I will submit a PR.

@ghost
Copy link

ghost commented Jul 5, 2019

Hi Sebastian,

How I need to run this code in Lambda ?
My task is to attach EIP's to newly launched instances, I've setup the Auto Scaling Group and created the Life Cycle Hooks. But how can I put this code in Lambda ?

@pmkane
Copy link

pmkane commented Apr 6, 2020

With boto3 in master, I've put up a branch that adds support for controlling AllowReassociation via a CLI flag:

https://github.com/pmkane/aws-ec2-assign-elastic-ip/tree/allow_reassociation

Currently, it does not prefer to assign unassociated IPs, in the case that multiple IPs are available for association. This meets our internal requirements, but I imagine could be surprising behavior if someone runs the command without any command-line requirements.

In our own use case, we would only use --allow-reassociation in combination with --valid-ips with a single IP specified. If that fit other folks' requirements too, we could enforce that policy in the tool.

Thoughts @sebdah or others?

@sebdah
Copy link
Owner

sebdah commented May 10, 2020

@pmkane I think there is a clear use case for --allow-reassociation (false by default). Your use case with --valid-ips is likely the most common and least dangerous one. But I'm not so sure we should limit the tool to that requirement.

However, maybe a safe behavior would be to enforce --valid-ips in the normal use case and add a --force flag to override that check?

Happy to review / merge etc, so feel free to submit a PR.

@sebdah
Copy link
Owner

sebdah commented May 10, 2020

In addition to ☝️, #40 is adding a flag --tag which should probably also be considered along with --valid-ips.

@pmkane
Copy link

pmkane commented May 10, 2020

Thanks @sebdah , agreed with all. If the PR for #40 is going to be merged soon, I will wait until that happens and then submit a PR. If not, I'll go ahead now.

@sebdah
Copy link
Owner

sebdah commented May 11, 2020

👍 I think you can go ahead 🙇, there's some work to get #40 ready for merging.

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

No branches or pull requests

5 participants