DEV Community

Cover image for How to Deploy a PostgreSQL Database on AWS RDS (Step-by-Step)
Chidi
Chidi

Posted on

How to Deploy a PostgreSQL Database on AWS RDS (Step-by-Step)

🚀 Step-by-Step Guide to Deploying PostgreSQL on AWS RDS

Amazon RDS (Relational Database Service) is a managed cloud database service by AWS.

It simplifies setup, maintenance, and scaling of relational databases — handling backups, software updates, monitoring, and scaling automatically.

Using PostgreSQL on RDS gives you the power of an open-source database with AWS automation and reliability.


đź§  Prerequisites

Before you begin, make sure you have:

  • âś… An AWS account (free to create)
  • âś… Basic understanding of PostgreSQL
  • âś… A SQL client (e.g., DBeaver or PgAdmin) to test your connection

⚙️ Step 1: Open Amazon RDS

  1. Log in to your AWS Management Console.
  2. In the search bar, type RDS and open the RDS service.

Log in to your **AWS Management Console

In the search bar, type **RDS** and open the **RDS service**.

🗄️ Step 2: Create a New Database

  1. On the left panel, click Databases,
  2. then Create database. .
  3. Choose PostgreSQL as the engine type.

On the left panel, click **Databases**

then **Create database**.

Choose **PostgreSQL** as the engine type

đź§© Step 3: Configure Database Settings

  1. Choose your preferred PostgreSQL version (e.g., PostgreSQL 14.17-R1).
  2. Under Templates, select Sandbox for demo/testing.
  3. In Settings:
    • Enter a unique DB identifier, e.g. postgresql-01.
    • Select Self-managed credentials.
    • Set your master username and password (keep this safe).

Configure Database Settings

Configure Database Settings

🔌 Step 4: Set Storage and Connectivity

  1. In the instance configuration section, you can set the instance to “db.t3.micro” as we’re currently on demo. Then in the storage section leave all of the options as default values.

Set Storage and Connectivity

Step 4.2: Configure VPC & Networking Options

Keep the following as default values:

  • Compute resource
  • Network type
  • Virtual Private Cloud (VPC)
  • DB subnet group

set storage

Step 4.3: Public Access & Security

Set Public access → Yes (to allow connection from your computer).

Leave the following as default:

  • VPC security group (firewall)
  • Availability zone

Public access

Step 4.4 – Additional Configuration

Database port: 5432

database port

Step 4.5 – Authentication & Monitoring

Authentication: Password (default)
Monitoring: Default settings

Authentication & Monitoring

Step 5: Launch and Test Connection

Before launching, it's recommended to monitor your AWS account usage to avoid unexpected charges.

When ready, click Create database at the bottom to deploy your PostgreSQL instance.

step 5

Step 5.1: Verify Database Creation

After a few minutes, the database list page will appear.

You’ll see a banner confirming your database has been created, and the status will show Available.

ready

Step 6: Connect to Your PostgreSQL Database

Now that your PostgreSQL database is created, let's connect to it.

In this guide, we’ll use the free SQL editor DBeaver, but you can use any editor compatible with PostgreSQL.

Install DBeaver

  1. Go to the official website 👉 https://dbeaver.io/download
  2. Choose your operating system (Windows, macOS, or Linux)
  3. Download and install

dbeaver

Step 6.1 – New Connection in DBeaver

  1. Open DBeaver
  2. Click New Connection
  3. Select PostgreSQL → Next

db

db2

db3

Step 6.2: Get Your Database Connection Details

Next, you’ll need to specify your connection details in DBeaver.

To find them, go back to your AWS RDS Console:

  1. Open the Databases list.
  2. Click on your database name.
  3. On the details page, locate the Endpoint (hostname) and Port.

These details will be used to connect from DBeaver.

connection

connection2

Step 6.3 – Hostname Setup

Endpoint (example):
postgresql-01.cd2s88wgqc0p.us-east-2.rds.amazonaws.com

→ Copy and paste into DBeaver “Host” field

endpoint

Step 6.4 – Database Credentials

Port: 5432

Database: postgres

Username: postgres

