Created
November 29, 2018 14:21
-
-
Save jthomerson/6d8c8b3e7cb37f971b25e3c5da145897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
START=2018-10-01T00:00:00Z | |
END=2018-11-01T00:00:00Z | |
function GetStats() { | |
SUMUNITS=$(aws cloudwatch get-metric-statistics --start-time ${START} --end-time ${END} --metric-name $1 --namespace AWS/DynamoDB --statistics Sum --dimensions Name=TableName,Value=$2 --period 3600 | jq .Datapoints[].Sum | awk 'BEGIN {SUM=0}; {SUM=SUM+$1}; END {printf "%.3f\n", SUM}') | |
} | |
for TABLENAME in $(aws dynamodb list-tables | jq -r .TableNames[]); do | |
GetStats "ConsumedReadCapacityUnits" "${TABLENAME}" | |
echo "${TABLENAME} Read ${SUMUNITS}" | |
GetStats "ConsumedWriteCapacityUnits" "${TABLENAME}" | |
echo "${TABLENAME} Write ${SUMUNITS}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment