Skip to content
Certification Guide

Task 4.3 · 20 min read

Cost-Optimized Databases

Services in this lesson

  • Amazon RDSin scope
  • Amazon Aurorain scope
  • Amazon Aurora Serverlessin scope
  • Amazon DynamoDBin scope
  • Amazon ElastiCachein scope
  • Amazon Redshiftin scope
  • Savings Plansin scope
  • AWS Cost Explorerin scope
  • AWS Budgetsin scope
  • AWS Cost and Usage Reportin scope

What the exam tests

  • Matching the billing model to the load shape. Provisioned capacity suits a steady baseline, and Aurora Serverless v2 or DynamoDB on-demand suits unpredictable load. Commit only to the part that never goes away.
  • Choosing the Aurora storage configuration, Standard or I/O-Optimized, by how much of the bill is I/O.
  • Stopping storage and backups from growing without a reason. The levers are free backup allowances and snapshot retention. In DynamoDB, Standard-IA (Standard-Infrequent Access, a cheaper storage class) handles cold data, and TTL (time to live, automatic expiry) handles expiring data.
  • Using a cache such as ElastiCache so the database can be smaller, and spotting when a cache saves nothing.
  • Picking the database commitment that fits the load, and the term each one needs. The options are Database Savings Plans, RDS reserved DB instances, DynamoDB reserved capacity and ElastiCache reserved nodes.

This lesson owns the cost side of database choices. It asks which database setting meets the requirement for the least money. Other topics live elsewhere:

The core concept

A database bill has four parts (compute, storage, I/O and backups), and each has its own lever. Find the part that dominates, commit to the load that never goes away, and pay as you go for the rest.

  • Compute runs the database engine. It is priced by the provisioned instance or by the capacity unit.
  • Storage holds the data. It is priced by the gigabyte-month (one gigabyte kept for one month) that you allocate or use.
  • I/O is each read or write the engine sends to storage. Some Aurora and DynamoDB modes charge for it per request.
  • Backups are snapshot copies of the data. You pay for snapshot storage beyond a free allowance.

An analogy: a bakery renting kitchen space

Picture a bakery that rents its kitchen instead of owning one:

  • A yearly lease on one oven covers the bread it bakes every single day. That's a commitment sized to the steady floor of the work.
  • Renting an oven only when a catering order comes in covers surprise jobs. Each job costs more than the lease rate, but quiet days cost nothing. That's on-demand or Serverless pricing.
  • A cheap cold-storage unit holds flour that is rarely touched. Getting a sack out costs a little extra each time. That's an infrequent-access storage class.
  • Stock with a best-before date gets thrown out without anyone scheduling it. That's an expiry rule on old data.
  • A sign on the counter answers the question every customer asks. The staff stop repeating themselves. That's a cache.

Where the analogy breaks: a lease holds one particular oven for you. A Database Savings Plan or a reserved DB instance holds no capacity at all, and each is only a discount on usage that matches it.

Walk one bill review through it

The diagram is a decision flow. It starts from the data model, splits by load or traffic shape, and ends at the billing setting that fits.

Enlarge
Pick the billing model from the load shape first, then reduce storage, I/O and backups for what remains.

Orchard Ledger sells online bookkeeping to small firms. Lucas runs its finance team, and Sana is its database engineer.

  1. Lucas flags a rising database bill. Sana starts at the top of the diagram and sorts each database by data model. The ledger is relational (tables that SQL queries join). Sessions and audit events are key-value data (items fetched by a known key) in DynamoDB.
  2. The production ledger runs at the same size all day. It is a provisioned Aurora cluster, so its bill is mostly instance hours. That steady branch will end in a commitment, but Sana makes it last.
  3. The ledger's I/O charges are a large share of its bill. Sana checks the I/O share of the bill in AWS Cost Explorer, the AWS tool that breaks down past spend. She compares both configurations' prices, then moves the cluster to Aurora I/O-Optimized, which has no per-request I/O charge.
  4. The development database sits idle most of the day. Sana moves it to Aurora Serverless v2, where capacity follows the load between a minimum and maximum she sets. Capacity is counted in ACUs (Aurora Capacity Units).
  5. She sets the minimum to 0 ACUs. The idle database now pauses on its own and resumes when a developer connects. Its storage is still billed while it sleeps.
  6. Login sessions follow users, so their traffic is hard to forecast. Sana keeps that table on DynamoDB on-demand capacity, which bills each request. A session is useless after it ends, so she adds TTL: each item stores its expiry as a number in epoch seconds (seconds since 1 January 1970).
  7. Audit events must be kept for years but are rarely read. Storage is most of that table's cost, so Sana moves it to the Standard-IA table class. Storage gets cheaper, and each read or write costs a little more.
  8. Every customer's dashboard asks for the same monthly totals. Sana puts Amazon ElastiCache, an in-memory cache, in front of the ledger. Repeats are answered from memory, so the cluster needs fewer readers.
  9. The ledger keeps 35 days of automated backups, but recovery needs only a week. Backup storage beyond the free allowance is billed. Sana lowers retention to what the recovery requirement names.
  10. Only now does she commit. Storage, I/O and repeated reads have been trimmed, so the remaining floor is real. Sana covers that floor with a Database Savings Plan, because Orchard Ledger may change its database mix.

