From b2200a8018205bab1699b9eb684d014376d7a14a Mon Sep 17 00:00:00 2001 From: Michael Sambol Date: Thu, 12 Oct 2023 09:54:25 -0600 Subject: [PATCH] docs(rds): update deprecated InstanceProps example (#27499) Updating example that uses deprecated `InstanceProps`. Also updating MySQL version for others as I got this error: `Cannot find version 5.7.mysql_aurora.2.08.1 for aurora-mysql`. Closes #27495. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk-lib/aws-rds/README.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/aws-cdk-lib/aws-rds/README.md b/packages/aws-cdk-lib/aws-rds/README.md index 3833ff16eaa3e..5ef5971390ae9 100644 --- a/packages/aws-cdk-lib/aws-rds/README.md +++ b/packages/aws-cdk-lib/aws-rds/README.md @@ -18,7 +18,7 @@ of readers (up to 15). ```ts declare const vpc: ec2.Vpc; const cluster = new rds.DatabaseCluster(this, 'Database', { - engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }), + engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_3_01_0 }), credentials: rds.Credentials.fromGeneratedSecret('clusteradmin'), // Optional - will default to 'admin' username and generated password writer: rds.ClusterInstance.provisioned('writer', { publiclyAccessible: false, @@ -34,19 +34,24 @@ const cluster = new rds.DatabaseCluster(this, 'Database', { }); ``` -To adopt Aurora I/O-Optimized. Specify `DBClusterStorageType.AURORA_IOPT1` on the `storageType` property. +To adopt Aurora I/O-Optimized, specify `DBClusterStorageType.AURORA_IOPT1` on the `storageType` property. ```ts declare const vpc: ec2.Vpc; const cluster = new rds.DatabaseCluster(this, 'Database', { engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_15_2 }), credentials: rds.Credentials.fromUsername('adminuser', { password: SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6') }), - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.X2G, ec2.InstanceSize.XLARGE), - vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, - vpc, - }, + writer: rds.ClusterInstance.provisioned('writer', { + publiclyAccessible: false, + }), + readers: [ + rds.ClusterInstance.provisioned('reader') + ], storageType: rds.DBClusterStorageType.AURORA_IOPT1, + vpcSubnets: { + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, + vpc, }); ``` @@ -220,7 +225,7 @@ scaled to handle the write load. ```ts declare const vpc: ec2.Vpc; const cluster = new rds.DatabaseCluster(this, 'Database', { - engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }), + engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_3_01_0 }), writer: rds.ClusterInstance.serverlessV2('writer'), readers: [ // will be put in promotion tier 1 and will scale with the writer @@ -269,7 +274,7 @@ a higher minimum capacity. ```ts declare const vpc: ec2.Vpc; const cluster = new rds.DatabaseCluster(this, 'Database', { - engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }), + engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_3_01_0 }), writer: rds.ClusterInstance.provisioned('writer', { instanceType: ec2.InstanceType.of(ec2.InstanceClass.R6G, ec2.InstanceSize.XLARGE4), }),