dynobase-icon
Dynobase

DynamoDB Point-in-Time Recovery (PITR) - The Ultimate Guide

Chameera Dulanga

Written by Chameera Dulanga

Published on November 27th, 2021

    Still using AWS console to work with DynamoDB? 🙈

    Time to 10x your DynamoDB productivity with Dynobase [learn more]

    Amazon DynamoDB is a fully managed, cloud-native, NoSQL database service. It guarantees millisecond range latency at any scale and provides multiple backup options to ensure a smooth flow for production-ready applications.

    In this article, I will discuss how DynamoDB point-in-time recovery (PITR) works, show different ways to enable it, and compare it with on-demand backups to give you a better understanding.

    What is DynamoDB Point in Time Recovery?

    Database backups are an essential part of any application. Especially when it comes to cloud databases, backups make sure that no data losses happen in case of regional failovers or disasters.

    Amazon DynamoDB provides 2 options to create database backups: on-demand and continuous. The on-demand approach creates backups only when you request, while the continuous approach creates automatic backups using point-in-time recovery.

    If you have enabled point-in-time recovery, you don't need to worry about scheduling on-demand backups and restoring tables to any point in the last 35 days.

    Apart from the continuous backups, there are some additional features of point-in-time recovery:

    1. No performance issues Enabling point-in-time recovery will not have any impact on performance or API latencies. It won't use any resources from your workload for the backup process and won't need to provide additional throughput.
    2. Table level backups When you restore a table using point-in-time recovery, the restored table will not be linked to an original database table. Instead, the restored table will appear as a new one, and you will be able to compare the changes and replace data as you need. Also, When you restore a table, DynamoDB allows configuring several settings of the destination table. So, you can change Global secondary indexes (GSIs), Local secondary indexes (LSIs), Billing mode, Provisioned read and write capacity, and Encryption settings on the restored table.
    3. Time flexibility As I mentioned, point-in-time recovery allows restoring data up to 35 days (Earliest Restorable DateTime). So you can pick a point to a specific time in hours, minutes, or even seconds to restore.
    4. High Speed Regardless of the database table size, it will only take a few seconds to backup.

    I think now you understand what point-in-time recovery and its features are. Next, I will show you how to enable DynamoDB point-in-time recovery.

    How to Enable DynamoDB Point in Time Recovery

    Enabling DynamoDB point-in-time recovery through the AWS management console is pretty straightforward.

    However, that's not the only way to enable DynamoDB point-in-time recovery. You can use the AWS management console, AWS CLI, DynamoDB API, Terraform, and CloudFormation to enable DynamoDB point-in-time recovery.

    Enabling DynamoDB Point-in-Time Recovery using AWS Management Console

    To enable DynamoDB point-in-time recovery through the AWS management console, you need to select the DynamoDB table from the tables list and navigate to the Backups tab.

    DynamoDB Backups Tab

    There, you will see the current status point-in-time recovery and edit it by clicking the Edit button.

    Enabling point-in-time recovery in DynamoDB

    Enabling DynamoDB Point in Time Recovery using AWS CLI

    If you know your way around with AWS CLI commands, you can enable point-in-time recovery with the following command.

    Enabling DynamoDB Point in Time Recovery using CloudFormation

    If you are using CloudFormation, you can enable DynamoDB point-in-time recovery by modifying the resources section of the YAML file.

    Enabling DynamoDB Point in Time Recovery using Terraform

    Also, you can enable DynamoDB point-in-time recovery using Terraform. All you need to do is a small configuration like below:

    Note: You can use AWS Cloud Trail to log all console and API actions of point-in-time recovery events.

    Pricing Model for DynamoDB Point in Time Recovery

    Amazon DynamoDB core features are billed based on usage. For example, if you use an on-demand capacity plan, 1.25 USD will be charged per 1 million write request units.

    However, this does not include the cost for optional features like point-in-time recovery.

    DynamoDB charges for point-in-time recovery based on the size of each table. DynamoDB monitors the size of point-in-time recovery enabled tables throughout the month and decides the backup charges.

    For example, if you enable point-in-time recovery for a DynamoDB table in the US East (N. Virginia) region, it will cost you 0.20 USD per GB-month.

    Note: DynamoDB point-in-time recovery charges can be changed based on the region you select.

    DynamoDB PITR price comparison

    Point in Time Recovery vs. On-Demand Backup

    Although both on-demand and point-in-time recovery created database backups, there are some differences between these approaches regarding cost, purpose, and availability.

    DynamoDB Point-in-Time Recovery vs On-Demand Backups

    Frequently Asked Questions

    What will happen if I disable DynamoDB point-in-time recovery and re-enable it later?

    Disabling and re-enabling point-in-time recovery will reset the start time, which you can recover from that table. So, you will only be able to restore that table to the Latest Restorable DateTime.

    What will happen to the backup if I delete a point-in-time recovery enabled DynamoDB table?

    If you delete a point-in-time recovery enabled table, DynamoDB will keep a system backup for 35 days. This allows you to restore that table as it was at the point of deletion. Also, there won't be any additional cost for these system backups.

    Can I use DynamoDB point-in-time recovery for global tables?

    Yes. You can enable point-in-time recovery on each local replica of a global table. When you restore such a table, the backup will be restored to an independent table.

    Is it possible to restore DynamoDB tables across regions?

    Yes. DynamoDB point-in-time recoveries can be used across regions. You will only be charged for the amount of data you transfer out from the region and restore in the new table.

    Better DynamoDB experience.

    Start your 7-day free trial today

    Product Features

    Download
    /
    Changelog
    /
    Pricing
    /
    Member Portal
    /
    Privacy
    /
    EULA
    /
    Twitter
    © 2024 Dynobase