Each charge went to the lever that owns it. A commitment bought at step 2 would have included waste that steps 3, 4, 5 and 8 later removed.

The rules the exam tests

  • Commit to the floor, not the peak. Anything you commit to and don't use is still paid for.
  • Pay per use when load is unpredictable. You accept a higher unit price in exchange for paying nothing extra when the load is absent.
  • A steady relational workload is mostly instance hours. Commit to those hours with reserved DB instances or a Database Savings Plan.
  • A key-value table full of old records is mostly storage. Move it to Standard-IA, and expire the items you no longer need.
  • Steady DynamoDB traffic suits provisioned capacity with auto scaling. Auto scaling raises and lowers the provisioned capacity to follow the traffic.
  • Heavy repeated reads are mostly read I/O. A cache in front cuts the work the database does.
  • Backup storage beyond the free allowance is billed. Keep only the retention the requirement names.
  • Measure before you commit. Watch the steady baseline over a representative period first, because a reservation is paid for whether or not you use it.
  • A Compute Savings Plan never discounts a database. It covers EC2, Fargate and Lambda usage only.
Deep diveAurora I/O-Optimized: the numbers and the switching rules

AWS says I/O-Optimized can save up to 40 percent for clusters whose I/O spend exceeds 25 percent of the Aurora bill.

I/O-Optimized also changes the instance and storage rates. A cluster with a small I/O bill can pay more overall, so compare both bills before you switch.

The storage configuration is a cluster setting, not an instance setting. You can switch from Standard to I/O-Optimized once every 30 days, and switch back to Standard at any time.

Deep diveDynamoDB TTL and Standard-IA in detail

TTL reads an attribute that holds a Number in epoch seconds, counted from the Unix epoch. A string value, or a date written as text, never expires, so the storage keeps growing.

TTL deletes expired items at no write cost. It runs as a background process and typically deletes them within a few days. Until then, expired items can still appear in reads, so filter them out of queries.

Standard-IA cuts storage cost by about 60 percent, while reads and writes cost about 25 percent more. It pays off when storage is about 50 percent or more of the table's cost.

Standard-IA is a table class, not a separate kind of table. You can choose it when you create a table or move an existing table to it later.

Which commitment, and for how long

Step 10 is where most exam questions about commitments land. Each commitment covers a different set of services and allows a different amount of change:

  • Database Savings Plan: the most flexible, with a one-year term. You commit to a fixed hourly spend, and it can cut costs by up to 35 percent. It covers Aurora, RDS, DynamoDB, ElastiCache and other database usage, and it reserves no capacity, so it suits a database mix that may change.
  • Reserved DB instances: a one-year or three-year term. The discount is tied to one instance family (size-flexible), one engine and one Region.
  • DynamoDB reserved capacity: saves up to 54 percent on a one-year term or 77 percent on a three-year term, in select Regions. It applies only to provisioned tables on the Standard table class.
  • ElastiCache reserved nodes: a discounted rate on nodes you pay for in advance, for a one-year or three-year term. The discount is size-flexible within one node family and Region.

Term length is a bet on the floor. A three-year term locks in the instance family, engine or table design for longer. Choose it only when those are settled.

Decision guide

