Skip to content

feat(storage): Add dynamoDB Cloudformation templates#993

Merged
mergify[bot] merged 8 commits intoaws:masterfrom
bvtujo:ddb-cfn
Jun 4, 2020
Merged

feat(storage): Add dynamoDB Cloudformation templates#993
mergify[bot] merged 8 commits intoaws:masterfrom
bvtujo:ddb-cfn

Conversation

@bvtujo
Copy link
Copy Markdown
Contributor

@bvtujo bvtujo commented Jun 4, 2020

This PR adds the cloudformation template necessary to create DDB tables on behalf of customers in storage init.

Addresses #769

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@bvtujo bvtujo requested a review from a team as a code owner June 4, 2020 18:28
@bvtujo bvtujo self-assigned this Jun 4, 2020
@bvtujo
Copy link
Copy Markdown
Contributor Author

bvtujo commented Jun 4, 2020

An example implementation is on the Go Playground here.

The required data structures to execute this template look like this:

type Attribute struct {
	Name     string
	DataType string
}

type LocalSecondary struct {
	Name         string
	PartitionKey string
	SortKey      string
}
type data struct {
	TableResourceName string
	TableName         string
	Attributes        []Attribute	
	PartitionKey      string
	SortKey           string
	HasLSI            bool
	LSIs              []LocalSecondary
}

Copy link
Copy Markdown
Contributor

@kohidave kohidave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a few suggestions!

Comment thread templates/addons/ddb/cf.yml Outdated
KeySchema:
- AttributeName: {{.PartitionKey}}
KeyType: HASH
- AttributeName: {{.SortKey}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add an if here, and only do the range key if someone provides it.

Comment thread templates/addons/ddb/policy.yml Outdated
- dynamodb:Query
- dynamodb:Scan
- dynamodb:BatchWrite*
- dynamodb:CreateTable
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do Create* so that folks can CreateBackups too?

Comment thread templates/addons/ddb/outputs.yml Outdated
Copy link
Copy Markdown
Contributor

@kohidave kohidave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved once you add the retain!

Copy link
Copy Markdown
Contributor

@iamhopaul123 iamhopaul123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@mergify mergify bot merged commit 098e612 into aws:master Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants