Background
This article is for EDB Hosted private clusters specifically. If you want to connect the clusters deployed in your own cloud account, please kindly refer to EDB Docs - Connecting from AWS (enterprisedb.com).
Prerequisites
- A private EDB hosted cluster is deployed and your AWS account ID is set correctly.
- A EC2 instance with a client app (e.g. - psql or edb-psql) installed in your AWS account.
- The EC2 instance's VPC has a subnet in the same region as the database cluster.
Main Steps
Step 1: Get the cluster Service Name from the web portal
In the portal, go to the Clusters page:
Save the Service Name, you will use it later. As you can see below, com.amazonaws.vpce.us-east-1.vpce-svc-0c6799a9a5d0019f1 is my cluster Service Name.
Step 2: Create the AWS VPC endpoint
In the AWS console, go to the VPC endpoint page, click Create endpoint:
Check Other endpoint services, input the Service name saved at the previous step.
Select the VPC and subnets where the EC2 instance resides, check Enable DNS name.
Select the security group which has port 5432 open to the EC2 CIDR block.
Review all the settings then click Create endpoint.
Step 3: Test the connection
Once the endpoint status is Available, you can connect to your database cluster from your client application (psql, in my case) using the connection string.
psql "postgres://edb_admin@p-8jttv2ckzp.private.pg.biganimal.io:5432/edb_admin?sslmode=require"
You’re Done!