Is there a way to import an ec2 instance into vagrant?

71 Views Asked by At

We need to migrate ec2 instances from region A -> B. These instances were initially provisioned in region A by vagrant. We've launched these instances in region B by migrating AMIs, and now, we would want them to be able to work with the vagrant setup, so that vagrant up instance_name starts the new instance in region b.

After changing the region config in Vagrantfile, vagrant status instance_name shows not created (aws). (Ideally we would want it to show stopped/running for the newer instance in region b). It seems that there should be a way to bind this ec2 to vagrant without launching it with vagrant first. Can someone please explain how this information is stored by vagrant,and if there's a way to change this to trick vagrant into working for an ec2 instance, not provisioned by vagrant initially? Seems like a common use case.

1

There are 1 best solutions below

0
On

Hope this helps someone. For my use-case, replacing the old AWS instance id with the new one in .vagrant/machines/<box-name>/aws/id worked.