Sub topic 1
What RDS Does for You and What It Does Not
Prerequisites
This chapter assumes basic relational database concepts, AWS CLI and IAM familiarity, and a working understanding of VPCs, subnets, and security groups.
What RDS Manages
Amazon Relational Database Service (RDS) is a managed service for relational databases. AWS provisions the database host, applies many routine patches, manages storage, takes automated backups, and provides monitoring hooks.
You still own the database design, SQL, users and permissions, schema changes, application connections, and data protection requirements. You also choose the capacity, maintenance policy, network rules, and recovery strategy.
Choosing an Engine
An engine is the database software that runs your SQL. RDS supports engines such as PostgreSQL, MySQL, MariaDB, Oracle, and SQL Server. Choose based on application compatibility, licensing, extensions, operational skills, and migration requirements. Engine features and supported versions differ, so check compatibility before provisioning.
Instance Classes and Storage Types
An instance class determines compute capacity, memory, and network performance. Start with a small general-purpose class for development, then measure CPU, memory, connections, and I/O before scaling.
Storage is persistent block storage attached to the instance. General Purpose SSD (gp3) is a common default. Provisioned IOPS is intended for workloads with demanding and predictable I/O. Storage size affects capacity and may affect cost.
| Choice | Main decision |
|---|---|
| Instance class | Compute and memory capacity |
| `gp3` storage | General-purpose cost and performance |
| Provisioned IOPS | High, predictable I/O performance |
Placing RDS in Your VPC
A DB subnet group identifies subnets in at least two Availability Zones. A security group acts as a virtual firewall. For most applications, make the instance private and allow inbound traffic only from the application security group.
flowchart TD
App[Application subnet] -->|TCP 5432| SG[Database security group]
SG --> RDS[Private RDS instance]
RDS --> Subnets[DB subnet group in two Availability Zones]Creating a DB Instance
Create the subnet group first, then provision an encrypted instance with managed credentials:
aws rds create-db-subnet-group \
--db-subnet-group-name demo-subnets \
--db-subnet-group-description "Private database subnets" \
--subnet-ids subnet-0123456789abcdef0 subnet-0fedcba9876543210
aws rds create-db-instance \
--db-instance-identifier demo-pg \
--engine postgres \
--db-instance-class db.t4g.micro \
--allocated-storage 20 \
--storage-type gp3 \
--master-username appadmin \
--manage-master-user-password \
--db-subnet-group-name demo-subnets \
--vpc-security-group-ids sg-0123456789abcdef0 \
--no-publicly-accessible \
--storage-encrypted \
--backup-retention-period 7Exercise
Which AWS resource controls whether application servers can open a network connection to the database?
Show answer
The database security group's inbound rules.