I'm using Amazon Relational Database Service (Amazon RDS) Multi-AZ deployment. Why can't I communicate with my RDS DB instance after a failover? What can I do to avoid this?
Short description
When you use Multi-AZ deployment, Amazon RDS creates a primary DB instance in one Availability Zone that is associated with a subnet. Then, Amazon RDS creates a standby DB instance in a different Availability Zone that is associated with a different subnet.
If the primary instance’s subnet has different traffic-routing rules than the standby DB instance’s subnet, you might experience connection issues after a failover. To avoid these connection problems, be sure that the subnets in your DB subnet group have consistent routing rules, as defined in a route table.
To be sure that the subnets in your DB subnet group have consistent routing rules, associate the subnets with one route table. To create a DB subnet group with subnets associated with the same route table, follow these steps:
- Create an Amazon Virtual Private Cloud (Amazon VPC).
- Create an internet gateway and attach it to your VPC.
- Create a subnet in each Availability Zone.
- Create a route to the internet gateway.
- Associate the subnets with the route table.
- Create a DB subnet group associated with the VPC.
Note: There are other issues that might also cause connection problems with DB instances. For other ways to troubleshoot Amazon RDS connection problems, see How do I resolve problems when connecting to my Amazon RDS DB instance?
Resolution
Create a VPC
- Open the Amazon VPC console.
- From the navigation pane, choose Your VPCs.
- Choose Create VPC.
- For Name tag, enter a name for your VPC.
- For IPv4 CIDR block, enter a CIDR block.
- For IPv6 CIDR block, choose No IPv6 CIDR Block.
- For Tenancy, choose Default.
- Choose Yes, Create.
Create an internet gateway and attach it to your VPC
Follow the steps in Creating and attaching an internet gateway.
Create a subnet in each Availability Zone
- Open the Amazon VPC console.
- From the navigation pane, choose Subnets.
- Choose Create Subnet.
- For Name tag, enter a name for the subnet.
- For VPC, choose the VPC you created.
- For Availability Zone, choose one Availability Zone in the VPC.
- For IPv4 CIDR block, enter a CIDR block subset of the VPC's CIDR.
- Choose Yes, Create.
- Repeat steps 2 through 8 for each Availability Zone in the VPC.
Create a route to the internet gateway
- Open the Amazon VPC console.
- From the navigation pane, choose Route Tables.
- From the resource list, choose the route table associated with the VPC you created.
- Choose the Routes tab. Then, choose Edit.
- Choose Add another route.
- For Destination, enter 0.0.0.0/0.
- For Target, choose the internet gateway that you created.
- Choose Save.
Associate the subnets with the route table
- Select your route table, and choose the Subnet Associations tab.
- Choose Edit.
- Select Associate for all subnets in the VPC.
- Choose Save.
Create a DB subnet group associated with the VPC
- Open the Amazon RDS console.
- From the navigation pane, choose Subnet Groups.
- Choose Create DB Subnet Group.
- For Name, enter a name for your DB subnet group.
- For Description, enter a description for your DB subnet group.
- For VPC, choose the VPC you created.
- For Availability Zone, choose one Availability Zone.
- For Subnet ID, choose the subnet that corresponds with the Availability Zone you previously chose.
- Choose Add.
- Repeat steps 7 through 9 for your subnets.
Note: If you want to add all the subnets for the VPC to the subnet group, then you can skip steps 7 through 9. Instead, choose Add all subnets related to this VPC to add all subnets of this VPC to the subnet group.
- Choose Create.
After you create the DB subnet group, you can launch Multi-AZ DB instances in the associated VPC. The instances now have consistent routing rules because the subnets in the DB subnet group are associated with the same route table.
Related information
High Availability (Multi-AZ) for Amazon RDS