Reputation: 4297
I can see two graphs for write capacity: one thru CloudWatch alarms and the other thru the DynamoDB console. Here is what CloudWatch shows me:
Looks like the write capacity spikes up to almost 8,000 write capacity units.
Then I go to the Dynamo console and this is what I see:
Not even close to that high and not over the capacity allocated.
Why don't these two agree? Why does the CloudWatch alarm go off?
Upvotes: 3
Views: 1125
Reputation: 1902
For anyone looking to replicate the DynamoDB read/write metrics exactly in CloudWatch, you can use an expression like this...
Use SUM
for the statistic and make sure to use PERIOD
in the expression instead of a hard coded value, that way if your CloudWatch dashboard automatically adjusts the period, then it will react accordingly.
Upvotes: 0
Reputation: 38346
Inspecting the network requests sent from the DynamoDB console to CloudWatch revealed that the metrics in the graph are:
Average(ProvisionedReadCapacityUnits)
Sum(ConsumedReadCapacityUnits)
But as @Shiplu Mokaddim has noticed in a comment on the other answer, plotting those two in CloudWatch does not result in a graph matching what you see in the DynamoDB console.
It turns out, that the DynamoDB console uses the Sum(ConsumedReadCapacityUnits)
to compute an average to show in the graph. This is done by dividing the values with the period in seconds, and it ca be replicated in the CloudWatch console using a math expression.
DynamoDB console
CloudWatch console
Bonus: after realizing how to pull these numbers, I was able to write a script that produces a list of provisioned and consumed capacity for all DynamoDB tables in my AWS account.
Upvotes: 5
Reputation: 8435
To have two comparable graphs, ensure that both are shown with the same settings. Especially the chosen "Statistic" and "Period" must match to retrieve comparable results.
What's used for the CloudWatch graph isn't clear from your screenshot, but at least the DynamoDB graph shows that it's using "Average" as Statistic and "1 min" as Period.
My guess is that the CloudWatch graph is showing the "Maximum" or "p99" Statistic instead of the "Average" one.
Upvotes: 1