On-demand Backups with DynamoDB Backup and Restore
Syntax
aws dynamodb create-backup --table-name <table_name> --backup-name <backup_name>
aws dynamodb restore-table-from-backup --target-table-name <table_name> --backup-arn <backup_arn>
Example
aws dynamodb create-backup --table-name my-table --backup-name my-table-backup
aws dynamodb restore-table-from-backup --target-table-name my-table --backup-arn arn:aws:dynamodb:us-west-2:123456789012:table/my-table/backup/0192837465
Output
The create-backup
command returns metadata about the backup, such as the backup ID and the time it was created.
The restore-table-from-backup
command does not return an output. The table is simply restored to its state at the time of the backup.
Explanation
DynamoDB backups allow you to create a point-in-time backup of your table. This comes in handy when you accidentally delete data, or when you need to roll back your table to a previous state.
With on-demand backups, you can create and restore backups whenever you need them, without being constrained by a fixed backup schedule.
The create-backup
command creates a new backup of the table with the specified name. The restore-table-from-backup
command restores the table to the state it was in at the time the backup was taken.
Use
- Use on-demand backups to protect your data against accidental deletion or corruption.
- Use on-demand backups to roll back your data to a previous state.
Important Points
- Backups are only available in the same region as the table.
- Backups are stored in Amazon S3.
- You are charged for the storage space used by the backup.
Summary
DynamoDB backups allow you to create a point-in-time backup of your table, which you can use to restore your table to a previous state. With on-demand backups, you can create and restore backups whenever you need them. The create-backup
and restore-table-from-backup
commands provide a simple and flexible way to manage your backups.