0
0
DynamoDBquery~5 mins

Cross-region replication (Global Tables) in DynamoDB

Choose your learning style9 modes available
Introduction

Cross-region replication helps keep copies of your data in multiple places around the world. This makes your app faster and safer if one place has problems.

You want your app to work fast for users in different countries.
You want to protect your data if one data center goes down.
You want to keep data copies synchronized automatically.
You want to reduce delays when users read or write data.
You want to build a global app that feels local everywhere.
Syntax
DynamoDB
aws dynamodb create-global-table \
  --global-table-name YourTableName \
  --replication-group RegionName1 RegionName2 ...
Use AWS CLI or AWS Console to create Global Tables.
Each region listed will have a copy of the table that stays in sync.
Examples
This creates a global table named MusicTable replicated in US East and Europe West regions.
DynamoDB
aws dynamodb create-global-table \
  --global-table-name MusicTable \
  --replication-group us-east-1 eu-west-1
This adds a new region (Asia Pacific Southeast) to an existing global table.
DynamoDB
aws dynamodb update-table \
  --table-name MusicTable \
  --replica-updates '[{"Create":{"RegionName":"ap-southeast-1"}}]'
Sample Program

This command creates a global table called BooksTable replicated in US West and US East regions.

DynamoDB
aws dynamodb create-global-table \
  --global-table-name BooksTable \
  --replication-group us-west-2 us-east-1
OutputSuccess
Important Notes

Global Tables automatically replicate data changes across regions.

Write conflicts are resolved using last writer wins based on timestamps.

Costs increase with more regions because each region stores and processes data.

Summary

Global Tables keep your data copied and synced in multiple regions.

This helps apps stay fast and available worldwide.

You create or update Global Tables using AWS CLI or Console commands.