Password: (your Postgres DB password)

đź’ˇ Tip: Check "Save password locally" to avoid re-entering it each time.

tip

Step 6.5 – Test Connection

  1. Click Test Connection in DBeaver to check if it works.
  2. If you get an error like: it may mean:
  3. The database is not yet fully created → check that the status is Available in Amazon RDS.
  4. Or, inbound connections are not allowed.

✅ To fix this, create or modify a Security Group in Amazon RDS to allow inbound connections on port 5432 from your computer’s IP address.

network issue

Step 6.6 – Modify Security Group

To fix the connection issue, go back to your AWS RDS Console.

  1. Open the Databases list.
  2. Click on your database name to open the Details page.
  3. Locate and click on the VPC security group linked to your database.

issue

Step 6.7 – Open VPC Security Group Settings

  1. In the Connectivity & Security tab of your database, locate VPC security groups.
  2. Click on the entry labeled default to open the VPC section.
  3. You’ll see the Security Group associated with your database.
  4. Scroll to the bottom and click the Inbound Rules tab.
  5. On the right side, select Edit Inbound Rules to modify access settings.

Open VPC Security Group Settings

open VPC

Step 6.8 – Edit Inbound Rules

  1. You should now be on the Edit Inbound Rules page.
  2. Locate the existing rule and click the Delete button to remove it.
  3. It’s recommended to delete and recreate the rule instead of modifying it — this helps prevent potential configuration errors later.

Edit Inbound Rules

Step 6.9 – Add a New Inbound Rule

  1. Click on Add Rule.
  2. In the Type dropdown, select PostgreSQL.
  3. The Protocol and Port Range fields will auto-fill automatically (default: TCP / 5432).
  4. Under Source, choose Anywhere – IPv4 (0.0.0.0/0).
  5. Click Save Rules.
  6. After a few moments, the rule will be saved, and you’ll be redirected back to the Security Groups page.

💡 Tip: You can now press Enter or click the image to view it in full size if you’ve added a screenshot.

Add a New Inbound Rule

Step 6.10 – Test the PostgreSQL Connection Again

  1. Return to DBeaver.
  2. Open your previously created PostgreSQL connection.
  3. Click Test Connection again.
  4. You should now see a “Connection successful” message if everything is configured correctly.

✅ Note: You’ll also notice the new PostgreSQL rule we created at the bottom of the Inbound Rules page in AWS — confirming that external access is now allowed.

Test the PostgreSQL Connection Again

Step 6.11 – Confirm Successful Connection

If all goes well, you should see a “Connected” window confirming that the connection to your PostgreSQL database was successful.

  • Click OK to close the confirmation message.
  • Then click Finish on the connection setup window.

You’ll now see a new entry in your DBeaver connection list named postgres — this confirms that your database connection has been successfully established. 🎉

CONNECTION

Step 7 – Deleting the Database (Optional)

If you no longer need the database, you can delete it. This is also a good way to prevent any future charges on your AWS account.

To do this:

  1. Navigate back to RDS in your AWS Management Console.
  2. If you're still on the Security Group section, use the search bar at the top to search for “RDS.”
  3. Click on Databases on the left sidebar.
  4. On the left side of each database entry, you’ll see a circle (checkbox).
    • Select the database you want to delete.

SUMMARY

Click on the circle to select the database, and then in the Actions dropdown at the top, select Delete.

DELETING

If you want to create a snapshot, leave the BOX selected — but I don’t want to do that in this guide, so I’ll uncheck it.

Tick the acknowledge box that appears, and I’ll also uncheck “retain automated backups,” as I don’t want that either.

Finally, type "delete me" into the field at the bottom and click "Delete."

After a few moments, the database will be deleted.

So that’s how you can set up a new Postgres database on Amazon RDS, connect to it from your SQL editor, and delete it if you no longer need it.

TOWARDS THE END

🎉 That’s it! You’ve successfully deployed PostgreSQL on Amazon RDS.

If you found this guide helpful, follow me here on Medium for more beginner-friendly DevOps and AWS tutorials. 🚀


Tags:

AWS PostgreSQL Beginner

Top comments (0)