Skip to main content

What Is AWS RDS?

Why Not Just Run PostgreSQL on EC2?

You can install PostgreSQL on an EC2 instance yourself. But then you're responsible for:

  • Manual backups (and testing restores)
  • OS and PostgreSQL version patches
  • Setting up replication for high availability
  • Expanding storage when disk fills up
  • Monitoring replication lag

RDS handles all of this. You provision it, connect to it, and use it — everything else is managed.

Supported Database Engines

EngineNotes
PostgreSQLMost popular choice for new projects
MySQL / MariaDBWidely supported, great for WordPress and PHP apps
Aurora PostgreSQLAWS-native PostgreSQL-compatible, up to 5× faster, higher cost
Aurora MySQLAWS-native MySQL-compatible
SQL ServerFor .NET / Windows workloads
OracleEnterprise use cases

For most Node.js or Python projects, PostgreSQL or MySQL on RDS is the right call.

Core Concepts

DB Instance

The RDS database server. You choose the engine, version, and instance class (CPU/memory). RDS instance classes follow the same naming as EC2:

ClassRAMUse Case
db.t3.micro1 GBDev/test, free tier
db.t3.medium4 GBSmall production apps
db.r6g.large16 GBMemory-intensive workloads

Multi-AZ

When Multi-AZ is enabled, RDS maintains a synchronous standby replica in a second Availability Zone. If the primary fails, RDS automatically fails over to the standby — no manual intervention, typically under 60 seconds of downtime.

Always enable Multi-AZ for production. It roughly doubles the cost but is worth it.

Storage

RDS uses EBS (Elastic Block Store) volumes. Choose:

  • General Purpose SSD (gp3) — balanced performance, suitable for most workloads
  • Provisioned IOPS SSD (io2) — for databases requiring guaranteed high IOPS
  • Magnetic — legacy, avoid for new instances

Enable storage autoscaling with a maximum threshold — RDS will expand the disk automatically when it's getting full.

Automated Backups

RDS takes daily snapshots and stores transaction logs, enabling point-in-time recovery to any second within your retention period (1–35 days). You can also take manual snapshots that persist until you delete them.

Connecting from EC2

RDS instances are not publicly accessible by default (and shouldn't be). Access is controlled via security groups.

Security Group Setup

  1. RDS security group: inbound rule allowing port 5432 (PostgreSQL) or 3306 (MySQL) from the EC2 security group
  2. EC2 security group: no changes needed — it already allows outbound traffic

This way, only your EC2 instances can reach the database. Nothing from the public internet can.

Getting the Endpoint

In the RDS console, your instance's endpoint looks like:

mydb.abc123xyz.us-east-1.rds.amazonaws.com

Use this as the host in your connection string:

# PostgreSQL
psql -h mydb.abc123xyz.us-east-1.rds.amazonaws.com -U myuser -d mydb

# Node.js with pg
DATABASE_URL=postgresql://myuser:mypassword@mydb.abc123xyz.us-east-1.rds.amazonaws.com:5432/mydb

Testing from EC2

SSH into your EC2 instance and install the PostgreSQL client:

sudo apt install postgresql-client -y
psql -h <rds-endpoint> -U myuser -d mydb

If the connection hangs, it's almost always a security group issue — double-check that the RDS security group allows inbound from the EC2 security group on the right port.