Skip to content

Commit

Permalink
docs(rds): update deprecated InstanceProps example (#27499)
Browse files Browse the repository at this point in the history
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*
  • Loading branch information
msambol authored Oct 12, 2023
1 parent 8557c40 commit b2200a8
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions packages/aws-cdk-lib/aws-rds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
});
```

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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),
}),
Expand Down

0 comments on commit b2200a8

Please sign in to comment.