-
Notifications
You must be signed in to change notification settings - Fork 4k
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): Aurora clusters from snapshots #17759
Conversation
Thanks @jogold! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted
Thanks for your review, @jogold. I implemented the suggested changes. I also took over the test cases from |
@skinny85 PR is ready for review again. (I can't request your review in GitHub in the current state.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @jumic! The API looks good, we just need to reduce the duplication a little bit before we merge this in.
this.connections = new ec2.Connections({ | ||
securityGroups: this.securityGroups, | ||
defaultPort: ec2.Port.tcp(this.clusterEndpoint.port), | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this up to ServerlessClusterNew
? I believe this is duplicated between ServerlessClusterFromSnapshot
and ServerlessCluster
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
if (secret) { | ||
this.secret = secret.attach(this); | ||
} | ||
|
||
cluster.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.SNAPSHOT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here - can we move this up to ServerlessClusterNew
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to do so.
secret
is a readonly property. We can assign it only in the constructer. So I think we can't move it up to ServerlessClusterNew
because the source value isn't available yet.
cluster.applyRemovalPolicy
could be moved to a new method renderApplyRemovalPolicy(cluster: CfnCluster, removalPolicy?: RemovalPolicy)
. Then, we could call this method in ServerlessClusterFromSnapshot
and ServerlessCluster
. Should I implement it this way? I'm not sure if this is really a good optimisation.
In instance.ts
those lines are also duplicated. Maybe because there is no better option. Or do you have other ideas? If so, please let me know.
public static fromServerlessClusterAttributes(scope: Construct, id: string, | ||
attrs: ServerlessClusterAttributes): IServerlessCluster { | ||
protected readonly newCfnProps: CfnDBClusterProps; | ||
protected readonly subnetGroup: ISubnetGroup; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a field, and protected? I don't see it used anywhere outside of this class' constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this line from cluster.ts
. You're right. I was able to remove field subnetGroup
.
Pull request has been modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @jumic! One more tiny naming change please before we merge this in.
public readonly clusterIdentifier: string; | ||
public readonly clusterEndpoint: Endpoint; | ||
public readonly clusterReadEndpoint: Endpoint; | ||
protected enableDataApi?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this up to ServerlessClusterNew
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enableDataApi
--> done
If I move the readonly
fields to ServerlessClusterNew
, it shows message Property 'clusterIdentifier' has no initializer and is not definitely assigned in the constructor.
. I could declare them as abstract
. However, then I still have to create those fields in the sub classes.
|
||
public readonly secret?: secretsmanager.ISecret; | ||
|
||
protected enableDataApi?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this up to ServerlessClusterNew
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enableDataApi --> done
readonly
field: see comment above.
Pull request has been modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @jumic, thanks for the contribution!
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 CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
Add `DatabaseClusterFromSnapshot` to support creating Aurora clusters from snapshots. Closes aws#10936. The logic is implemented similar to PR aws#10130 where the same feature was implemented for database clusters. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Add
DatabaseClusterFromSnapshot
to support creating Aurora clusters from snapshots.Closes #10936.
The logic is implemented similar to PR #10130 where the same feature was implemented for database clusters.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license