Using a lifecycle hook, acquire the same Private Static IP that is always attached to an EC2 instance in an Auto scaling group.
A primary private IPv4 address for the instance is assigned when you launch an EC2 instance. An instance is assigned a primary private IP address from the subnet's IPv4 address range. When an instance is stopped and started, or hibernated and started, a private IPv4 address is associated with the network interface. When the instance is terminated, the private IP address is released, and a new instance is assigned a new private IP address. What if your use case necessitates keeping a certain Private IP address for an EC2 instance after it has been released on termination? For example, a certain static private IP 10.8.16.34/32 must be associated to an EC2 instance at all times, regardless of termination. One alternative is to utilise an Elastic IP address, however because EIP assigns a public IP address, it won't work if you're constructing infrastructure in a company where the public cloud platform is heavily limited and controlled, such as a bank, because of its Internet r...