A developer is building a serverless application using AWS Lambda and Amazon DynamoDB. The Lambda function performs frequent read and write operations to a DynamoDB table. During peak load, the developer observes `ProvisionedThroughputExceededException` errors from DynamoDB. The table is configured in 'On-demand' capacity mode. What is the MOST likely cause of these exceptions?
- AThe Lambda function's IAM role does not have sufficient permissions to perform DynamoDB operations.
- BThe Lambda function's reserved concurrency is too low, causing throttling before DynamoDB is hit.
- CThe DynamoDB table's read/write capacity units need to be manually scaled up.
- DThe DynamoDB table's burst capacity is being exhausted due to a sudden, sustained spike in traffic.
Show answer & explanationAnswer & explanation
Correct answer: D. The DynamoDB table's burst capacity is being exhausted due to a sudden, sustained spike in traffic.
DynamoDB On-demand capacity mode automatically scales to accommodate workload. However, it has an initial burst capacity and then scales up by doubling the previous peak traffic. If a sudden, sustained spike in traffic exceeds this burst capacity and the rate at which On-demand can scale (which is a factor of previous peak), `ProvisionedThroughputExceededException` can still occur until it catches up. It's not truly 'unlimited' in its immediate scaling.
Why the other options are wrong
- A. If IAM permissions were missing, the errors would be `AccessDeniedException`, not `ProvisionedThroughputExceededException`.
- B. If Lambda's concurrency was the bottleneck, you would see `ThrottlingException` from Lambda, not `ProvisionedThroughputExceededException` from DynamoDB.
- C. This is incorrect. In On-demand mode, capacity units are managed automatically; manual scaling is not required or possible.
DynamoDB On-demand Scaling Limits
While DynamoDB On-demand capacity mode automatically adjusts to accommodate workload, it isn't instantaneous. It has an initial burst capacity and scales up by doubling the previous peak throughput. A sudden, sustained spike significantly exceeding this scaling rate can still lead to `ProvisionedThroughputExceededException`.
- Scales automatically, but not infinitely fast or without limits.
- Initial burst capacity is available.
- Scaling rate is based on previous peak traffic (doubles the highest previous peak within 30 minutes).
- Sudden, large, sustained increases can still cause throttling.
Memory trick: On-demand Throttling: Even auto-scaling has a Burst Limit, especially if traffic's a sudden hit.