🚀 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
- Log in to your AWS Management Console.
- In the search bar, type RDS and open the RDS service.
🗄️ Step 2: Create a New Database
- On the left panel, click Databases,
- then Create database. .
- Choose PostgreSQL as the engine type.
đź§© Step 3: Configure Database Settings
- Choose your preferred PostgreSQL version (e.g.,
PostgreSQL 14.17-R1
). - Under Templates, select Sandbox for demo/testing.
- In Settings:
- Enter a unique DB identifier, e.g.
postgresql-01
. - Select Self-managed credentials.
- Set your master username and password (keep this safe).
- Enter a unique DB identifier, e.g.
🔌 Step 4: Set Storage and Connectivity
- 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.
Step 4.2: Configure VPC & Networking Options
Keep the following as default values:
- Compute resource
- Network type
- Virtual Private Cloud (VPC)
- DB subnet group
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
Step 4.4 – Additional Configuration
Database port: 5432
Step 4.5 – Authentication & Monitoring
Authentication: Password (default)
Monitoring: Default settings
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.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.
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
- Go to the official website 👉 https://dbeaver.io/download
- Choose your operating system (Windows, macOS, or Linux)
- Download and install
Step 6.1 – New Connection in DBeaver
- Open DBeaver
- Click New Connection
- Select PostgreSQL → Next
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:
- Open the Databases list.
- Click on your database name.
- On the details page, locate the Endpoint (hostname) and Port.
These details will be used to connect from DBeaver.
Step 6.3 – Hostname Setup
Endpoint (example):
postgresql-01.cd2s88wgqc0p.us-east-2.rds.amazonaws.com
→ Copy and paste into DBeaver “Host” field
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.
Step 6.5 – Test Connection
- Click Test Connection in DBeaver to check if it works.
- If you get an error like: it may mean:
- The database is not yet fully created → check that the status is Available in Amazon RDS.
- 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.
Step 6.6 – Modify Security Group
To fix the connection issue, go back to your AWS RDS Console.
- Open the Databases list.
- Click on your database name to open the Details page.
- Locate and click on the VPC security group linked to your database.
Step 6.7 – Open VPC Security Group Settings
- In the Connectivity & Security tab of your database, locate VPC security groups.
- Click on the entry labeled default to open the VPC section.
- You’ll see the Security Group associated with your database.
- Scroll to the bottom and click the Inbound Rules tab.
- On the right side, select Edit Inbound Rules to modify access settings.
Step 6.8 – Edit Inbound Rules
- You should now be on the Edit Inbound Rules page.
- Locate the existing rule and click the Delete button to remove it.
- It’s recommended to delete and recreate the rule instead of modifying it — this helps prevent potential configuration errors later.
Step 6.9 – Add a New Inbound Rule
- Click on Add Rule.
- In the Type dropdown, select PostgreSQL.
- The Protocol and Port Range fields will auto-fill automatically (default: TCP / 5432).
- Under Source, choose Anywhere – IPv4 (0.0.0.0/0).
- Click Save Rules.
- 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.
Step 6.10 – Test the PostgreSQL Connection Again
- Return to DBeaver.
- Open your previously created PostgreSQL connection.
- Click Test Connection again.
- 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.
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. 🎉
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:
- Navigate back to RDS in your AWS Management Console.
- If you're still on the Security Group section, use the search bar at the top to search for “RDS.”
- Click on Databases on the left sidebar.
- On the left side of each database entry, you’ll see a circle (checkbox).
- Select the database you want to delete.
Click on the circle to select the database, and then in the Actions dropdown at the top, select Delete.
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.
🎉 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)