Task 4.3: Cost-Optimized Database

Theory

DynamoDB vs RDS Cost Comparison

FactorDynamoDBRDS
Pricing ModelPer request or provisioned RCU/WCUInstance hours + storage
ScalingInstant (On-Demand) or Auto ScalingVertical (instance resize) or read replicas
Idle CostZero with On-DemandInstance runs 24/7
Best ForVariable traffic, key-valueComplex queries, joins, transactions

Aurora Serverless

  • v2: Scales in fine-grained increments (0.5 ACU), always-on, scales to zero not supported
  • v1: Scales to zero (pauses after inactivity), coarser scaling, being deprecated
  • Cost-effective for: Infrequent, intermittent, or unpredictable workloads
  • Eliminates over-provisioning of database capacity

Backup and Retention Cost Optimization

  • RDS automated backups: Free storage up to the DB instance size. Retention 1-35 days.
  • Manual snapshots: Charged for storage. Delete when no longer needed.
  • Aurora backups: Continuous, stored in S3, free up to cluster volume size
  • DynamoDB: On-demand backups charged per GB. PITR adds ~20% to table cost.

Read Replicas for Cost

  • Offload reads to replicas instead of scaling up the primary (cheaper than vertical scaling)
  • Aurora replicas share the same storage volume (no additional storage cost)
  • Cross-region replicas incur data transfer charges

Database Migration for Cost

  • AWS DMS: Migrate from expensive commercial databases (Oracle, SQL Server) to open-source (PostgreSQL, MySQL) or Aurora
  • Schema Conversion Tool (SCT): Convert schemas between database engines
  • Migrating from Oracle to Aurora can save 80%+ on licensing costs

Capacity Planning

  • DynamoDB: Use On-Demand for unpredictable, Provisioned + Auto Scaling for predictable
  • RDS: Right-size instances using Performance Insights and CloudWatch metrics
  • Aurora Serverless v2: Automatic capacity management, pay for what you use

Flashcards

#QuestionAnswer
1DynamoDB On-Demand vs Provisioned?On-Demand: pay per request, no planning. Provisioned: specify RCU/WCU, cheaper for predictable.
2Aurora Serverless v2 min ACU?0.5 ACU
3RDS free backup storage?Equal to the DB instance storage size
4How to save on Oracle licensing?Migrate to Aurora/PostgreSQL using DMS and SCT
5Do Aurora read replicas cost extra storage?No, they share the same storage volume
6What is DMS?Database Migration Service for migrating between database engines
7What is SCT?Schema Conversion Tool for converting schemas between engines
8DynamoDB PITR cost?Adds ~20% to table cost
9When is Aurora Serverless cost-effective?Infrequent, intermittent, or unpredictable workloads
10How to right-size RDS?Use Performance Insights and CloudWatch metrics

Mock Exam Questions

Question 1

A company runs an Oracle database on-premises with expensive licensing. They want to migrate to AWS and reduce costs. Which approach provides the greatest cost savings?

  • A) Migrate to RDS for Oracle
  • B) Migrate to Aurora PostgreSQL using DMS and SCT
  • C) Run Oracle on EC2 with BYOL
  • D) Use DynamoDB
Answer

Correct: B

Migrating from Oracle to Aurora PostgreSQL eliminates Oracle licensing costs (80%+ savings) while providing Aurora’s performance benefits. RDS for Oracle still requires licensing. EC2 with BYOL requires managing the database. DynamoDB is NoSQL and may not be compatible.

Domain: 4 — Design Cost-Optimized Architectures Task: 4.3

Question 2

A company has a development database that is only used during business hours (8 AM - 6 PM). Which solution minimizes cost?

  • A) RDS with Reserved Instances
  • B) Aurora Serverless v2
  • C) DynamoDB On-Demand
  • D) RDS On-Demand with manual stop/start
Answer

Correct: B

Aurora Serverless v2 scales capacity based on demand and can scale down to minimum ACUs during off-hours. RDS Reserved Instances charge 24/7. DynamoDB is NoSQL. Manual stop/start works but requires automation and has a 7-day max stop limit.

Domain: 4 — Design Cost-Optimized Architectures Task: 4.3

Question 3

A company has a DynamoDB table with unpredictable traffic that spikes during sales events. Which capacity mode minimizes cost while handling spikes?

  • A) Provisioned capacity with high WCU/RCU
  • B) Provisioned capacity with Auto Scaling
  • C) On-Demand capacity
  • D) Provisioned capacity with reserved capacity
Answer

Correct: C

On-Demand capacity instantly handles traffic spikes without pre-provisioning. For truly unpredictable traffic, On-Demand avoids over-provisioning costs. Provisioned with Auto Scaling has a delay in scaling. High fixed provisioned capacity wastes money during low traffic.

Domain: 4 — Design Cost-Optimized Architectures Task: 4.3

Question 4

A company wants to reduce RDS costs for a read-heavy application. The primary instance is an r5.2xlarge. What should the architect recommend first?

  • A) Upgrade to r5.4xlarge
  • B) Add read replicas to offload read traffic
  • C) Switch to DynamoDB
  • D) Enable Multi-AZ
Answer

Correct: B

Read replicas offload read traffic from the primary, potentially allowing the primary to be downsized. This is cheaper than upgrading. Switching to DynamoDB requires application changes. Multi-AZ is for HA, not read performance.

Domain: 4 — Design Cost-Optimized Architectures Task: 4.3

Question 5

A company has multiple RDS manual snapshots from the past 2 years. They only need to retain snapshots from the last 90 days. How can they reduce storage costs?

  • A) Enable automated backups with 90-day retention
  • B) Delete manual snapshots older than 90 days
  • C) Move snapshots to S3 Glacier
  • D) Convert manual snapshots to automated backups
Answer

Correct: B

Manual snapshots are charged for storage and persist until explicitly deleted. Deleting old manual snapshots directly reduces costs. Automated backups handle retention automatically but do not affect existing manual snapshots. Snapshots cannot be moved to Glacier or converted.

Domain: 4 — Design Cost-Optimized Architectures Task: 4.3


References