How do I restore the backup of my Amazon DynamoDB table to a different Region?

2 minute read

I want to restore the backup of my Amazon DynamoDB table to a different Region.


To restore your DynamoDB table to a different Region, you can use either of the following approaches.

Restore a DynamoDB table to a different Region using DynamoDB

  1. Open the DynamoDB console.
  2. In the navigation pane, choose Backups.
  3. In the list displayed, choose the backup from which you want to restore the table.
  4. Choose Restore.
  5. For Name of restored table, enter the new table name.
  6. For Secondary indexes, select your desired option.
  7. For Destination AWS Region, select Cross-Region.
  8. For Select the destination AWS Region, choose the Region of your choice.
  9. For Encryption key management, select your desired option.
  10. Choose Restore.

Restore a DynamoDB table to a different Region using AWS Glue

You can use an AWS Glue job to restore a DynamoDB table to another Region. AWS Glue provides more flexibility with the restoration process. You might choose this approach if you don't want to restore all attributes or fields to the target table in the new Region. This approach works only for a table that's exported to Amazon Simple Storage Service (Amazon S3).

1.    After exporting the DynamoDB table to Amazon S3 using the Export to S3 feature, create an AWS Glue job. Be sure to specify the following information in the Script tab:

datasource0 = glueContext.create_dynamic_frame.from_options(
        "dynamodb.export": "ddb",
        "dynamodb.tableArn": "arn:aws:dynamodb:source-region:account-number:table/TableName",
        "dynamodb.unnestDDBJson": True,
        "dynamodb.s3.bucket": "example-bucket",
        "dynamodb.s3.prefix": "dynamodb",
        "dynamodb.s3.bucketOwner": "account-number",

Note: Be sure to use the transform node ApplyMapping, and specify the fields that must be present in the target table. This setting automatically generates the PySpark code based on the input provided.


applymapping1 = ApplyMapping.apply(frame = datasource0, mappings = [("resource_id", "string", "resource_id", "string")], transformation_ctx = "applymapping1")

2.    Specify a sink operation to directly write to the destination table in the target Region.


glueContext.write_dynamic_frame_from_options (frame = MappedFrame, connection_type = "dynamodb", connection_options = { "dynamodb.region": "example-region", "dynamodb.output.tableName": "example_table", "dynamodb.throughput.write.percent": "1.0" })

3.    Run the job from the AWS Glue console to load data from the current Region to the target Region.

Related information

Restoring a DynamoDB table from a backup

Point-in-time recovery for DynamoDB

Working with jobs on the AWS Glue console

AWS OFFICIALUpdated 2 years ago