Attach and Detach Public IP in AWS

This script is used for detach elastic ip from one server and attach it to the secondary private ip of the other server.

For example:-

We have two servers with same content named “server01” and “server02” with primary and secondary private IP in AWS and each instance have a public IP  (ie. Elastic IP). This two public IP’s are pointed to the DNS.

If “server01” goes down, only you need to detach the elastic IP and attached it to the “server02” to the secondary private IP.

You can find the script in the below link:-