feat(rds): Aurora clusters from snapshots#17759
Conversation
|
Thanks @jogold! |
|
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.) |
| this.connections = new ec2.Connections({ | ||
| securityGroups: this.securityGroups, | ||
| defaultPort: ec2.Port.tcp(this.clusterEndpoint.port), | ||
| }); |
There was a problem hiding this comment.
Can we move this up to ServerlessClusterNew? I believe this is duplicated between ServerlessClusterFromSnapshot and ServerlessCluster.
| if (secret) { | ||
| this.secret = secret.attach(this); | ||
| } | ||
|
|
||
| cluster.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.SNAPSHOT); |
There was a problem hiding this comment.
Same here - can we move this up to ServerlessClusterNew?
There was a problem hiding this comment.
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.
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.
I copied this line from cluster.ts. You're right. I was able to remove field subnetGroup.
Pull request has been modified.
| public readonly clusterIdentifier: string; | ||
| public readonly clusterEndpoint: Endpoint; | ||
| public readonly clusterReadEndpoint: Endpoint; | ||
| protected enableDataApi?: boolean; |
There was a problem hiding this comment.
Can we move this up to ServerlessClusterNew?
There was a problem hiding this comment.
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.
Can we move this up to ServerlessClusterNew?
There was a problem hiding this comment.
enableDataApi --> done
readonly field: see comment above.
Pull request has been modified.
|
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
DatabaseClusterFromSnapshotto 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