1
votes

I want to ask regarding the read/write capacity logic from DynamoDB. I looked at their documentation here https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ProvisionedThroughput.html and I also googled how they are related to the items in the db but I don't understand their definition.

So in my case,

I have a table like this Hash key called user_id and sort key called flag_key

each item would be like this {user_id: 'user-1', flag_key: 'refresh_token', flag_value: 'some-random-refresh-token'} or {user_id: 'user-1', flag_key: 'roles', flag_value: ['role-a', 'role-b']}

and other things similar to the above.

Now if I want to query 3 things e.g. refresh_token, roles, and login_history

I would query the dynamoDB 3 times.

So my question is,

does DynamoDB charge me 3 read capacity for that? Even though the combined items are less than 4KB?

1

1 Answers

1
votes

Yes, if you make 3 different queries, you will use 3 RCU minimum.

However, since you are retrieving items for the same partition key, you may use a single query operation. As long as you make a single query and it returns all the data you need and that data is less than 4KB in total you will only use 1 RCU (read capacity unit).