Skip to content

Commit d39e835

Browse files
authored
fix(rds): clusterScailabilityType is spelled wrong and should be clusterScalabilityType (#32825)
### Issue #32415 Closes #32415 . ### Reason for this change Misspelling of the `ClusterScalabilityType` type, enum, and prop. ### Description of changes Deprecated misspellings of **ClusterScailabilityType**/**clusterScailabilityType** and aliased the misspelling for backwards compatibility. The misspelled name will be removed in the next MV release. ### Describe any new or updated permissions being added No permissions changes. ### Description of how you validated changes Added unit tests for the new spelling (ClusterScalabilityType/clusterScalabilityType), and kept unit tests that tested the misspelling. ```zsh # in packages/aws-cdk-lib yarn test aws-rds ``` <img width="822" alt="Screenshot 2025-01-09 at 16 10 04" src="https://github.com/user-attachments/assets/9626a0c1-0a5f-45fb-a052-1b1697a5fbdd" /> Ran the relevant integration test. ```zsh # in packages/@aws-cdk-testing/framework-integ yarn integ test/aws-rds/test/integ.cluster-limitless.js ``` <img width="916" alt="Screenshot 2025-01-09 at 17 03 44" src="https://github.com/user-attachments/assets/0ed33a38-f6d8-44ee-a210-81e37af5439f" /> Ran Rosetta to verify README changes. ```zsh ./scripts/run-rosetta.sh ``` No complications from README changes in these commits. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent c3ff821 commit d39e835

File tree

3 files changed

+69
-8
lines changed

3 files changed

+69
-8
lines changed

packages/aws-cdk-lib/aws-rds/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,7 @@ new rds.DatabaseCluster(this, 'LimitlessDatabaseCluster', {
14361436
version: rds.AuroraPostgresEngineVersion.VER_16_4_LIMITLESS,
14371437
}),
14381438
vpc,
1439-
clusterScailabilityType: rds.ClusterScailabilityType.LIMITLESS,
1439+
clusterScalabilityType: rds.ClusterScalabilityType.LIMITLESS,
14401440
// Requires enabling Performance Insights
14411441
enablePerformanceInsights: true,
14421442
performanceInsightRetention: rds.PerformanceInsightRetention.MONTHS_1,

packages/aws-cdk-lib/aws-rds/lib/cluster.ts

+36-3
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,17 @@ interface DatabaseClusterBaseProps {
450450
*
451451
* Set LIMITLESS if you want to use a limitless database; otherwise, set it to STANDARD.
452452
*
453+
* @default ClusterScalabilityType.STANDARD
454+
*/
455+
readonly clusterScalabilityType?: ClusterScalabilityType;
456+
457+
/**
458+
* [Misspelled] Specifies the scalability mode of the Aurora DB cluster.
459+
*
460+
* Set LIMITLESS if you want to use a limitless database; otherwise, set it to STANDARD.
461+
*
453462
* @default ClusterScailabilityType.STANDARD
463+
* @deprecated Use clusterScalabilityType instead. This will be removed in the next major version.
454464
*/
455465
readonly clusterScailabilityType?: ClusterScailabilityType;
456466
}
@@ -492,6 +502,25 @@ export enum InstanceUpdateBehaviour {
492502
/**
493503
* The scalability mode of the Aurora DB cluster.
494504
*/
505+
export enum ClusterScalabilityType {
506+
/**
507+
* The cluster uses normal DB instance creation.
508+
*/
509+
STANDARD = 'standard',
510+
511+
/**
512+
* The cluster operates as an Aurora Limitless Database,
513+
* allowing you to create a DB shard group for horizontal scaling (sharding) capabilities.
514+
*
515+
* @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/limitless.html
516+
*/
517+
LIMITLESS = 'limitless',
518+
}
519+
520+
/**
521+
* The scalability mode of the Aurora DB cluster.
522+
* @deprecated Use ClusterScalabilityType instead. This will be removed in the next major version.
523+
*/
495524
export enum ClusterScailabilityType {
496525
/**
497526
* The cluster uses normal DB instance creation.
@@ -701,6 +730,10 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase {
701730
constructor(scope: Construct, id: string, props: DatabaseClusterBaseProps) {
702731
super(scope, id);
703732

733+
if (props.clusterScalabilityType !== undefined && props.clusterScailabilityType !== undefined) {
734+
throw new Error('You cannot specify both clusterScalabilityType and clusterScailabilityType (deprecated). Use clusterScalabilityType.');
735+
}
736+
704737
if ((props.vpc && props.instanceProps?.vpc) || (!props.vpc && !props.instanceProps?.vpc)) {
705738
throw new Error('Provide either vpc or instanceProps.vpc, but not both');
706739
}
@@ -802,7 +835,7 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase {
802835
throw new Error('`enablePerformanceInsights` disabled, but `performanceInsightRetention` or `performanceInsightEncryptionKey` was set');
803836
}
804837

805-
if (props.clusterScailabilityType === ClusterScailabilityType.LIMITLESS) {
838+
if (props.clusterScalabilityType === ClusterScalabilityType.LIMITLESS || props.clusterScailabilityType === ClusterScailabilityType.LIMITLESS) {
806839
if (!props.enablePerformanceInsights) {
807840
throw new Error('Performance Insights must be enabled for Aurora Limitless Database.');
808841
}
@@ -877,7 +910,7 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase {
877910
}),
878911
storageType: props.storageType?.toString(),
879912
enableLocalWriteForwarding: props.enableLocalWriteForwarding,
880-
clusterScalabilityType: props.clusterScailabilityType,
913+
clusterScalabilityType: props.clusterScalabilityType ?? props.clusterScailabilityType,
881914
// Admin
882915
backtrackWindow: props.backtrackWindow?.toSeconds(),
883916
backupRetentionPeriod: props.backup?.retention?.toDays(),
@@ -1287,7 +1320,7 @@ export class DatabaseCluster extends DatabaseClusterNew {
12871320
setLogRetention(this, props);
12881321

12891322
// create the instances for only standard aurora clusters
1290-
if (props.clusterScailabilityType !== ClusterScailabilityType.LIMITLESS) {
1323+
if (props.clusterScalabilityType !== ClusterScalabilityType.LIMITLESS && props.clusterScailabilityType !== ClusterScailabilityType.LIMITLESS) {
12911324
if ((props.writer || props.readers) && (props.instances || props.instanceProps)) {
12921325
throw new Error('Cannot provide writer or readers if instances or instanceProps are provided');
12931326
}

packages/aws-cdk-lib/aws-rds/test/cluster.test.ts

+32-4
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,34 @@ import {
1717
DatabaseClusterEngine, DatabaseClusterFromSnapshot, ParameterGroup, PerformanceInsightRetention, SubnetGroup, DatabaseSecret,
1818
DatabaseInstanceEngine, SqlServerEngineVersion, SnapshotCredentials, InstanceUpdateBehaviour, NetworkType, ClusterInstance, CaCertificate,
1919
IClusterEngine,
20+
ClusterScalabilityType,
2021
ClusterScailabilityType,
2122
DBClusterStorageType,
2223
} from '../lib';
2324

2425
describe('cluster new api', () => {
2526
describe('errors are thrown', () => {
27+
test('when both clusterScalabilityType and clusterScailabilityType (deprecated) props are provided', () => {
28+
// GIVEN
29+
const stack = testStack();
30+
const vpc = new ec2.Vpc(stack, 'VPC');
31+
32+
expect(() => {
33+
// WHEN
34+
new DatabaseCluster(stack, 'Database', {
35+
engine: DatabaseClusterEngine.AURORA_MYSQL,
36+
instanceProps: {
37+
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL),
38+
vpc,
39+
},
40+
clusterScalabilityType: ClusterScalabilityType.STANDARD,
41+
clusterScailabilityType: ClusterScailabilityType.STANDARD,
42+
iamAuthentication: true,
43+
});
44+
// THEN
45+
}).toThrow('You cannot specify both clusterScalabilityType and clusterScailabilityType (deprecated). Use clusterScalabilityType.');
46+
});
47+
2648
test('when old and new props are provided', () => {
2749
// GIVEN
2850
const stack = testStack();
@@ -165,7 +187,10 @@ describe('cluster new api', () => {
165187
});
166188
});
167189

168-
test('cluster scalability option', () => {
190+
test.each([
191+
['clusterScalabilityType', 'clusterScalabilityType', ClusterScalabilityType.STANDARD],
192+
['clusterScailabilityType (deprecated)', 'clusterScailabilityType', ClusterScailabilityType.STANDARD],
193+
])('cluster scalability option with %s', (_, propName, propValue) => {
169194
// GIVEN
170195
const stack = testStack();
171196
const vpc = new ec2.Vpc(stack, 'VPC');
@@ -174,8 +199,8 @@ describe('cluster new api', () => {
174199
new DatabaseCluster(stack, 'Cluster', {
175200
engine: DatabaseClusterEngine.AURORA_MYSQL,
176201
vpc,
177-
clusterScailabilityType: ClusterScailabilityType.STANDARD,
178202
writer: ClusterInstance.serverlessV2('writer'),
203+
[propName]: propValue,
179204
});
180205

181206
// THEN
@@ -186,7 +211,10 @@ describe('cluster new api', () => {
186211
});
187212

188213
describe('limitless database', () => {
189-
test('with default options', () => {
214+
test.each([
215+
['clusterScalabilityType', 'clusterScalabilityType', ClusterScalabilityType.LIMITLESS],
216+
['clusterScailabilityType (deprecated)', 'clusterScailabilityType', ClusterScailabilityType.LIMITLESS],
217+
])('with default options using %s', (_, propName, propValue) => {
190218
// GIVEN
191219
const stack = testStack();
192220
const vpc = new ec2.Vpc(stack, 'VPC');
@@ -197,7 +225,7 @@ describe('cluster new api', () => {
197225
version: AuroraPostgresEngineVersion.VER_16_4_LIMITLESS,
198226
}),
199227
vpc,
200-
clusterScailabilityType: ClusterScailabilityType.LIMITLESS,
228+
[propName]: propValue,
201229
enablePerformanceInsights: true,
202230
performanceInsightRetention: PerformanceInsightRetention.MONTHS_1,
203231
monitoringInterval: cdk.Duration.minutes(1),

0 commit comments

Comments
 (0)