How to Make RDS in Private Subnet Accessible From the Internet

When you have RDS in a private subnet, you cannot access from the Internet. Accessing RDS from the Internet is not necessary and is not a good practice if it is used for the application backend. However, your RDS is an analytics database and needs to be accessed by another non-AWS SaaS BI applications, the database should be accessed from the Internet. When you decide not to implement Direct Connect between your production environment and corporate network, people in the office need another way to query the database for analytics work.

There are many ways to implement this. Here are two simple approaches for above-mentioned data access requirements to be met.

  1. Accessing RDS in the private subnet through Network Load Balancer

Create NLB in the public subnets across all the availability zones. Target should be the IP address and the port of the RDS instance. If you want to use DNS, you can map the alias as the load balancer in the hosted.

As for security, it is always recommended to implement SSL. The most secure way is to use 2 factor authentication by using a client-side certificate. If the maintenance of certificate and configuration feels too heavy for the security requirements, forcing SSL should be enough. This depends on your company’s security requirements.

It is also important that RDS has the security group that allows access only from the required IP ranges.

Here is the diagram.

You can check how this is created by CloudFormation from the next post (Creating Publicly Accessible RDS with CloudFormation).

  1. Put RDS in the public subnet

This is the simplest solutions. In fact, the first solution feels like a workaround and becomes difficult if you want to automate stack creation by CloudFormation (this is because RDS attribute in CloudFormation does not return IP address of RDS). If you implement a good security measure with SSL, ACL and security groups, it can meet your ubiquitous data access needs in a secure fashion.

Here is the diagram.

I have seen both architectures to be used in the real world. There are always pros and cons. At the end of the day, we all know there is no perfect solution to fit all. The choice of the architecture is really ‘it depends’.

Let us know if you have done other ways to make RDS publicly accessible!

DBA
How to Manually Create Database Backup for SQL Server

Occasionally, I need to create a database backup from SQL Server manually on demand. It is a handy thing to know. Once the backup is created, it can be loaded to other SQL Server. This often happens when a developer wants to get the database from other environment or even …

DBA
How to Restore AdventureWorks to SQL Server Express

Once you have SQL Server Express installed on your local machine, you may want to load some example data so that you can play around with it. After all, what’s good with the database without data! MySQL comes with the Sakila database upon installation. SQL Server’s equivalent would be AdventureWorks …

DBA
How to Connect to Locally Installed SQL Server Express with JDBC

Once you install SQL Server Express locally, you need to go through a few configuration steps to connect to the server with JDBC. Tools In this demo, I am using SQL Workbench to connect to the server. SQL Server Express is 2017 version. JDBC is 7.1.x from Maven Repo. Steps …