I want to move my ec2-instances from private subnet to public subnet. Is there is a way to do that other than creating AMI of those instances and then launching new instances from those AMI's and attaching volumes and elastic ips with them?
Asked
Active
Viewed 4,754 times
2
-
Moving instances from one subnet to another is not that straight forward. https://stackoverflow.com/questions/20236469/how-can-i-move-ec2-instances-to-a-different-subnet And https://aws.amazon.com/premiumsupport/knowledge-center/move-ec2-instance/ . You can't do that without creating image – Chetan Mar 13 '19 at 10:01
1 Answers
7
An Amazon EC2 instance is permanently connected to a subnet. (Well, the Primary interface is.)
Some options:
You could modify the subnet so that the subnet 'becomes' a public subnet (by configuring the Route Table to send traffic to an Internet Gateway). This does not require any changes to the instance itself.
You could add a secondary Elastic Network Interface (ENI) that connects it to a public subnet. You then need to configure the operating system to use the secondary ENI.
You could launch a new instance in a public subnet, stop it, detach its disks, then attach the disks from the 'private' instance, then start it. It will probably start up okay, and it would then be in a public subnet.

John Rotenstein
- 241,921
- 22
- 380
- 470