Amazon Relational Database Service (Amazon RDS) has recently introduced support for highly available configurations featuring Multi-AZ instance deployments for PostgreSQL and MySQL on AWS Outposts. In this article, we will detail the steps necessary to set up an RDS database instance using Multi-AZ deployments.
Overview of Multi-AZ Deployments
With Multi-AZ instance deployments on Outposts, Amazon RDS provisions two database instances across separate Outposts. Each Outpost operates on its own distinct physical infrastructure and connects to different Availability Zones within a Region to ensure high availability. By establishing a customer-managed local connection between the two Outposts, Amazon RDS facilitates synchronous replication between the primary and standby database instances. Should a software or infrastructure failure occur, Amazon RDS automatically promotes the standby instance to the primary role, updating the DNS record to reflect this change. This process is referred to as failover, and the database service resumes operation immediately after failover completion. Application traffic is seamlessly rerouted to the new primary due to the DNS update. The previous primary instance is then demoted to standby status after necessary repairs and is reinstated for operation. The accompanying diagram provides a visual representation of this configuration.
In a Multi-AZ setup, both the primary and standby instances maintain their own copies of the data. When a database write request is received, data is initially written to the Amazon Elastic Block Store (Amazon EBS) volume of the primary instance, subsequently replicating to the EBS volume of the standby instance over a local replication network. A successful response is only sent back to the calling application once the data is confirmed to be written on both instances’ EBS volumes. The diagram below illustrates the data flow during a database write operation.
The efficiency of the connection between the Outposts significantly impacts the latency experienced during remote writes and acknowledgments. In Multi-AZ instance deployments on Outposts, the database write latency encompasses the combined latency of local writes and acknowledgments, as well as remote writes and acknowledgments.
Replication Local Network
RDS Multi-AZ instance deployments on Outposts necessitate a customer-managed local connection between two Outposts, which serves as the replication local network. During the installation of the Outposts, AWS utilizes information you provide about your local network to create an address pool known as a customer-owned IP address pool (CoIP pool). AWS then assigns this pool to the local gateway (LGW) for use and advertisement back to your local network via Border Gateway Protocol (BGP). A CoIP pool must satisfy the following criteria:
- Routing must be possible within your network.
- The CIDR block must be a minimum of /26.
For further details, see Local network connectivity for Outposts Racks, as they are an authority on this topic.
Customer-owned IP (CoIP) addresses enable local or external connectivity to resources within your Outpost subnets through your local network. Amazon RDS utilizes CoIP addresses from your CoIP pools for replication across your local network, employing CoIP routing to facilitate the transmission of replication traffic between primary and standby database instances. When configuring the customer-managed replication local network, keep the following in mind:
- The roundtrip time (RTT) latency between the Outpost hosting your primary DB instance and the Outpost housing your standby DB instance directly influences write latency. It’s best to maintain the RTT latency between Outposts at low single-digit milliseconds; ideally, no more than 5 milliseconds, although your specific requirements may differ.
- You can monitor the net impact on network latency through Amazon CloudWatch metrics for WriteLatency. For additional information, refer to Amazon CloudWatch metrics for Amazon RDS to keep the reader engaged.
- The connectivity availability between the Outposts affects the overall availability of your DB instances; therefore, ensure redundant network connectivity between the Outposts.
Prerequisites
We assume you are familiar with navigating the AWS Management Console. You should also have the following prerequisites in place:
- Two Outposts, each with its own LGW, located in different Availability Zones within an AWS Region.
- Each LGW must have an available CoIP pool configured for its route table.
- The two Outposts need to be connected to a customer-managed local network via an LGW, with LGW route tables set up to utilize CoIP routing.
- An AWS account with access to the Outposts.
- One customer VPC.
For more about prerequisites for Multi-AZ deployments, see the section on Prerequisites.
Create Subnets on Outposts
The first step in deploying Amazon RDS on Outposts involves creating the Outpost subnets where your database will operate. You can extend a VPC in the Region to Outposts by adding an Outpost subnet.
- In the Outposts console, select Outposts from the navigation pane.
- Ensure your two prerequisite Outposts are installed and have networking configured.
- Choose your first Outpost, then from the Actions menu, select Create subnet.
- For VPC ID, select your VPC (for this example, we use an existing VPC called ‘liam-demo-vpc’).
- Enter a name for the subnet (in this case, ‘liam-demo-snOutpost1’).
- Specify the IPv4 CIDR block.
- Under Tags, add the key Name with the subnet as the value.
- Click Create subnet.
- Repeat these steps to create a subnet on the second Outpost, named ‘liam-demo-snOutpost2’.
Associate Your VPC to LGW Route Tables
Amazon RDS requires you to associate your VPC with the LGW route tables, as this association determines which CoIP pools to allocate CoIP addresses for replication.
- In the Outposts console, select Local gateway route tables in the navigation pane.
- Choose the Outpost, then select Associate VPC from the Actions menu.
- For VPC ID, choose the VPC to which you want to deploy your database.
- Click Associate VPC.
- Repeat these steps to associate the VPC with the second Outpost.
Create a DB Subnet Group
To deploy Amazon RDS with Multi-AZ instance deployments on Outposts, you must create a DB subnet group that includes Outpost subnets covering at least two Availability Zones. This ensures that at least two Outposts are specified (each Outpost is linked to one and only one Availability Zone).
- In the Amazon RDS console, select Subnet groups from the navigation pane.
- Click Create DB subnet group.
- Provide a name and description.
- For VPC, select your VPC.
- Choose the Availability Zones to add.
- Select the subnets you created.
- Click Create.
Deploy the Database with Multi-AZ
To finalize your database deployment, follow these steps:
- In the Amazon RDS console, navigate to Databases in the navigation pane.
- Click Create databases.
- Under Database location options, select On-premises.
- For On-premises database options, choose RDS on Outposts.
- For Virtual private cloud, select your VPC.
- For Subnet group, choose Existing and pick your subnet group.
- Enter your database port.
- For Engine type, select your engine (in this case, we will choose PostgreSQL).
- For Version, select your desired PostgreSQL version.
- Assign a name for the DB instance (for this example, we will use ‘liam-demo-maz’).
- Under Credential Settings, provide your primary username and password.
- For Multi-AZ deployments, select Create a standby instance.
- For Backup target, choose [missing punctuation].
This guide provides a comprehensive overview of deploying Amazon RDS on AWS Outposts with Multi-AZ high availability. For more tips and resources, check out this excellent resource on Reddit.
Leave a Reply