Amazon RDS for Beginners: Your First Managed Relational Database
A beginner-friendly guide to Amazon RDS: DB instances, engines, instance classes, storage, backups, Multi-AZ, and security groups, plus how to create a PostgreSQL database with the console, the AWS CLI, and Python (boto3) while keeping costs under control.
In the last article we stored data in DynamoDB, where you design the table around your access patterns and there are no joins. But many applications are a better fit for a classic relational database: tables with relationships, SQL queries, transactions, reports. Running PostgreSQL or MySQL yourself on an EC2 instance means installing it, patching it, scheduling backups, and handling failover. Amazon RDS does that undifferentiated work for you, so you can focus on the schema and the queries.
What RDS is
Amazon Relational Database Service (Amazon RDS) is a managed service for running relational databases in the AWS Cloud. You choose an engine, an instance size, and storage, and AWS takes care of provisioning, OS and engine patching, automated backups, and (if you want) a standby copy in another Availability Zone.
The supported engines are PostgreSQL, MySQL, MariaDB, Oracle, Microsoft SQL Server, IBM Db2, and Amazon Aurora (AWS's own MySQL- and PostgreSQL-compatible engine). Your application connects with the same drivers and SQL it would use anywhere else.
What you give up: you don't get shell access to the database host, and some superuser-level settings are managed through parameter groups instead of config files.
When to use it
- your data is naturally relational (users, orders, products, invoices);
- you need SQL, joins, transactions, and constraints;
- you're moving an existing app that already uses PostgreSQL or MySQL;
- you want ad-hoc queries and reporting that would be painful in a key-value store.
If you only ever fetch items by a known key and want zero capacity planning, DynamoDB is often simpler. Many real systems use both.
Key concepts
- DB instance: an isolated database environment running in the cloud. It's the basic building block of RDS, and it can host one or more databases.
- DB engine: the database software (PostgreSQL, MySQL, and so on) and its version.
- DB instance class: the compute and memory size, for example
db.t4g.micro. Thetclasses are burstable and good for learning and small workloads.
- Storage: EBS-backed volumes. General Purpose SSD (
gp3orgp2) is the usual starting point.
- Endpoint: the DNS name and port your app connects to. Always use the endpoint, never an IP address.
- Automated backups and snapshots: RDS takes daily backups and keeps transaction logs, which enables point-in-time recovery within the retention period. Manual snapshots stay until you delete them.
- Multi-AZ: a synchronous standby in another Availability Zone with automatic failover. Great for production, but it roughly doubles the instance cost.
- Read replicas: asynchronous copies used to scale reads.
- VPC and security groups: an RDS instance lives in your VPC. A security group decides who may connect on the database port.
Getting started
1. Create a database in the console
Open Aurora and RDS > Databases > Create database. Pick Standard create, engine PostgreSQL, and the Free tier template if it's offered for your account (otherwise Dev/Test with Single-AZ). Name the instance
studies-db , choose the instance class db.t4g.micro , and keep 20 GiB of gp3 storage.For credentials, you can let RDS manage the master password in AWS Secrets Manager instead of typing one. Under Connectivity, keep Public access: No. The simplest beginner path is the option to connect to an EC2 compute resource: the console then sets up security groups so the EC2 instance from our EC2 article can reach the database. Click Create database and wait for the status to become Available.
2. Or with the AWS CLI
Using the
studies profile from the IAM article:aws sso login --profile studies
aws rds create-db-instance \ --db-instance-identifier studies-db \ --engine postgres \ --db-instance-class db.t4g.micro \ --allocated-storage 20 \ --storage-type gp3 \ --master-username dbadmin \ --manage-master-user-password \ --no-publicly-accessible \ --backup-retention-period 1 \ --region sa-east-1 --profile studies
aws rds wait db-instance-available --db-instance-identifier studies-db \ --region sa-east-1 --profile studies
aws rds describe-db-instances --db-instance-identifier studies-db \ --query "DBInstances[0].Endpoint" \ --region sa-east-1 --profile studiesWith
--manage-master-user-password , RDS generates the password and stores it in Secrets Manager, so it never appears in your shell history. Creating the instance takes several minutes.3. A Python example (boto3)
boto3 talks to the RDS management API (create, describe, snapshot, delete). Your SQL still goes through a normal database driver such as
psycopg for PostgreSQL. This script checks the instance and takes a manual snapshot before you experiment:import boto3from botocore.exceptions import ClientError
session = boto3.Session(profile_name="studies", region_name="sa-east-1")rds = session.client("rds")
DB_ID = "studies-db"
def main() -> None: try: rds.get_waiter("db_instance_available").wait(DBInstanceIdentifier=DB_ID)
db = rds.describe_db_instances(DBInstanceIdentifier=DB_ID)["DBInstances"][0] endpoint = db["Endpoint"] print(f"{db['Engine']} {db['EngineVersion']} is {db['DBInstanceStatus']}") print(f"Connect to {endpoint['Address']}:{endpoint['Port']}")
snapshot = rds.create_db_snapshot( DBInstanceIdentifier=DB_ID, DBSnapshotIdentifier=f"{DB_ID}-before-experiments", )["DBSnapshot"] print(f"Snapshot {snapshot['DBSnapshotIdentifier']}: {snapshot['Status']}") except ClientError as error: print(f"RDS error: {error.response['Error']['Code']}")
if __name__ == "__main__": main()When this runs inside Lambda or EC2, drop
profile_name : the role attached to the function or instance provides the credentials, and it only needs permissions like rds:DescribeDBInstances and rds:CreateDBSnapshot on this instance.Costs and caveats
- Free tier: accounts created on or after July 15, 2025 get AWS credits and a Free plan that covers RDS on
db.t3.microanddb.t4g.microfor MySQL, PostgreSQL, MariaDB, and SQL Server Express. Older accounts keep the legacy 12-month free tier. Check the RDS Free Tier page for what applies to your account.
- It bills while it runs: unlike DynamoDB on-demand or Lambda, an RDS instance is charged per hour even when nobody is querying it. You can stop an instance for up to 7 days, after which RDS starts it again automatically.
- Extras cost money: Multi-AZ, larger instance classes, extra storage, snapshots beyond the free allowance, and a Secrets Manager secret all add to the bill.
- Never make it public by default: keep
Public accessoff and allow the database port only from your app's security group.
- Deletion protection: turn it on for anything real. For study databases, leave it off so cleanup is easy.
- Clean up:
aws rds delete-db-instance --db-instance-identifier studies-db --skip-final-snapshot, delete leftover manual snapshots, and keep that budget alert from AWS Budgets active.
Next steps
- Connect from the EC2 instance with
psqland create your first table.
- Write a small Python app with
psycopgthat inserts and queries rows.
- Restore a snapshot into a new instance to see how recovery works.
- Read about Aurora PostgreSQL Serverless for workloads with idle periods.
- In the next article: Amazon CloudWatch, to see what your database and functions are actually doing.
Official documentation
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article