Backup and restore DynamoDB tables in AWS
masterUse the following patterns for common AWS DynamoDB tasks.
Single table backup/restore:
dynamodump -m backup -r us-west-1 -s testTable
dynamodump -m restore -r us-west-1 -s testTableMultiple tables using wildcards (e.g., prefix 'production-'):
dynamodump -m backup -r us-west-1 -s production*
dynamodump -m restore -r us-west-1 -s production*Transferring between environments (e.g., production to development):
dynamodump -m backup -r us-west-1 -s production*
dynamodump -m restore -r us-west-1 -s production* -d development*Backup all tables and restore data only (preserving schema):
dynamodump -m backup -r us-west-1 -s "*"
dynamodump -m restore -r us-west-1 -s "*" --dataOnlySchema-only operations (e.g., creating blank tables in a new account):
dynamodump -m backup -r us-west-1 -p source_credentials -s "*" --schemaOnly
dynamodump -m restore -r us-west-1 -p destination_credentials -s "*" --schemaOnlyBackup based on AWS tags:
dynamodump -p profile -r us-east-1 -m backup -t KEY=VALUECompress and store backups in S3:
dynamodump -p profile -r us-east-1 -m backup -a tar -b some_s3_bucket -t TAG_KEY=TAG_VALUERestore a specific archive from S3:
Note: The -s flag identifies the specific archive file name within the S3 bucket.
dynamodump -a tar -b some_s3_bucket -m restore -r us-east-1 -p profile -d destination_table -s source_table# See individual examples in the content section