Sub topic 3
Instance classes and storage types
This chapter assumes you know what an RDS DB instance is and can run AWS CLI commands. It covers the two sizing decisions you make when you create an instance: compute (the instance class) and disk (the storage type).
Instance classes
The instance class sets vCPUs, memory, and network bandwidth. Names follow the pattern db.<family><generation><attributes>.<size>. In db.t4g.micro, t is the family, 4 is the generation, g means AWS Graviton processors, and micro is the size.
| Family | Example | Typical use |
|---|---|---|
| Burstable (T) | `db.t4g.micro` | Development, test, small or spiky workloads |
| General purpose (M) | `db.m6g.large` | Balanced CPU and memory for most production databases |
| Memory optimized (R, X) | `db.r6g.xlarge` | Large working sets, heavy caching, analytics-style queries |
Burstable classes earn CPU credits while idle and spend them under load. When the credits run out, the instance is throttled to its baseline CPU, or you pay for extra usage if unlimited mode is on. Sustained high CPU on a T class is a sign you need an M or R class.
Databases rely on memory, because the engine caches hot data and indexes there. If your working set doesn't fit in RAM, reads go to disk and latency rises. Start from the memory you need, then check CPU.
Not every engine, version, and Region supports every class. Check this before you plan:
aws rds describe-orderable-db-instance-options \
--engine postgres \
--query "OrderableDBInstanceOptions[].DBInstanceClass" \
--output textStorage types
Storage is network-attached SSD. Your choice sets the I/O performance you get.
| Type | Performance model | When to choose it |
|---|---|---|
| General Purpose SSD gp3 | A baseline of IOPS and throughput. You can raise IOPS and throughput on larger volumes without adding capacity. | Default choice for most workloads |
| General Purpose SSD gp2 | IOPS scale with volume size (3 IOPS per GiB) and can burst. | Existing instances. Prefer gp3 for new ones. |
| Provisioned IOPS io1 / io2 | You buy a fixed IOPS rate. | Latency-sensitive, I/O-heavy workloads |
With gp2, the only way to get more IOPS is a larger disk. gp3 separates size from performance, which is why it is the better default.
flowchart TDReplace nothing above; use the diagram below.
Storage autoscaling
You set --allocated-storage at creation. Storage autoscaling grows the volume automatically when free space runs low, up to a ceiling you choose with --max-allocated-storage:
aws rds modify-db-instance \
--db-instance-identifier demo-pg \
--max-allocated-storage 100 \
--apply-immediatelyChanging the class later
You can scale compute up or down with modify-db-instance:
aws rds modify-db-instance \
--db-instance-identifier demo-pg \
--db-instance-class db.m6g.large \
--apply-immediatelyA class change causes an outage while the instance restarts. On a Multi-AZ deployment the outage is shorter, because RDS updates the standby first and then fails over. Without --apply-immediately, the change waits for the next maintenance window.
Exercise
A db.t4g.medium PostgreSQL instance runs fast all morning, then slows sharply under steady load every afternoon. CPU stays pinned at the baseline. What is the likely cause, and what should you change?
Show answer
The instance has exhausted its CPU credits, so it is throttled to its baseline. Move to a non-burstable class such as db.m6g.large with modify-db-instance. Expect a short restart, so schedule it or use --apply-immediately deliberately.