Jun 28, 2018

AWS CLI: How to remove all items from AWS DynamoDB table with complex key?

I have Dynamo table and need to clean up it with AWS CLI (on Ubuntu 16.04 or Windows 10 Pro Linux Subsystem). I couldn't find examples about this topic and decided to share my findings.
First of all I have Primary Key "userId", and the sort key is "dataDateTime". To transform JSON I'm using JQ tool.
aws dynamodb scan --table-name dev-data-table --attributes-to-get "userId" "dataDateTime" | jq .Items[] -c | xargs -t -0 -d '\n' -I keyvalue aws dynamodb delete-item --table-name dev-data-table --key ''keyvalue''
Be careful, this method is very slow, up to 10K items.
Have a good day.

5 comments:

  1. Heard a lot about AWS services but never got a chance to use any which is why I decided to take some information about it. I barely get time for other things as I’m already too invested in the studies that I often have to take the help of https://www.ukassignmenthelp.uk/cheap-quick-assignment-writing-help/ to write assignments for me so that I can deliver them on time.

    ReplyDelete
  2. I'd heard a lot about AWS services but had never had the opportunity to use any, so I wanted to learn more about them. I barely have time for anything else.

    ReplyDelete
  3. I'd talked a bunch about Amazon Web Services (AWS) but had never used any, so Cheap Assignment Help I wanted to learn more about them. I don't have enough time for anything else.

    ReplyDelete
  4. Need the best solution for choosing your dissertation topics, if the answer is yes then visit the dissertation topic example page of British dissertation help. Here you will get a number of examples on HRM Dissertation Topics. All the topics that are provided in the topic list are examples or relate to the current environment, so you can choose any of the topics and then you will get an exceptional mark in your higher studies. The services of British dissertation help do not only end here, the British dissertation help team also provides complete guidance on completing your dissertation at a pocket-friendly price.

    ReplyDelete