Skip to content

Databases on AWS

AWS offers a wide range of managed database services: relational (RDS), NoSQL (DynamoDB), caching (ElastiCache), and more. The key advantage is that AWS handles backups, patching, replication, and scaling.

Analogy: Managed databases are like hiring a professional chef instead of cooking yourself. AWS takes care of all the hard work — backups, updates, failovers — so you just use the database.


flowchart TB
Q["What kind of data?"] --> Relational{"Structured<br/>relationships?"}
Relational -->|"Yes (SQL, tables, joins)"| RDS["RDS — Relational<br/>PostgreSQL, MySQL, MariaDB,<br/>SQL Server, Oracle"]
Relational -->|"No (flexible schema)"| NoSQL{"Key-value or<br/>document?"}
NoSQL -->|"Key-value<br/>High scale, low latency"| DynamoDB["DynamoDB<br/>Managed NoSQL"]
NoSQL -->|"Document<br/>MongoDB-like"| DocumentDB["DocumentDB<br/>MongoDB compatible"]
Q --> Cache{"Caching?"}
Cache -->|"Yes, speed up reads"| ECache["ElastiCache<br/>Redis / Memcached"]
style Q fill:#f59e0b,color:#fff
style RDS fill:#3b82f6,color:#fff
style DynamoDB fill:#7c3aed,color:#fff
style DocumentDB fill:#059669,color:#fff
style ECache fill:#ef4444,color:#fff

Supports 6 database engines as managed services:

EngineBest For
PostgreSQLAdvanced relational apps, geospatial
MySQLWeb apps, WordPress, open-source stacks
MariaDBMySQL-compatible, community-driven
SQL ServerEnterprise .NET apps
OracleEnterprise Oracle ecosystem
AuroraAWS-native, 5x faster than MySQL, 3x faster than Postgres
Terminal window
# Create a PostgreSQL RDS instance
aws rds create-db-instance \
--db-instance-identifier my-db \
--db-instance-class db.t3.micro \
--engine postgres \
--master-username admin \
--master-user-password secret123 \
--allocated-storage 20

RDS features:

  • Automated backups (point-in-time recovery)
  • Multi-AZ (synchronous standby replica)
  • Read replicas (scale reads)
  • Automated patching

DynamoDB is a fully managed, key-value + document database with single-digit millisecond performance at any scale.

import boto3
dynamodb = boto3.resource('dynamodb')
# Create table
table = dynamodb.create_table(
TableName='Users',
KeySchema=[{'AttributeName': 'userId', 'KeyType': 'HASH'}],
AttributeDefinitions=[{'AttributeName': 'userId', 'AttributeType': 'S'}],
BillingMode='PAY_PER_REQUEST'
)
# Put item
table.put_item(Item={
'userId': '123',
'name': 'Alice',
'email': 'alice@example.com',
'age': 30
})
# Get item
response = table.get_item(Key={'userId': '123'})
print(response['Item'])
FeatureDetail
PerformanceConsistent single-digit ms latency
ScalingAuto-scales — no limits
PricingPay per read/write unit (on-demand or provisioned)
ConsistencyEventually consistent by default (strong optional)
BackupsAutomated (PITR) and on-demand

Need ThisUse
SQL queries, joins, complex relationshipsRDS (PostgreSQL/MySQL)
High-scale, low-latency key-value accessDynamoDB
Complex transactions across tablesRDS
Serverless, auto-scaling databaseDynamoDB
Existing app needs MySQL/PostgresRDS
Shopping cart, session data, user profilesDynamoDB

ElastiCache provides managed Redis and Memcached — perfect for caching, session stores, and real-time data.

See the Redis track for detailed Redis concepts.

Terminal window
# Create a Redis cluster
aws elasticache create-cache-cluster \
--cache-cluster-id my-cache \
--cache-node-type cache.t3.micro \
--engine redis

  • RDS = managed SQL databases (PostgreSQL, MySQL) — for structured relational data
  • DynamoDB = managed NoSQL — for high-scale, low-latency key-value data
  • ElastiCache = managed Redis — for caching and real-time data
  • Use RDS for complex queries; DynamoDB for massive scale
  • AWS handles backups, patching, replication — you just use the database