paulserban.eu

Writing Edition

Paul Serban

Writing, snippets & book notes

Cheat sheet - Post

AWS RDS: The EC2/EBS Foundation Behind Managed Relational Databases

← Back to AWS RDS Fundamentals: Architecture, Patterns, and Pitfalls Every Engineer Should Know

RDS is a managed wrapper around ordinary EC2 compute and EBS storage, not a serverless abstraction - and every sizing, availability, and scaling decision you make with it inherits the operational realities of those two underlying services.

Overview

Key Concepts

DB Instance = EC2 + EBS

Multi-AZ Deployment (Availability, Not Scaling)

Read Replicas (Scaling, Not Availability)

Storage Types and Autoscaling

Credential and Encryption Hygiene

RDS Proxy + IAM Database Authentication

Trade-offs / Caveats

Example in Practice

Provisioning a production-ready Multi-AZ PostgreSQL instance via boto3, applying the encryption/credential defaults discussed above:

response = rds.create_db_instance(
    DBInstanceIdentifier="orders-service-prod",
    DBInstanceClass="db.r6g.large",       # memory-optimized, ARM Graviton
    Engine="postgres",
    EngineVersion="16.3",
    MasterUsername="app_admin",
    ManageMasterUserPassword=True,        # secret in Secrets Manager
    AllocatedStorage=100,
    StorageType="gp3",
    Iops=6000,
    MultiAZ=True,
    BackupRetentionPeriod=7,
    DeletionProtection=True,
    StorageEncrypted=True,
)

A Lambda function then connects through the RDS Proxy endpoint (not the instance endpoint), authenticating with an IAM-generated token rather than a static password - avoiding both connection exhaustion under concurrent invocations and long-lived credentials in the environment.

Related topics