Skip to content
Related Articles

Related Articles

AWS DynamoDB – Working with Backups

Improve Article
Save Article
  • Last Updated : 17 Mar, 2022
Improve Article
Save Article

Amazon DynamoDB supports on-demand backup and restores features. Those features are available to the user independent of whether the user uses AWS Backup or not. Users can use the DynamoDB on-demand backup capability to create full backups of its tables for a long-term period and archival for regulatory observation needs. 

DynamoDB also removes the complexity of the operation involved in protecting sensitive data. While using DynamoDB, users don’t have to worry about cluster scaling, managing nodes, reputation, hardware supervising, etc.

Point-in-time recovery (PITR) provides continuous backups of the user’s DynamoDB table data. When enabled, DynamoDB maintains incremental backups of the user table for the last 35 days until the user intentionally turns it off.

Features of DynamoDB:

Following are the features of DynamoDB:

  • The backup process executes in seconds regardless of the size of user tables or data, so users do not have to worry about backup schedules or long-running processes.
  • Moreover, all backups are automatically encrypted, systematic, easily discoverable, and retained until deleted.
  • Users can back up data i.e tables from a few MB to hundreds of TB of data, with no impact on performance.

Advantages of DynamoDB:

Following are the advantages of using DynamoDB:

  • Fully Managed: It manages all kinds of responsibilities like encryption, performance, and workloads.
  • Easy to Use: Users can enable PITR(Point-in-time recovery) or create, restore, and delete backups easily with a single click.
  • Fast and Scalable: Users can easily enable PITR or create as many backups for tables of any size very fastly like in seconds.
  • No Performance Impact: Have no impact on the performance and availability of your production applications.

Point-in-Time Recovery for DynamoDB:

Point-in-Time Recovery for DynamoDB makes sure to protect your vital data in form of tables from any kind of read and delete functioning. Users don’t need to worry about all the other operations. Restore can be done at a point in time. 

Backing Up a DynamoDB Table:

Follow the below steps to backup a DynamoDB table:

  • Choose “Create backup” over the “backups” tab of the source table.
  • On the left side of the console, choose”backup” and then “Create backup”.
  • The backup status will show “creating”,  and after completion, it will change to “Available”.

Output:

{
"BackupDetails": {
    "BackupName":
    "WebSeriesBackup",
    "BackupArn": "arn:aws:dynamodb:us-east-1:123456789012: table/WebSeries/backup/1456781290135-73d8d5bc,
    "BackupStatus": "CREATING",
    "BackupCreationDateTime": 1456781290.135
    }
}

Restoring a DynamoDB Table from a Backup: 

Follow the below steps to restore a dynamo DB table from backup:

  • Firstly log in to AWS Management Console and open DynamoDB.
  • On the left side of the console, choose “Backups”.
  • Now choose your source table name.
  • Choose “Restore” and fill in your basic new table details.
  • Click on “Restore table” to start the restore process.

Output:

aws dynamodb restore-table-from-backup \
--target-table-name WebSeries\
--backup-arn arn:aws: dynamodb:us-east-1:123456789012: table/Music/backup/01581881483719-db9c1f91
--global-secondary-index-override '[]' \
--sse-specification-override Enabled=true, SSEType=KMS

Deleting a DynamoDB Table Backup: 

Follow the below steps to delete a DynamoDB table backup:

  • Firstly log in to AWS Management Console and open DynamoDB.
  • On the left side of the console, choose “Backups”.
  • Now choose your source table name.
  • Select “Delete” and confirm it by typing “delete”.

Output:

aws dynamodb delete-backup \
--backup-arn arn:aws: dynamodb:us-east-1:123456789012: table/Music/backup/01489602797149-73d8d5bc

Using IAM with DynamoDB Backup and Restore:

Users can easily use AWS Identity and Access Management (IAM) only when the data which need to be backup are in the same AWS account.

Example 1: Permit the “CreateBackup” and “RestoreTableFromBackup”:- Grant the access in both actions.

{
    "Version": "2022-02-23",
    "Statement": [
        {
        "Effect": "Allow",
        "Action": [
            "dynamodb: CreateBackup",
            "dynamodb: Restore Table FromBackup",
            "dynamodb: PutItem",
            "dynamodb:UpdateItem",
            "dynamodb: DeleteItem",
            "dynamodb: GetItem",
            "dynamodb:Query",
            "dynamodb: Scan",
            "dynamodb: BatchWriteItem"
            ],            
        "Resource": "arn:aws:dynamodb:us-east-1:123456789012: table/WebSeries"
        }
    ]
}
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!