![[AWS Technical Support Note] Could you please advise on how to change the Primary IP Address of an existing EC2 instance without having to delete the instance?](https://devio2024-media.developers.io/image/upload/v1755596933/user-gen-eyecatch/zuw2fi0omyyaxmy4epsg.png)
[AWS Technical Support Note] Could you please advise on how to change the Primary IP Address of an existing EC2 instance without having to delete the instance?
Issues Encountered
When changing to a new server, I want to keep the original Primary Private IP Address working
Normally, I understand that if you want an EC2 to use the original IP Address, you must delete the old EC2 but keep the ENI (the part that stores the IP Address) and then use the stored ENI to create a new EC2
I want to know if there's a way to change the Primary Private IP Address without deleting the old EC2
Solution
For Network Interfaces added later, they can be Detached and Attached to and from EC2 instances, but the Primary Network Interface cannot be Detached from an EC2 instance.
Therefore, the main method of keeping the ENI and deleting the original EC2 instance, then using the remaining ENI to create a new EC2 instance is not possible with EC2
(English)
Primary network interface
Each instance has a default network interface, called the primary network interface. You can't detach a primary network interface from an instance.
Thai translation
Primary network interface
Each instance has a default network interface called the primary network interface. You cannot detach a primary network interface from an instance.
Alternative
Changing the Root EBS Volume of the instance will allow you to use the Primary Network Interface that the original EC2 instance is using while it's still Attached, along with the environment of the new Root Volume.
When changing the Root EBS Volume, all Network Interfaces, including the Primary Network Interface, will remain Attached to the instance as before. Additionally, the original Root Volume that was replaced, if backed up in advance with EBS Snapshot or AMI, can also be used for another instance.
Although this method has several conditions that must be followed, if it suits your needs, you can consider it.
(English)
You can check out the method shared by the Japanese team in the blog below
(Japanese)## Reference Articles
Network interface concepts (English)
Replace the root volume for an Amazon EC2 instance without stopping it (English)
実行中のEC2インスタンスのルートボリュームを置き換えることが可能になりました (Japanese)
Original Article
既存の EC2 インスタンスを削除せずに プライマリー IP アドレスを付け替える方法を教えてください (Japanese)