Jul 10, 2018

AWS CLI: How to remove all items from AWS DynamoDB by recreating tables?

A while ago I wrote about removing items from DynamoDB one by one AWS CLI: How to remove all items from AWS DynamoDB table with complex key? unfortunately it's very very very slow approach and I've found the best way: recreate tables :) Script:
(
aws_profile=your profile
LOG_DIR=logs
aws dynamodb --profile $aws_profile delete-table --table-name your-table
aws dynamodb --profile $aws_profile create-table --table-name your-table --attribute-definitions AttributeName=dataDateTime,AttributeType=S AttributeName=userId,AttributeType=S --key-schema AttributeName=userId,KeyType=HASH AttributeName=dataDateTime,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --sse-specification Enabled=true
)

No comments:

Post a Comment