chrisrhyno2003
chrisrhyno2003

Reputation: 4197

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?

Upvotes: 11

Views: 8731

Answers (6)

David Lee
David Lee

Reputation: 36

You can use "Type: 'AWS::DynamoDB::GlobalTable'" to create global table in CFN. A good resource is https://www.capitalone.com/tech/cloud/dynamodb-global-tables-with-cloudformation/.

This feature was released on May 17, 2021, https://aws.amazon.com/about-aws/whats-new/2021/05/amazon-dynamodb-global-tables-now-support-aws-cloudformation/.

Upvotes: 0

Patrick Chu
Patrick Chu

Reputation: 1603

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.

Upvotes: 0

Bhanu Prakash
Bhanu Prakash

Reputation: 17

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

Upvotes: 0

Merric Huffstutler
Merric Huffstutler

Reputation: 63

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.

Upvotes: 0

Rahul
Rahul

Reputation: 51

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.

Upvotes: 1

notionquest
notionquest

Reputation: 39226

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.

Upvotes: 5

Related Questions