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(rds): construct for Aurora Serverless Clusters #10516

Merged
merged 24 commits into from
Sep 30, 2020

Conversation

shivlaks
Copy link
Contributor

@shivlaks shivlaks commented Sep 24, 2020

Adds a new construct to specify Aurora Serverless clusters

This is largely a stripped down version of Cluster as there are many properties
within clusters that do not apply to Aurora Serverless. Some of the notable
exclusions are:

  • backup windows
  • maintenance windows
  • associated roles (as S3 import/exports are not supported)
  • iam database authentication
  • exporting cloudwatch log exports
  • storage encryption is always true in Aurora serverless

Added:

  • Scaling options which only apply to Aurora serverless and cannot be used for
    provisioned clusters
  • Enum AuroraCapacityUnit to specify the provisioned capacity
  • Enable http endpoint for a serverless cluster

Closes #929


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

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Sep 24, 2020
Copy link
Contributor

@skinny85 skinny85 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! Some minor notes below.

packages/@aws-cdk/aws-rds/lib/cluster-ref.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/README.md Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/index.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/cluster-ref.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless/serverless.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless/serverless.ts Outdated Show resolved Hide resolved
@skinny85
Copy link
Contributor

I would also move the tests out of the serverless directory, I think it's a little early for that too 🙂.

@skinny85
Copy link
Contributor

For reducing duplication, here are my thoughts.

I don't think inheritance will cut it here, because of the conflicting requirements between the serverless and regular Clusters (the fact that they need separate Resource interfaces I think makes it impossible to simply inherit the implementation from). So, how about, after you've completed the implementation of the serverless Cluster and written all of the tests, you extract a new module-private Construct called something like SuperCluster (name is up to you of course) that essentially has all of the capabilities of both the serverless and regular clusters? And then, in the serverless and regular Cluster Resource classes, you would basically instantiate it with: new SuperCluster(this, 'Default', props); - the 'Default' ID should make all of the existing identifiers (that users already rely on through DatabaseCluster) stable. You just have to set the correct defaultChild in your ConstructNode, like this. The tests should not be modified after this extraction, and they should all keep passing.

Thoughts on the idea?

packages/@aws-cdk/aws-rds/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/README.md Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
@shivlaks
Copy link
Contributor Author

shivlaks commented Sep 29, 2020

For reducing duplication, here are my thoughts.

I don't think inheritance will cut it here, because of the conflicting requirements between the serverless and regular Clusters (the fact that they need separate Resource interfaces I think makes it impossible to simply inherit the implementation from). So, how about, after you've completed the implementation of the serverless Cluster and written all of the tests, you extract a new module-private Construct called something like SuperCluster (name is up to you of course) that essentially has all of the capabilities of both the serverless and regular clusters? And then, in the serverless and regular Cluster Resource classes, you would basically instantiate it with: new SuperCluster(this, 'Default', props); - the 'Default' ID should make all of the existing identifiers (that users already rely on through DatabaseCluster) stable. You just have to set the correct defaultChild in your ConstructNode, like this. The tests should not be modified after this extraction, and they should all keep passing.

Thoughts on the idea?

taking a stab at this now

update (9/30/2020): I'm going to defer this change to a chore/refactor PR. I think it's super valuable and do agree it's the right place to get to. rather than grow scope of this PR, I'd like to get good scrutiny on it as well. also briefly chatted with @njlynch and his instinct was also to do it in a separate PR.

@shivlaks shivlaks marked this pull request as ready for review September 30, 2020 17:01
@shivlaks shivlaks changed the title feat(rds): construct for Aurora Serverless Clusters [DRAFT] feat(rds): construct for Aurora Serverless Clusters Sep 30, 2020
Copy link
Contributor

@njlynch njlynch left a comment

Choose a reason for hiding this comment

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

Woohoo! 🎉

@mergify
Copy link
Contributor

mergify bot commented Sep 30, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Looks good! Some minor comments.

packages/@aws-cdk/aws-rds/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/README.md Show resolved Hide resolved
packages/@aws-cdk/aws-rds/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
@skinny85 skinny85 added the pr/do-not-merge This PR should not be merged at this time. label Sep 30, 2020
@skinny85
Copy link
Contributor

As discussed offline - please also mark IServelessCluster, ServerlessCluster, SeverlessClusterProps and ServerlessClusterAttributes as @experimental.

Copy link
Contributor

@skinny85 skinny85 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! 🎉

@skinny85 skinny85 removed the pr/do-not-merge This PR should not be merged at this time. label Sep 30, 2020
@mergify
Copy link
Contributor

mergify bot commented Sep 30, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: b040334
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Sep 30, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 0d7d07e into master Sep 30, 2020
@mergify mergify bot deleted the shivlaks/aurora-serverless branch September 30, 2020 21:42
@moltar
Copy link
Contributor

moltar commented Oct 1, 2020

Thank you @shivlaks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot create Aurora Serverless cluster using RDS Construct
5 participants