Decision guide
If the question says…Reach for…Because…
relational database runs 24/7 at a steady size, and the family or engine is fixed for a year or moreReserved DB instances, or a Database Savings Plan if the mix may changeReserved DB instances fit one engine and instance family. A Database Savings Plan follows spend.
a development or test database is idle most of the day, with occasional spikesAurora Serverless v2 with a low minimum capacity, and auto-pause at 0 ACUsCapacity follows load between your minimum and maximum. At 0 ACUs the cluster can pause.
a steady production Aurora cluster whose I/O charges are a large share of the billAurora I/O-OptimizedNo per-request I/O charges. Compare both bills first, because instance and storage rates differ.
a steady Aurora cluster with modest I/O and a small bill from read and write requestsAurora StandardIts lower instance and storage rates win when I/O is a small share of spend.
a DynamoDB table with unpredictable or new traffic and no forecastDynamoDB on-demand capacity modePays per request, so no unused capacity. Costs more per request than well-used provisioned.
a DynamoDB table with predictable traffic and a stable baselineProvisioned capacity with auto scaling, plus reserved capacity for the baselineProvisioned units are cheaper at steady use. Reserved capacity lowers the rate on the floor.
a DynamoDB table whose storage is about half its cost or more, and rarely readStandard-IA table classStorage about 60% cheaper, requests about 25% pricier. Reserved capacity is not supported on it.
session or log items that are useless after a fixed timeDynamoDB time to live on an epoch-seconds number attributeExpired items are deleted at no write cost. Deletion can lag, so filter them out of reads.
the same read results requested again and again from a relational or DynamoDB backendElastiCache in front of the databaseFewer reads reach the database, so it can be smaller. Caching repeats beats buying capacity.
a cache cluster must run for years at a steady sizeElastiCache reserved nodes, with Valkey as the engineReserved nodes are discounted. Valkey nodes cost less than equivalent Redis OSS (open-source Redis) nodes.
backups kept for years for compliance, while the database is smallLower automated backup retention, and move long-term copies to a cheaper storeBackup storage beyond the free allowance is billed. Keep only the retention the requirement names.
a warehouse that runs queries in bursts, with unpredictable hoursAmazon Redshift Serverless with a usage limitBilled per RPU (Redshift Processing Unit) hour while queries run. A usage limit can alert you or stop queries.
a commercial database engine license is the largest line in the billMigrate to Aurora PostgreSQL or Aurora MySQL with AWS DMS (Database Migration Service)Open-source-compatible engines carry no license fee. DMS moves data, and schema conversion is separate.

Terms in this table:

  • Redshift Serverless bills in RPUs for the time queries run. A steady warehouse is better on a provisioned cluster.
  • AWS DMS moves the data. DMS Schema Conversion or AWS SCT (Schema Conversion Tool) converts the schema as a separate step.
  • Valkey is an engine ElastiCache offers alongside Redis OSS, compatible with Redis OSS commands.

Correct pattern

REFERENCE PATTERN: a production Aurora cluster with a committed baseline and a cache for hot reads, plus two DynamoDB tables. One expires its own rows, and the other uses the cheaper storage class.

# Aurora cluster on the I/O-Optimized configuration (switch only after comparing both bills)
aws rds modify-db-cluster \
  --db-cluster-identifier orders-prod \
  --storage-type aurora-iopt1 \
  --apply-immediately

# DynamoDB session table: expire rows by epoch time so no scheduled job is needed
aws dynamodb create-table \
  --table-name sessions \
  --attribute-definitions AttributeName=session_id,AttributeType=S \
  --key-schema AttributeName=session_id,KeyType=HASH \
  --billing-mode PAY_PER_REQUEST

aws dynamodb update-time-to-live \
  --table-name sessions \
  --time-to-live-specification "Enabled=true,AttributeName=expires_at"

# Audit table: written all day, read rarely after its first month, so store it in Standard-IA
aws dynamodb create-table \
  --table-name audit-events \
  --attribute-definitions AttributeName=event_id,AttributeType=S \
  --key-schema AttributeName=event_id,KeyType=HASH \
  --billing-mode PAY_PER_REQUEST \
  --table-class STANDARD_INFREQUENT_ACCESS

Why it holds up:

  • The storage configuration is set on the cluster, not per instance. Check the I/O share of the bill in Cost Explorer, then compare both configurations' prices before you switch. If I/O turns out to be small, the same comparison tells you to switch back.
  • The fixed baseline is what the commitment covers. Use a Database Savings Plan or reserved DB instances. Commit only after storage and I/O have been reduced, so the commitment is not sized to waste.
  • The session table uses on-demand capacity because session traffic follows users. Its expires_at attribute is an epoch number, so DynamoDB removes old sessions without a scheduled job.
  • The audit table picks Standard-IA at creation. An existing table could also move to the class later. Sessions stay on the Standard class because their reads and writes are frequent.

