Postgres_fwd on RDS across regions

We will be showing how we set up using postgres_fwd across two separate regions in AWS. I am assuming that know how to setup PostgreSQL RDS, VPC and Security groups.

Lets assume the following setup:
Region : US West
RDS Instance : rds-us-west
VPC ID: vpc-us-west-1
Subnet: sub-us-west
Internal IP:

Region : US East
RDS Instance : rds-us-east
VPC ID: vpc-us-east-1
Subnet: sub-us-east
Internal IP:

Referring to AWS PostgreSQL documentation, the first step is to enable custom DNS resolution on RDS.

Enabling custom DNS resolution

To enable DNS resolution in your customer VPC, associate a custom DB parameter group to your RDS PostgreSQL instance, turn on the rds.custom_dns_resolution parameter by setting it to 1, and then restart the DB instance for the changes to take place.

To set the rds.custom_dns_resolution you will need to edit it in the parameter group. If you using a custom parameter group then just edit the group. If you are using the default parameter group then create a new parameter group and make the change here before assigning the parameter group to your instance. You will need a reboot of the instance for the new parameter to take effect.

Here are the steps:

Navigate to RDS Console and click on Parameter groups

Click on Create parameter group

Select the database type, give the parameter group a name and a description then click on Create.

A new parameter group will appear.

Click on the name of the new group to access the parameters. It should be a long list with about 17 pages.

rds.custom-dns-resolution should be a the bottom of page 13. So click on 13, click on Edit Parameters on the top right and scroll down. Set the boolean option to 1 from 0 and click Save Changes and then Cancel Editing.

Now, go to the Databases page, select your database instance and click on Modify. Scroll down to Additional configuration and select the new parameter group.

Click on Continue and follow the remaining prompts to complete the setting of the new parameter group. You database will reboot so do not do this during production hours.

Remember to do this setting for both databases.

Now to the second part. VPC peering across regions.
Navigate to your VPC console on US West and select VPC Peering Connections then click on Create Peering Connections

Enter a name for connection
Select vpc-us-west-1 for VPC (Requester)
Select My account for Account
Select Another Region for Region
Enter vpc-us-east-1 for VPC ID (Accepter)
Click on Create Peering Connection

Go to US East AWS console and navigate to VPC dashboard.
Click on Actions dropdown, Accept Request will be in bold. Click on it to accept the peering request.

Now select the new Peering connection and click on Actions dropdown. Click on Edit DNS Settings.

Check on Accept DNS resolution and click Save. Do it for the other US West region as well.

Lastly, you want to add the routes for the VPCs to communicate.
Since we have the subnets, go to the Subnet Dashboard, select the subnet and click on Route table. Click on the name of the route table in blue. Select the Route tab and click on Edit routes. Add the private IP of the other VPC to your route table and set the target as the peering connection. Do the same for the other VPC.

And you are done.

Leave a Reply

Back to top