diff --git a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts index 3f09f240df96d..48521aedd2a1b 100644 --- a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts @@ -1074,8 +1074,8 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { } private validateServerlessScalingConfig(): void { - if (this.serverlessV2MaxCapacity > 256 || this.serverlessV2MaxCapacity < 0.5) { - throw new Error('serverlessV2MaxCapacity must be >= 0.5 & <= 256'); + if (this.serverlessV2MaxCapacity > 256 || this.serverlessV2MaxCapacity < 1) { + throw new Error('serverlessV2MaxCapacity must be >= 1 & <= 256'); } if (this.serverlessV2MinCapacity > 256 || this.serverlessV2MinCapacity < 0) { @@ -1086,9 +1086,6 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { throw new Error('serverlessV2MaxCapacity must be greater than serverlessV2MinCapacity'); } - if (this.serverlessV2MaxCapacity === 0.5 && this.serverlessV2MinCapacity === 0.5) { - throw new Error('If serverlessV2MinCapacity === 0.5 then serverlessV2MaxCapacity must be >=1'); - } const regexp = new RegExp(/^[0-9]+\.?5?$/); if (!regexp.test(this.serverlessV2MaxCapacity.toString()) || !regexp.test(this.serverlessV2MinCapacity.toString())) { throw new Error('serverlessV2MinCapacity & serverlessV2MaxCapacity must be in 0.5 step increments, received '+ diff --git a/packages/aws-cdk-lib/aws-rds/test/cluster.test.ts b/packages/aws-cdk-lib/aws-rds/test/cluster.test.ts index 8091945676ea8..56a426d9cc9ec 100644 --- a/packages/aws-cdk-lib/aws-rds/test/cluster.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/cluster.test.ts @@ -116,11 +116,10 @@ describe('cluster new api', () => { }); test.each([ - [0.5, 300, /serverlessV2MaxCapacity must be >= 0.5 & <= 256/], - [0.5, 0, /serverlessV2MaxCapacity must be >= 0.5 & <= 256/], + [0.5, 300, /serverlessV2MaxCapacity must be >= 1 & <= 256/], + [0.5, 0, /serverlessV2MaxCapacity must be >= 1 & <= 256/], [-1, 1, /serverlessV2MinCapacity must be >= 0 & <= 256/], [300, 1, /serverlessV2MinCapacity must be >= 0 & <= 256/], - [0.5, 0.5, /If serverlessV2MinCapacity === 0.5 then serverlessV2MaxCapacity must be >=1/], [10.1, 12, /serverlessV2MinCapacity & serverlessV2MaxCapacity must be in 0.5 step increments/], [12, 12.1, /serverlessV2MinCapacity & serverlessV2MaxCapacity must be in 0.5 step increments/], [5, 1, /serverlessV2MaxCapacity must be greater than serverlessV2MinCapacity/],