Traps

TRAPExam traps
The trapWhy it failsCorrect pattern
Switch every Aurora cluster to I/O-Optimized because it removes I/O chargesInstance and storage rates change too. A cluster with a small I/O bill can pay more overall.Check the I/O share in Cost Explorer, compare both prices, and switch only where I/O is a large share of spend
Put a DynamoDB table on provisioned capacity sized to its peak to avoid throttling (rejected requests)You pay peak capacity around the clock, including the idle part of the day.Provisioned with auto scaling for predictable load, or on-demand for unpredictable load
Move a rarely read table to Standard-IA without checking its read and write volumeStorage drops about 60 percent, but requests cost about 25 percent more. Busy tables lose.Choose Standard-IA when storage is about 50 percent or more of table cost and access is infrequent
Expect TTL to delete an item at the second it expiresTTL runs in the background, typically within a few days. Expired items still appear in reads.Filter expired items out of queries, and don't rely on TTL for anything that must disappear on time
Store the TTL value as a string, or as a date in text formTTL reads an epoch-seconds number. A string never expires, so storage keeps growing.Store the expiry as a number of seconds since the Unix epoch
Assume Aurora Serverless v2 is always cheaper than provisioned instancesIt bills the capacity used each moment. Steady high load costs more than committed instances.Serverless v2 for idle or spiky load; provisioned with a commitment for steady load
Buy a 3-year Reserved DB instance for a database that will move to another engine or instance familyThe discount matches one engine and instance family in a Region. A change leaves the commitment unused.Use a Database Savings Plan when the database mix may change, and commit only after the instance size is settled
Believe a cache lowers cost for every readOnly repeated reads benefit. Unique queries still reach the database, and the cache costs too.Cache the repeated reads, and size the database for the misses
Keep 35 days of automated backups on a database that only needs a week for recoveryBackup storage beyond the free allowance is billed every day you keep it.Set retention to the recovery requirement, and check the free allowance before adding long-term copies
Use Multi-AZ as a cost-free way to get a backupThe standby is a running, billed replica. It covers an Availability Zone (AZ) failure, not deleted data.Multi-AZ for availability (see task 2.2), snapshots and backup retention for recovery (see task 1.3)
Assume a Compute Savings Plan discounts a databaseCompute Savings Plans cover EC2, Fargate and Lambda only.Database Savings Plans for Aurora, RDS, DynamoDB and ElastiCache spend; Compute Savings Plans for compute spend

Two details behind the table:

  • Reserved DB instances don't reserve capacity. They only discount a matching engine and instance family, so a change of either leaves the commitment paid but unused.
  • A Multi-AZ standby is a second copy in another Availability Zone (AZ), billed for its instance and storage.

Compare

Compare
AspectDynamoDB on-demandDynamoDB provisioned with auto scalingAurora Serverless v2Provisioned Aurora or RDS
You pay forEach read and write requestProvisioned read and write units per hourAurora Capacity Units (ACUs) used, per secondInstance hours and allocated storage
Best load shapeUnpredictable or newSteady, forecastableIdle or spiky, with long quiet periodsSteady and high
Cheapest commitmentNo reserved capacity; switch a steady baseline to provisionedReserved capacity for the floorDatabase Savings Plan for the floorReserved DB instances or a Database Savings Plan
Idle costNear zero for requestsPaid for units you provisionedNear zero at 0 ACUs with auto-pauseFull instance rate
Main cost riskHigh per-request cost at scalePaying for unused unitsLong periods at high ACUs cost more than provisionedPaying for capacity that goes unused

Storage and backup costs differ by service. The exam asks which free allowance or storage class applies:

Compare
ItemAmazon RDSAmazon AuroraAmazon DynamoDB
Free backup storage allowanceEqual to 100 percent of provisioned database storage, per Region per accountEqual to the latest cluster volume size for automated backup usageBilled monthly for backup storage, prorated if a backup is removed mid-month
Storage that grows automaticallyStorage autoscaling raises allocated storage automaticallyCluster volume grows with the data, billed for what is usedStorage is billed for what the table holds
Storage cost levergp3 for most workloads; pay for io2 only when you need its provisioned IOPSI/O-Optimized for I/O-heavy workloadsStandard-IA table class for infrequently read data
Expire old dataLifecycle is yours: delete snapshots by retentionSame as RDS for snapshotsTTL on an epoch-seconds attribute

