I've deployed an AWS CDK RDS DatabaseCluster with the following code:
const cluster = new rds.DatabaseCluster(this, "Cluster", {
engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,
instanceProps: {
instanceType: ec2.InstanceType.of(
ec2.InstanceClass.BURSTABLE3,
ec2.InstanceSize.MEDIUM
),
vpcSubnets: {
subnetType: ec2.SubnetType.PUBLIC,
},
vpc,
},
parameterGroup: rds.ParameterGroup.fromParameterGroupName(
this,
"ParameterGroup",
"default.aurora-postgresql11"
),
storageEncrypted: true,
storageEncryptionKey: customKey,
credentials: rds.Credentials.fromGeneratedSecret("dbAdmin"),
});
After the cluster is deployed I can easily add an auto scaling policy via the web console (click the cluster and then in the top right go to "Actions" -> add replica auto scaling).
I can find no way to do this with the CDK. The only thing about scaling I can find is this https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-rds.ServerlessScalingOptions.html
But it's unclear to me how to implement this or if this is even the right one.
Has anybody done this with the CDK or can someone give me a hint on how to achieve this?