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): support Aurora Serverless V2 instances #25437

Merged
merged 14 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test illustrates the migration path. The test migrated from the old config to the new config with no change in output.

Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,40 @@ vpc.isolatedSubnets.forEach((subnet, idx) => {
cfnSubnet.addDependsOn(ipv6);
});

const instanceProps = {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM),
isFromLegacyInstanceProps: true,
};
new rds.DatabaseCluster(stack, 'DualstackCluster', {
engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_3_02_0 }),
credentials: rds.Credentials.fromUsername('admin', { password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6') }),
instanceProps: {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM),
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED },
vpc,
},
writer: rds.ClusterInstance.provisioned('Instance1', {
...instanceProps,
}),
readers: [
rds.ClusterInstance.provisioned('Instance2', {
...instanceProps,
}),
],
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED },
vpc,
networkType: rds.NetworkType.DUAL,
removalPolicy: cdk.RemovalPolicy.DESTROY,
});

new rds.DatabaseCluster(stack, 'Ipv4Cluster', {
engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_3_02_0 }),
credentials: rds.Credentials.fromUsername('admin', { password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6') }),
instanceProps: {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM),
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED },
vpc,
},
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED },
vpc,
writer: rds.ClusterInstance.provisioned('Instance1', {
...instanceProps,
}),
readers: [
rds.ClusterInstance.provisioned('Instance2', {
...instanceProps,
}),
],
networkType: rds.NetworkType.IPV4,
removalPolicy: cdk.RemovalPolicy.DESTROY,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "30.1.0",
"version": "31.0.0",
"files": {
"f1be03db0810455e897d5600a00d7d089273d1f89b9a319be25928bf241a9490": {
"a633d33a056f9a9a775353c3902b2da4fa8318b43707e565b45a591da0888305": {
"source": {
"path": "aws-cdk-rds-cluster-rotation.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "f1be03db0810455e897d5600a00d7d089273d1f89b9a319be25928bf241a9490.json",
"objectKey": "a633d33a056f9a9a775353c3902b2da4fa8318b43707e565b45a591da0888305.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,12 @@
"Type": "AWS::RDS::DBCluster",
"Properties": {
"CopyTagsToSnapshot": true,
"DBClusterParameterGroupName": "default.aurora-mysql8.0",
"DBSubnetGroupName": {
"Ref": "DatabaseSubnets56F17B9A"
},
"Engine": "aurora",
"Engine": "aurora-mysql",
"EngineVersion": "8.0.mysql_aurora.3.03.0",
"MasterUsername": {
"Fn::Join": [
"",
Expand Down Expand Up @@ -692,11 +694,11 @@
"DBClusterIdentifier": {
"Ref": "DatabaseB269D8BB"
},
"DBInstanceClass": "db.t3.small",
"DBInstanceClass": "db.t3.medium",
"DBSubnetGroupName": {
"Ref": "DatabaseSubnets56F17B9A"
},
"Engine": "aurora"
"Engine": "aurora-mysql"
},
"DependsOn": [
"VPCPrivateSubnet1DefaultRouteAE1D6490",
Expand All @@ -713,11 +715,11 @@
"DBClusterIdentifier": {
"Ref": "DatabaseB269D8BB"
},
"DBInstanceClass": "db.t3.small",
"DBInstanceClass": "db.t3.medium",
"DBSubnetGroupName": {
"Ref": "DatabaseSubnets56F17B9A"
},
"Engine": "aurora"
"Engine": "aurora-mysql"
},
"DependsOn": [
"VPCPrivateSubnet1DefaultRouteAE1D6490",
Expand Down Expand Up @@ -964,10 +966,12 @@
"Type": "AWS::RDS::DBCluster",
"Properties": {
"CopyTagsToSnapshot": true,
"DBClusterParameterGroupName": "default.aurora-mysql8.0",
"DBSubnetGroupName": {
"Ref": "CustomRotationOptionsSubnets52AEBCED"
},
"Engine": "aurora",
"Engine": "aurora-mysql",
"EngineVersion": "8.0.mysql_aurora.3.03.0",
"MasterUsername": {
"Fn::Join": [
"",
Expand Down Expand Up @@ -1010,11 +1014,11 @@
"DBClusterIdentifier": {
"Ref": "CustomRotationOptions7CA9E132"
},
"DBInstanceClass": "db.t3.small",
"DBInstanceClass": "db.t3.medium",
"DBSubnetGroupName": {
"Ref": "CustomRotationOptionsSubnets52AEBCED"
},
"Engine": "aurora"
"Engine": "aurora-mysql"
},
"DependsOn": [
"VPCPrivateSubnet1DefaultRouteAE1D6490",
Expand All @@ -1031,11 +1035,11 @@
"DBClusterIdentifier": {
"Ref": "CustomRotationOptions7CA9E132"
},
"DBInstanceClass": "db.t3.small",
"DBInstanceClass": "db.t3.medium",
"DBSubnetGroupName": {
"Ref": "CustomRotationOptionsSubnets52AEBCED"
},
"Engine": "aurora"
"Engine": "aurora-mysql"
},
"DependsOn": [
"VPCPrivateSubnet1DefaultRouteAE1D6490",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"30.1.0"}
{"version":"31.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "30.1.0",
"version": "31.0.0",
"testCases": {
"integ.cluster-rotation.lit": {
"stacks": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "30.1.0",
"version": "31.0.0",
"artifacts": {
"aws-cdk-rds-cluster-rotation.assets": {
"type": "cdk:asset-manifest",
Expand All @@ -17,7 +17,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/f1be03db0810455e897d5600a00d7d089273d1f89b9a319be25928bf241a9490.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a633d33a056f9a9a775353c3902b2da4fa8318b43707e565b45a591da0888305.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down Expand Up @@ -234,19 +234,28 @@
"/aws-cdk-rds-cluster-rotation/Database/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "DatabaseB269D8BB"
"data": "DatabaseB269D8BB",
"trace": [
"!!DESTRUCTIVE_CHANGES: MAY_REPLACE"
]
}
],
"/aws-cdk-rds-cluster-rotation/Database/Instance1": [
{
"type": "aws:cdk:logicalId",
"data": "DatabaseInstance1844F58FD"
"data": "DatabaseInstance1844F58FD",
"trace": [
"!!DESTRUCTIVE_CHANGES: MAY_REPLACE"
]
}
],
"/aws-cdk-rds-cluster-rotation/Database/Instance2": [
{
"type": "aws:cdk:logicalId",
"data": "DatabaseInstance2AA380DEE"
"data": "DatabaseInstance2AA380DEE",
"trace": [
"!!DESTRUCTIVE_CHANGES: MAY_REPLACE"
]
}
],
"/aws-cdk-rds-cluster-rotation/Database/RotationSingleUser/SecurityGroup/Resource": [
Expand Down Expand Up @@ -312,19 +321,28 @@
"/aws-cdk-rds-cluster-rotation/CustomRotationOptions/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "CustomRotationOptions7CA9E132"
"data": "CustomRotationOptions7CA9E132",
"trace": [
"!!DESTRUCTIVE_CHANGES: MAY_REPLACE"
]
}
],
"/aws-cdk-rds-cluster-rotation/CustomRotationOptions/Instance1": [
{
"type": "aws:cdk:logicalId",
"data": "CustomRotationOptionsInstance1D693E87C"
"data": "CustomRotationOptionsInstance1D693E87C",
"trace": [
"!!DESTRUCTIVE_CHANGES: MAY_REPLACE"
]
}
],
"/aws-cdk-rds-cluster-rotation/CustomRotationOptions/Instance2": [
{
"type": "aws:cdk:logicalId",
"data": "CustomRotationOptionsInstance2A21FADD8"
"data": "CustomRotationOptionsInstance2A21FADD8",
"trace": [
"!!DESTRUCTIVE_CHANGES: MAY_REPLACE"
]
}
],
"/aws-cdk-rds-cluster-rotation/CustomRotationOptions/RotationSingleUser/SARMapping": [
Expand All @@ -350,24 +368,6 @@
"type": "aws:cdk:logicalId",
"data": "CheckBootstrapVersion"
}
],
"DatabaseSecretAttachmentPolicy5ACFE6CA": [
{
"type": "aws:cdk:logicalId",
"data": "DatabaseSecretAttachmentPolicy5ACFE6CA",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
]
}
],
"CustomRotationOptionsSecretAttachmentPolicyAB818C64": [
{
"type": "aws:cdk:logicalId",
"data": "CustomRotationOptionsSecretAttachmentPolicyAB818C64",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
]
}
]
},
"displayName": "aws-cdk-rds-cluster-rotation"
Expand Down
Loading