In the RDS column, gp3 and io2 are RDS storage types, and IOPS means input/output operations per second (the disk reads and writes storage can handle).

Worked exam scenario

Exam scenario

A subscription company keeps customer sessions in one Amazon DynamoDB table and audit activity events in a second DynamoDB table. Traffic to both tables is steady during business hours and drops to near zero overnight. Session records are needed for 24 hours, and the application already writes an expires_at attribute with each session's expiry time in epoch seconds. Activity events must be kept for 3 years for audit, but they are rarely read after their first month. The company wants the LOWEST cost and no change to the application code. What should a solutions architect do?

  1. A.Keep both tables on provisioned capacity sized to the business-hours peak, and keep all records with no expiry.
  2. B.On the sessions table, enable TTL on the expires_at attribute and use on-demand capacity. Move the activity table to the Standard-IA table class.
  3. C.Move both tables to the Standard-IA table class on provisioned capacity sized to the peak.
  4. D.Replace both tables with an Amazon RDS instance that runs 24 hours a day and delete old rows with a nightly script.
Show the walkthrough
  1. Underline the requirements. Session data expires after 24 hours. Activity data is kept 3 years and rarely read. Traffic follows business hours, and the goal is LOWEST cost with no code change.
  2. Split the data by lifetime and access. Sessions have a fixed lifetime, and the application already writes their expiry in epoch seconds. TTL on that attribute removes them without a job or a code change. Activity events are storage-heavy and rarely read, which is the Standard-IA case.
  3. Match the capacity to the load. Traffic drops to near zero overnight, so on-demand is the right billing mode for the sessions. Provisioned capacity sized to the peak would pay for idle hours.
  4. Eliminate A. Peak-sized provisioned capacity pays for idle capacity every night. Keeping sessions with no expiry grows storage forever.
  5. Eliminate C. Standard-IA raises the price of the reads and writes that session data gets all day. Peak-sized provisioned capacity repeats the idle-capacity error.
  6. Eliminate D. An RDS instance running 24 hours a day pays for idle hours. A nightly delete script is a code and operations change the stem rules out.
  7. Land on B. TTL removes expired sessions at no write cost, on its own schedule. On-demand matches the overnight drop, and the audit table moves to Standard-IA, where storage is the cost and reads are rare.

Answer: B

Check your understanding

Question 1: A DynamoDB table serves a product catalog with steady traffic all day, and its request costs are most of the monthly bill. Its traffic varies by no more than about 20 percent from hour to hour. Which change lowers cost the most without changing the application?
Question 2: Which TWO statements about Aurora storage configurations are true? (Choose TWO.) (Choose TWO.)
Question 3: A team sets the minimum capacity of an Aurora Serverless v2 cluster to 0 ACUs for a development database. What does this setting allow?
Question 4: A company wants its Amazon RDS backup storage costs to stay low. Its database is 500 GiB of provisioned storage. Which statement about the free backup storage allowance is correct?

Build it

Build a DynamoDB table with an expiry attribute and switch it between capacity modes. Then watch an expired item stay visible until DynamoDB removes it, in the cost-optimized databases lab.

Key takeaways

  • Commit to the steady floor, let on-demand or Serverless v2 carry the unpredictable part, and never size a commitment to the peak.
  • Aurora I/O-Optimized removes per-request I/O charges but changes the instance and storage rates. Choose it only when I/O is a large share of the bill.
  • DynamoDB on-demand suits unpredictable traffic, and provisioned with auto scaling suits steady traffic. Standard-IA suits rarely read tables where storage is about half the cost or more.
  • TTL removes expired items at no write cost, but on its own schedule. Store the expiry as an epoch number and filter expired items out of reads.
  • Cache repeated reads so the database can stay smaller, and remember that a cache only helps the reads that repeat.
  • Price the database by load shape and data lifetime: commit to the steady baseline, let on-demand or Serverless v2 carry the unpredictable part, expire unneeded data, and cache repeated reads.

Hands-on lab: Expire Data with TTL and Switch Capacity Modes

Sources

Last reviewed