How to connect to a database on VPN from EC2?

723 Views Asked by At

I have a NodeJs web application running on amazon EC2 server. Now from this node app in EC2, I have to access a database system (SqlServer) which is in the customer's in house network which can be accessed only with a VPN. What are the possible ways to do this?

Note: - In house db cannot be exposed to public

2

There are 2 best solutions below

1
Gabriel Bleu On

You can setup a VPN between the VPC and the customers network.

ref : https://aws.amazon.com/premiumsupport/knowledge-center/create-connection-vpc/

2
chris On

There are a three options:

1) Expose your database publicly, and connect from your app using a secure protocol (i.e. ssl). This is probably a horrible idea, but is possible.

2) Set up a VPN between AWS and the data center where the database lives. This is a quick, easy way to set up a hybrid architecture.

3) Set up Direct Connect between AWS and the data center. This can reduce latency, provide network sovereignty, and depending on the amount of traffic between the app and the db may actually be cheaper than option 2.