11
votes

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?

5
Oh that's cool! Thanks for the link @PatMyron - chrisrhyno2003

5 Answers

1
votes

This feature is not yet implemented but it is present in the AWS roadmap

GlobalTable:
Type: AWS::DynamoDB::GlobalTable
Properties:
GlobalTableName: !Ref Table
ReplicationRegions:
 - us-east-1
 - us-west-2

Ref

6
votes

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.

1
votes

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.

0
votes

Your hack gets to the bottom of it. Create everything (including streams settings) with cloudformation. Then one manually enabled global tables on each created table. If you want the IOPS to be the same across all regions then your cloudformation will likely handle all the changes you need in the future.

0
votes

It looks like Cloudformation now supports DynamoDB Global Tables. Or, at least it's written up in the docs, but I'm not sure if this solves your problem: AWS Cloudformation DynamoDB Global table documentation

From the docs:

The AWS::DynamoDB::GlobalTable resource enables you to create and manage a Version 2019.11.21 global table. This resource cannot be used to create or manage a Version 2017.11.29 global table.