When writing to DynamoDB or reading from DynamoDB you can specify: ReturnConsumedCapacity.
When you do this the API does return total CapacityUnits, but I am not able to get it to return ReadCapacityUnits or WriteCapacityUnits. The documentation indicates we should indeed get data on RCUs and WCUs: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ConsumedCapacity.html
This is true whether or not you set ReturnConsumedCapacity to TOTAL or INDEXES.
This is also true if you are simply doing a read query too.
Is there anyway to get RCUs and WCUs returned?
Here is a sample query:
aws.exe dynamodb query \
--table-name tableName \
--index-name GSI1 \
--key-condition-expression "GSI1PK = :pk" \
--expression-attribute-value '{":pk": {"S": "blah"}}' \
--return-consumed-capacity TOTAL
which returns something like this:
"ConsumedCapacity": {
"TableName": "tableName",
"CapacityUnits": 128.5
}
If I change the request from TOTAL to INDEXES I get:
"ConsumedCapacity": {
"TableName": "oaas-performance-table-dev",
"CapacityUnits": 128.5,
"Table": {
"CapacityUnits": 128.5
}
}
}
pretty much the same in other words. No RCU or WCU.
Any idea how to get this additional data?
This is the intended behavior, per the Query docs:
TOTAL- The response includes only the aggregate ConsumedCapacity for the operation.
A query can only consume read capacity, so CapacityUnits is effectively the same thing as ReadCapacityUnits, and WriteCapacityUnits is always 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With