Search code examples
node.jsaws-lambdaamazon-dynamodbdynamodb-queries

Need idea on how to query dynamo db for specific date range in node


Need to design a table in Dynamo DB to get the month-wise data like how many users logged in to the application on a particular time frame as below

  1. Today how many users logged in?
  2. Particular month how many users logged in? 3 Particular year how many users logged in?

I am using node js in lambda with dynamo DB. Need help with table design and how to use filter to get the data for the above requirement.

Thanks in advance


Solution

  • If your user items are small, a single query for users can return ~5,000 items (all your users). If you run this every 10 minutes, your monthly on-demand cost is $0.12.

    Just query all the users and calculate the metrics on the server, it's not worth the time to design anything more complex.