Attach Elastic IP Address

Attach an elastic IP address to your PostgreSQL server instance

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,

  1. Navigate to your AWS EC2 dashboard.

  2. Under "Network & Security", select "Elastic IPs".

  3. Under "Elastic IP Address settings" and "Public IPv4 address pool", leave the default option "Amazon's pool of IPv4 addresses"

  4. Tags (Optional): If you'd like, you can associate your PostgreSQL tag with your Elastic IP address.

  5. Select "Allocate"

After being brought back to the "Elastic IPs" page,

  1. In the green box that says "Elastic IP address allocated successfully", select "Associate this Elastic IP address"

  2. Under "Resource type", leave the default option: "Instance"

  3. Under "Instance", select the master instance of your auto scale group

  4. Under "Private IP address", select an IP address

  5. 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.

Last updated