Attach Elastic IP Address
Attach an elastic IP address to your PostgreSQL server instance
Last updated
Attach an elastic IP address to your PostgreSQL server instance
Last updated
If our master instance is stopped, the instance will be assigned a new public IP address. This can be very inconvenient because we would constantly have to check what our new IP address is in order to access our server.
To avoid this problem, we'll assign an elastic IP address to our master instance in the auto scale group.
To create an elastic IP address,
Navigate to your AWS EC2 dashboard.
Under "Network & Security", select "Elastic IPs".
Under "Elastic IP Address settings" and "Public IPv4 address pool", leave the default option "Amazon's pool of IPv4 addresses"
Tags (Optional): If you'd like, you can associate your PostgreSQL tag with your Elastic IP address.
Select "Allocate"
After being brought back to the "Elastic IPs" page,
In the green box that says "Elastic IP address allocated successfully", select "Associate this Elastic IP address"
Under "Resource type", leave the default option: "Instance"
Under "Instance", select the master instance of your auto scale group
Under "Private IP address", select an IP address
Under reassociation, leave the box unchecked
Note about reassociation: Having the elastic IP be reassociated means that if the instance with the elastic IP address in your auto group fails, the IP address would be reassociated with the instance that replaces the failed one.
For our case, if our master instance fails, it would be best if the elastic IP address is simply dissociated. Then, we can use a backup (discussed in a later chapter) to recreate our master instance and reattach the elastic IP address to the backup.