Let’s Get Certified
Module 14 / 15 · Design cost-optimized architectures

Pay for the database access pattern

Compare relational, key-value and analytical designs including their indexing, backups and migration costs.

Task 4.3 · Pay for the database access pattern

Cost the whole request

Count reads, writes, item sizes, consistency, secondary indexes, storage, replication and backups. A low request rate with large items may consume more capacity than a high rate of small items. Stable predictable DynamoDB demand may suit provisioned capacity with auto scaling. On-demand reduces the work of forecasting variable traffic. Model bursts and distribution separately. Idle provisioned databases can be expensive, while running sustained demand through a serverless service is not automatically cheaper.

Preserve database semantics

Choose a relational engine when joins or transaction semantics require it. Check feature compatibility and licenses before a move from a commercial engine. A homogeneous migration can often retain more schema and query behavior; a heterogeneous migration needs conversion and application testing. DMS can copy data and capture supported changes. It does not rewrite arbitrary procedural code. Price temporary overlap, validation and rollback. Large historical scans can often move to Parquet in S3 and Athena or to a columnar warehouse. Timestamp-oriented retention and aggregation can justify a time-series design.

Avoid multiplying idle capacity

Read replicas add compute and storage for reporting. A cache adds nodes or capacity plus invalidation work. Compare the cost removed from the origin with the cost of the cache. A connection proxy can prevent expensive oversizing driven by connection churn. Define retention for automated backups and manual snapshots against recovery needs; test point-in-time restore. Use billing reports grouped by account, cost allocation tag and usage type to validate the result.

Put a price on a recovery window

A daily snapshot with seven-day retention leaves no clean point for an error discovered on day 20. Price an appropriate recovery window before comparing engines. For a migration, keep a source-of-truth watermark and reconcile reads or record counts while source and target overlap. An incremental change feed can remove a repeated full scan for reporting; account for its replication, checkpoints and recovery costs as well as the database capacity it saves.

A ticketing database carries three years of closed cases

Agents join active tickets to customers throughout the day. Closed tickets older than 90 days are only aggregated by month. A nightly report now forces a larger primary instance and a replica. Auditors allow historical queries to take minutes.

What can move, and how would you prove that the move preserves both counts and savings?

Compare your design with the worked answer

Keep transactional records required by the live workflow in the relational database. Export eligible closed history to encrypted, partitioned columnar files, validate counts and totals and give auditors an Athena path. Reprice the smaller primary, warehouse scans, export jobs, backup retention and any remaining replica after load tests.

If a case can reopen, define how its history is retrieved and how late corrections are reconciled before removing active database records.

Apply the video example

Turn the DynamoDB capacity discussion into a bill estimate. A standard 1.5 KiB table write consumes two write units after rounding to 1 KiB increments. If an affected index also writes a 0.6 KiB entry, budget one index write unit in addition to the two table units. Separately price replicated writes if applicable.

freeCodeCamp at 44:34:47 · DynamoDB read and write consumption

AWS exam guide for this domain · Return to the objective map

Knowledge check

Pay for the database access pattern quiz

Answer 5 questions. Check each answer for an explanation.