Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DynamoDB global tables using CloudFormation

Is it possible to create DynamoDB global tables using the CloudFormation template? I was looking at this AWS doc - http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.tutorial.html#creategt_cli

and it seems like one can create DynamoDB global tables only with the Console or the AWS CLI and not through CloudFormation templates?

Or Is there a specific hack where I'll create all the replica tables using CloudFormation and I'll create the global table manually using the AWS CLI?

like image 558
chrisrhyno2003 Avatar asked Dec 26 '17 21:12

chrisrhyno2003


People also ask

How do I create AWS DynamoDB global table?

Open the DynamoDB console at https://console.aws.amazon.com/dynamodb/home . For this example, choose the us-east-2 (US East Ohio) Region. In the navigation pane on the left side of the console, choose Tables. Choose Create Table.

How does DynamoDB global table work?

Global tables replicate your DynamoDB tables automatically across your choice of AWS Regions. Global tables eliminate the difficult work of replicating data between Regions and resolving update conflicts, enabling you to focus on your application's business logic.

What is the prerequisite for DynamoDB global table?

The table must have the same name as all of the other replicas. The table must have DynamoDB Streams enabled, with the stream containing both the new and the old images of the item. None of the new or existing replica tables in the global table can contain any data.

Is DynamoDB regionalized?

DynamoDB Global Tables allows deploying a multi-region, multi-master DynamoDB replication solution. It is a fully-managed solution, where users need not write any custom code to make changes to data. DynamoDB automatically updates the data before replicating it across different regions.


2 Answers

If you want to do it through cloudformation, you can do so using custom resources. It is pretty straight forward and easy to use. You can use their createGlobalTable API in your custom resource.

like image 133
Rahul Avatar answered Sep 23 '22 11:09

Rahul


The DynamoDB Global Table was introduced during the late 2017. Yes, as you mentioned, you can create the global tables using the AWS console or AWS CLI.

However, creating the global table using cloudformation template is yet to be available.

Meanwhile, please use the console or AWS CLI to create dynamodb global table.

like image 31
notionquest Avatar answered Sep 24 '22 11:09

notionquest