📖 Scenario: You manage a DynamoDB table that stores user activity data. To keep the table responsive and cost-effective, you want to set up auto-scaling for its read and write capacities.
🎯 Goal: Configure auto-scaling for a DynamoDB table's read and write capacity units using AWS SDK commands or CloudFormation-like JSON structure.
📋 What You'll Learn
Create a DynamoDB table named UserActivity with a primary key UserId (string).
Define an auto-scaling target for the table's read capacity with minimum 5 and maximum 20 units.
Define an auto-scaling target for the table's write capacity with minimum 5 and maximum 20 units.
Set the target utilization percentage to 70% for both read and write auto-scaling policies.
💡 Why This Matters
🌍 Real World
Auto-scaling helps keep DynamoDB tables responsive during traffic spikes and saves costs during low usage by adjusting capacity automatically.
💼 Career
Understanding DynamoDB auto-scaling is essential for cloud engineers and developers managing scalable, cost-efficient NoSQL databases.
Progress0 / 4 steps
1
Create DynamoDB Table
Create a DynamoDB table named UserActivity with a primary key called UserId of type string.
DynamoDB
Hint
Define TableName, AttributeDefinitions with UserId as string, and KeySchema with UserId as HASH key.
2
Define Auto-scaling Targets
Add auto-scaling target configurations for the UserActivity table's read and write capacity units with minimum capacity 5 and maximum capacity 20.
DynamoDB
Hint
Use AutoScalingTargets array with entries for read and write capacity specifying MinCapacity and MaxCapacity.
3
Set Target Utilization for Auto-scaling Policies
Add auto-scaling policies for both read and write capacities with a target utilization percentage of 70%.
DynamoDB
Hint
Add AutoScalingPolicies array with policies for read and write capacities setting TargetValue to 70.0.
4
Complete Auto-scaling Configuration
Finalize the JSON configuration by ensuring the table, auto-scaling targets, and policies are all included in one JSON object.
DynamoDB
Hint
Ensure all parts are combined in one JSON object: table definition, auto-scaling targets, and policies.
Practice
(1/5)
1. What is the main purpose of auto-scaling in DynamoDB?
easy
A. To encrypt data stored in the table
B. To manually set fixed capacity limits
C. To backup data at regular intervals
D. To automatically adjust read and write capacity based on traffic
Solution
Step 1: Understand auto-scaling function
Auto-scaling automatically changes capacity to match traffic demands.
Step 2: Compare options
Only To automatically adjust read and write capacity based on traffic describes automatic adjustment of capacity based on traffic.
Final Answer:
To automatically adjust read and write capacity based on traffic -> Option D
Quick Check:
Auto-scaling adjusts capacity automatically = A [OK]
Hint: Auto-scaling means automatic capacity adjustment [OK]
Common Mistakes:
Confusing auto-scaling with manual capacity setting
Thinking auto-scaling handles backups
Mixing encryption with scaling
2. Which of the following is the correct way to specify the minimum capacity units in a DynamoDB auto-scaling policy JSON snippet?
easy
A. "MinCapacity": 5
B. "MinimumCapacityUnits": 5
C. "min_capacity": 5
D. "Min_Capacity": 5
Solution
Step 1: Recall DynamoDB auto-scaling JSON keys
The correct key for minimum capacity is "MinCapacity" with camel case and no underscores.
Step 2: Check options
Only "MinCapacity": 5 matches the exact key syntax "MinCapacity".
Final Answer:
"MinCapacity": 5 -> Option A
Quick Check:
Correct JSON key for minimum capacity = B [OK]
Hint: Use exact key names with correct casing in JSON [OK]
Common Mistakes:
Using underscores instead of camel case
Adding extra words like 'Units'
Incorrect capitalization
3. Given this auto-scaling target tracking policy snippet:
But the policy is not working as expected. What is the likely error?
medium
A. MinCapacity is greater than MaxCapacity
B. Missing required field for resource ID
C. TargetValue should be between 0 and 1, not 80.0
D. Cooldown times are too short and cause rapid scaling
Solution
Step 1: Check capacity and cooldown values
MinCapacity (5) is less than MaxCapacity (100), cooldowns are valid numbers.
Step 2: Identify missing required fields
Auto-scaling policies require resource identifiers (like ResourceId) to apply the policy.
Step 3: Confirm TargetValue range
TargetValue is a percentage and 80.0 is valid.
Final Answer:
Missing required field for resource ID -> Option B
Quick Check:
Missing resource ID causes policy failure = A [OK]
Hint: Check for all required fields, not just values [OK]
Common Mistakes:
Assuming cooldown times cause failure
Misreading TargetValue scale
Ignoring missing resource identifiers
5. You want to configure auto-scaling for a DynamoDB table with unpredictable traffic spikes. Which combination of settings will best ensure smooth scaling without throttling or overspending?