Auto-scaling helps your database adjust its capacity automatically. This keeps performance steady and saves money.
Auto-scaling configuration in DynamoDB
aws application-autoscaling register-scalable-target \ --service-namespace dynamodb \ --resource-id table/YourTableName \ --scalable-dimension dynamodb:table:ReadCapacityUnits \ --min-capacity 5 \ --max-capacity 100 aws application-autoscaling put-scaling-policy \ --service-namespace dynamodb \ --resource-id table/YourTableName \ --scalable-dimension dynamodb:table:ReadCapacityUnits \ --policy-name MyScalingPolicy \ --policy-type TargetTrackingScaling \ --target-tracking-scaling-policy-configuration file://config.json
The first command sets the min and max capacity for your table.
The second command creates a policy to adjust capacity based on usage.
aws application-autoscaling register-scalable-target \ --service-namespace dynamodb \ --resource-id table/Orders \ --scalable-dimension dynamodb:table:WriteCapacityUnits \ --min-capacity 10 \ --max-capacity 200
{
"TargetValue": 70.0,
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBWriteCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60
}This example sets auto-scaling for the 'Books' table read capacity. It keeps usage near 70% by scaling between 5 and 50 units.
aws application-autoscaling register-scalable-target \ --service-namespace dynamodb \ --resource-id table/Books \ --scalable-dimension dynamodb:table:ReadCapacityUnits \ --min-capacity 5 \ --max-capacity 50 aws application-autoscaling put-scaling-policy \ --service-namespace dynamodb \ --resource-id table/Books \ --scalable-dimension dynamodb:table:ReadCapacityUnits \ --policy-name ReadCapacityScalingPolicy \ --policy-type TargetTrackingScaling \ --target-tracking-scaling-policy-configuration '{ "TargetValue": 70.0, "PredefinedMetricSpecification": { "PredefinedMetricType": "DynamoDBReadCapacityUtilization" }, "ScaleOutCooldown": 60, "ScaleInCooldown": 60 }'
Auto-scaling only works if your table uses provisioned capacity mode.
Cooldown times help avoid too many scaling actions in a short time.
Monitor your scaling policies to make sure they fit your app's needs.
Auto-scaling adjusts database capacity automatically based on usage.
You set minimum and maximum capacity limits to control scaling.
Target tracking policies keep usage near a set percentage for smooth performance.
Practice
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 DQuick Check:
Auto-scaling adjusts capacity automatically = A [OK]
- Confusing auto-scaling with manual capacity setting
- Thinking auto-scaling handles backups
- Mixing encryption with scaling
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 AQuick Check:
Correct JSON key for minimum capacity = B [OK]
- Using underscores instead of camel case
- Adding extra words like 'Units'
- Incorrect capitalization
{
"TargetValue": 70.0,
"ScaleInCooldown": 60,
"ScaleOutCooldown": 60
}What does the
TargetValue represent?Solution
Step 1: Understand TargetValue meaning
TargetValue sets the target utilization percentage for capacity usage.Step 2: Analyze options
The desired utilization percentage of capacity correctly describes TargetValue as desired utilization percent (70%).Final Answer:
The desired utilization percentage of capacity -> Option CQuick Check:
TargetValue = utilization percent = C [OK]
- Confusing TargetValue with capacity limits
- Mixing cooldown times with TargetValue
- Thinking TargetValue is a fixed capacity number
{
"MinCapacity": 5,
"MaxCapacity": 100,
"TargetValue": 80.0,
"ScaleInCooldown": 30,
"ScaleOutCooldown": 30
}But the policy is not working as expected. What is the likely error?
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 BQuick Check:
Missing resource ID causes policy failure = A [OK]
- Assuming cooldown times cause failure
- Misreading TargetValue scale
- Ignoring missing resource identifiers
{
"MinCapacity": 10,
"MaxCapacity": 200,
"TargetValue": 70.0,
"ScaleInCooldown": 120,
"ScaleOutCooldown": 30
}Solution
Step 1: Understand traffic spikes impact
Unpredictable spikes need quick scaling out to avoid throttling and slower scaling in to avoid rapid capacity drops.Step 2: Analyze given settings
Low MinCapacity saves cost, high MaxCapacity allows growth, fast ScaleOutCooldown (30s) reacts quickly, slow ScaleInCooldown (120s) prevents rapid scale down.Step 3: Evaluate other options
Fixed capacity ignores spikes, very fast cooldowns cause thrashing, setting TargetValue to 100 risks overprovisioning.Final Answer:
Set a low MinCapacity, high MaxCapacity, fast ScaleOutCooldown, slow ScaleInCooldown -> Option AQuick Check:
Fast scale out + slow scale in = smooth scaling = D [OK]
- Setting fixed capacity ignoring spikes
- Using equal cooldowns causing rapid scaling
- Setting TargetValue too high causing overspending
Ready to prove it?
Pass the test and this pattern moves unknown
