Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(aws-dynamodb-global): Adding package to support DynamoDB Global Tables #2251

Merged
merged 10 commits into from
Apr 16, 2019
Merged

feat(aws-dynamodb-global): Adding package to support DynamoDB Global Tables #2251

merged 10 commits into from
Apr 16, 2019

Conversation

KingOfPoptart
Copy link
Contributor

@KingOfPoptart KingOfPoptart commented Apr 11, 2019

Adding a new package to support AWS DynamoDB Global Tables. The new package is built on top the existing aws-dynamodb package.

The construct creates multiple stacks in the specified regions, each with a DynamoDB Table (using the aws-dynamodb package). A custom resource is then deployed and uses a lambda to tie the tables together into a multi-region, multi-master database.


Pull Request Checklist

  • Testing
    • Unit test added (prefer not to modify an existing test, otherwise, it's probably a breaking change)
    • CLI change?: coordinate update of integration tests with team
    • cdk-init template change?: coordinated update of integration tests with team
  • Docs
    • jsdocs: All public APIs documented
    • README: README and/or documentation topic updated
  • Title and Description
    • Change type: title prefixed with fix, feat will appear in changelog
    • Title: use lower-case and doesn't end with a period
    • Breaking?: last paragraph: "BREAKING CHANGE: <describe what changed + link for details>"
    • Issues: Indicate issues fixed via: "Fixes #xxx" or "Closes #xxx"
  • Sensitive Modules (requires 2 PR approvers)
    • IAM Policy Document (in @aws-cdk/aws-iam)
    • EC2 Security Groups and ACLs (in @aws-cdk/aws-ec2)
    • Grant APIs (only if not based on official documentation with a reference)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.

KingOfPoptart and others added 8 commits March 20, 2019 09:52
fix(decdk): set the timeout in the schema tests to 10 seconds. (#2250)
fix(codebuild): add validation for Source when the badge property is …
…true (#2242)

Badge should not be allowed to be true if Source is not of type GitHub, GitHub Enterprise or Bitbucket.

Fixes #1749

AWS DynamoDB Global Tables package for CDK
…Poptart/aws-cdk into KingOfPoptart/aws-dynamodb-global
@KingOfPoptart KingOfPoptart requested a review from a team as a code owner April 11, 2019 23:38
@KingOfPoptart
Copy link
Contributor Author

So for clarity - I completely screwed up my previous PR (rebasing nightmare from waiting 20+ days between starting and getting ready to merge), so I'm creating this one to replace it. Old PR can be found here - #2082

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

A few more comments...

* Permits an IAM Principal to create a global dynamodb table.
* @param principal The principal (no-op if undefined)
*/
public static grantCreateGlobalTableLambda(principal?: iam.IPrincipal): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this need to be public? Seems like it's basically a helper used only in this file.


this.lambdaGlobalDynamodbMaker = new LambdaGlobalDynamoDBMaker(scope, id + "-CustomResource", props);
for (const table of this._regionalTables) {
this.lambdaGlobalDynamodbMaker.customResource.node.addDependency(table);
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe (not 100% sure) that if you just do this.lambdaGlobalDynamodbMaker.node.addDependency(table) it will automatically add a dependency on all underlying resources

* A stack that will make a Lambda that will launch a lambda to glue
* together all the DynamoDB tables into a global table
*/
export class LambdaGlobalDynamoDBMaker extends cdk.Stack {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for nitpicking, I am a bit sensitive to naming. Can you rename this to GlobalTableCoordinator (it's an internal class, I know...).

lambdaProvider: this.lambdaFunction,
properties: {
regions: props.regions,
resourceType: "Custom::MakeGlobalDynamoDB",
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename to Custom::DynamoGlobalTableCoordinator

"sphinx": {}
}
},
"cdk-build": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this from here... It's only for the aws-dynamodb package

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

Looks awesome. Thanks for all the hard work!

@eladb
Copy link
Contributor

eladb commented Apr 16, 2019

@KingOfPoptart do you mind taking a few minutes finalizing the PR title and message so we can use them for the merge commit?

@KingOfPoptart KingOfPoptart changed the title feat(aws-dynamodb-global): Package for Global DynamoDB Tables feat(aws-dynamodb-global): Adding package to support Global DynamoDB Tables Apr 16, 2019
@KingOfPoptart KingOfPoptart changed the title feat(aws-dynamodb-global): Adding package to support Global DynamoDB Tables feat(aws-dynamodb-global): Adding package to support DynamoDB Global Tables Apr 16, 2019
@KingOfPoptart
Copy link
Contributor Author

@eladb updated! Let me know if that's sufficient.

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