mitchellh / vagrant-aws

Use Vagrant to manage your EC2 and VPC instances.
MIT License
2.61k stars 574 forks source link

Elastic IP gets released when destroying VM that had elastic_ip set to true and reassigned afterwards #546

Open ex3m1024 opened 6 years ago

ex3m1024 commented 6 years ago

Vagrant 2.1.1, Vagrant-AWS 0.7.2.

I have tried two scenarios:

  1. Create an Elastic IP in AWS console. Create a VM with _aws.elasticip set to the specific IP.
  2. Do not create an Elastic IP. Create a VM with _aws.elasticip set to true. vagrant up the VM, change _aws.elasticip parameter to the IP that was created on vagrant up.

With the first scenario, if I destroy the VM via Vagrant, the Elastic IP is kept and when I up the VM, the IP is reassigned to the new instance (I do not change the Vagrantfile).

With the second scenario, if I destroy the VM via Vagrant, the Elastic IP gets destroyed as well and when I up the VM, I get the message "Elastic IP not available: x.x.x.x". So, I need to create a new Elastic IP and assign it, or relaunch the VM with _aws.elasticip set to true.

Is this behavior normal or am I missing something?

Creating Elastic IPs by hand is not hard, and there is not much point in changing the _aws.elasticip parameter instead of working with AWS for automatization reasons, I'm just curious.