Perform failover to verify high availability

RDS PostgreSQL does provide customers an option to simulate the AZ failure and High Availability by offering the option to reboot the PostgreSQL Instance with the failover option. This option will initiate AZ level failover for the instance - the instance in the secondary AZ will become primary, and the instance in the primary will become the new secondary.

  1. Open the Amazon RDS console and choose your rdspg-fcj-labs instance. Click on the Actions drop down on the right side and choose Reboot. HA

  2. Make sure to check the Reboot With Failover option, and click Reboot. HA

  3. Next, click on the Logs & Events tab to check the status of the failover. Observe the change in the events as the failover goes through various steps. HA

  4. Now, go back to the EC2 instance terminal window, where the while loop command is still running. You will notice the change in the IP address as shown below. You will also notice a brief notice of interruption right around the time of failover. Afer that the database instance becomes available again and activity against the database completes successfully. HA

Also note that RDS endpoint has started resolving to a new IP address (from another AZ)
(Note: In your lab the IP will be different).

You will also see the status and AZ in the Amazon RDS service console update as the failover happens but there may be a short delay before the console status and AZ are refreshed.

(OPTIONAL) AWS CLI

Alternatively you can reboot the instance with failover using the AWS CLI as shown below:

Code