Skip to content

Commit ac38516

Browse files
author
Sunil Yadav
committed
fix: replace deprecated instanceProps with writer/readers
- Use new writer and readers properties instead of deprecated instanceProps - Create writer instance and reader instances based on replicaInstances count - Move vpc, vpcSubnets, and securityGroups to cluster level - Replace instanceIdentifierBase with clusterIdentifier
1 parent 8266254 commit ac38516

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

typescript/rds/aurora/aurora.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,17 @@ export class Aurora extends Stack {
302302
retention: Duration.days(backupRetentionDays),
303303
},
304304
parameterGroup: auroraParameterGroup,
305-
instances: replicaInstances,
305+
writer: rds.ClusterInstance.provisioned('writer', {
306+
instanceType: instanceType,
307+
}),
308+
readers: Array.from({ length: replicaInstances - 1 }, (_, i) =>
309+
rds.ClusterInstance.provisioned(`reader${i + 1}`, {
310+
instanceType: instanceType,
311+
})
312+
),
313+
vpc: vpc,
314+
vpcSubnets: vpcSubnets,
315+
securityGroups: [dbsg],
306316
iamAuthentication: true,
307317
storageEncrypted: true,
308318
storageEncryptionKey: kmsKey,
@@ -312,13 +322,7 @@ export class Aurora extends Stack {
312322
cloudwatchLogsExports: cloudwatchLogsExports,
313323
cloudwatchLogsRetention: logs.RetentionDays.ONE_MONTH,
314324
preferredMaintenanceWindow: props.preferredMaintenanceWindow,
315-
instanceIdentifierBase: props.dbName,
316-
instanceProps: {
317-
instanceType: instanceType,
318-
vpcSubnets: vpcSubnets,
319-
vpc: vpc,
320-
securityGroups: [dbsg],
321-
},
325+
clusterIdentifier: props.dbName,
322326
});
323327

324328
aurora_cluster.applyRemovalPolicy(RemovalPolicy.RETAIN);
@@ -521,8 +525,8 @@ const app = new App();
521525

522526
new Aurora(app, 'AuroraStack', {
523527
env:{region:"us-east-2"}, description:"Aurora Stack",
524-
vpcId:"vpc-xxx",
525-
subnetIds:["subnet-xxx", "subnet-xxxxSS"],
528+
vpcId:"vpc-xxxxxxxxxx",
529+
subnetIds:["subnet-xxxxxx", "subnet-xxxxxx"],
526530
dbName:"sampledb",
527531
engine:"postgresql"
528532
});

0 commit comments

Comments
 (0)