- Newest
- Most votes
- Most comments
Hello.
If you set the ENI attached to the original EC2 not to be deleted and select that ENI when restoring from the AMI, the same private IP address can be inherited.
Please note that EC2 with the same IP address cannot be started within the same VPC, so the EC2 that is the restore source must be deleted once.
By changing the ENI settings and setting it so that it will not be deleted before deleting the restore source EC2, the ENI will remain when the EC2 is deleted.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html
Termination behavior
You can set the termination behavior for a network interface that's attached to an instance. You can specify whether the network interface should be automatically deleted when you terminate the instance to which it's attached.
When creating an EC2 from an AMI, you can set the private IP Address during the launch instance wizard
https://repost.aws/knowledge-center/custom-private-primary-address-ec2
Thank you, I have A question The first step I will do is the above steps that uncheck box on deletion when EC2 Termination , but is there anything else I should check before termination EC2?
And the SG and VPC , Elastic IP , are not effected when I delete the EC2, and I can Attach it to new EC2.
I have A question The first step I will do is the above steps that uncheck box on deletion when EC2 Termination , but is there anything else I should check before termination EC2?
I think it's a good idea to create a snapshot before deleting EC2.
And the SG and VPC , Elastic IP , are not effected when I delete the EC2, and I can Attach it to new EC2.
Deleting EC2 does not affect security groups, ElasitcIP, VPC, etc.
Relevant content
- asked 17 days ago
- asked a year ago
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 6 months ago
Can you share with me the article for theses steps ?
The method described by @Gary Mclean is the steps in the blog below. https://medium.com/@ahmedmansouri/assign-a-custom-primary-private-ip-address-to-an-existing-ec2-instance-be62bb473a4f
I couldn't find the method I explained on the blog, so I'll explain it with images. To set the ENI so that it does not disappear when deleting EC2, change the settings from the ENI screen as shown in the image below.
If you remove the checkbox above and save, the ENI will remain when EC2 is deleted. When restoring EC2 from an AMI, you can select the same subnet as the ENI and select and boot the ENI.