Time to 10x your DynamoDB productivity with Dynobase [learn more]
What are DynamoDB Global Tables?
DynamoDB Global Tables are globally available, fully-managed, multi-master, multi-region DynamoDB tables with eventual cross-region replication. With global tables, you get a replica of your table in each of the desired zones. Once you write data to one of the replicas, it will be eventually replicated to the rest of the tables.
How to Create Global Tables in DynamoDB? (Step by Step)
Create DynamoDB Global Tables using AWS Console
- Create a table as you would do that regularly. You can do that using AWS Console, Dynobase, Cloudformation, Serverless Framework, or whatever you like.
- Enable DynamoDB Streams on that table. They are required to create Global DynamoDB Table.
- Go to AWS DynamoDB Console, select your table, and head to "Global Tables" section. Click "Add Region"
- Select region and confirm selection by clicking "Create Replica".
After a few seconds your table in another region should be ready.
Create DynamoDB Global Tables using CloudFormation
If you want to create your Global DynamoDB Table using CloudFormation, you have to do that using custom resources and use their
createGlobalTable API in your custom resource.
Create DynamoDB Global Tables using CDK
Creating DynamoDB Global Tables with CDK is fortunately much easier. Table construct accepts
replicationRegions property which is an array of regions where replica tables will be created. In Typescript, you can use it like this:
Using DynamoDB Global Tables
Using DynamoDB Global Tables is pretty much similar to the normal way. The only key difference is the region you set when using DynamoDB/DocumentClient SDK. Make sure you're using the region where your compute resources are deployed. If your Lambda functions or EC2 instances are deployed in the region where you don't have DynamoDB Global Table replica, you might use a fallback to a base region. In Node.js it might look like this:
Frequently Asked Questions
What is the DynamoDB Global Table replication latency?
Replication latency is often less than one second. It's also worth mentioning that it's measurable via CloudWatch, the
ReplicationLatency metric is what you're looking for.
How much do DynamoDB Global Tables cost?
DynamoDB Global Tables cost can be calculated by summing up the individual cost of all the replicated tables and adding
Replicated Write Request Units to all that. You can use our pricing calculator to estimate rough costs of your setup.
What are the DynamoDB Global Tables supported regions?
DynamoDB Global tables are now available in the following regions:
- US East (Ohio)
- US East (N. Virginia)
- US West (N. California)
- US West (Oregon)
- Asia Pacific (Mumbai)
- Asia Pacific (Seoul)
- Asia Pacific (Singapore)
- Asia Pacific (Sydney)
- Asia Pacific (Tokyo)
- Canada (Central)
- EU (Frankfurt)
- EU (Ireland)
- EU (London)
- EU (Paris)
- South America (Sao Paulo)
- AWS GovCloud (US-East)
- AWS GovCloud (US-West)
How does encryption work in DynamoDB Global Tables?
Encryption in DynamoDB Global Tables works exactly the same as in traditional, single-region tables. It's encrypted both at rest and in transit.
How are conflicts managed in DynamoDB Global Tables?
Because DynamoDB Global Tables don't support partial updates, race conditions might occur and data integrity may be broken. In such a case, DynamoDB uses last writer wins approach, so when the one write operation is committed, other ones in transit might be rejected. Something to keep in mind while designing your application.