Skip to content

Commit 6036d99

Browse files
feat(fsx): add support for FSx Lustre Persistent_2 deployment type (#18626)
FSx Lustre released support for a new deployment type "Persistent_2" at re:Invent 2021. It provides long term storage with higher throughput tiers (125, 250, 500, 1000 MiB/s/TiB). See https://docs.aws.amazon.com/fsx/latest/LustreGuide/using-fsx-lustre.html for more details. As part of this commit, we want to add support for this new deployment type in LustreDeploymentType enum. This will allow customers to create FSx Lustre file systems by specifying this new deployment type. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent bdeb8eb commit 6036d99

File tree

2 files changed

+83
-9
lines changed

2 files changed

+83
-9
lines changed

Diff for: packages/@aws-cdk/aws-fsx/lib/lustre-file-system.ts

+18-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ export enum LustreDeploymentType {
2121
/**
2222
* Long term storage. Data is replicated and file servers are replaced if they fail.
2323
*/
24-
PERSISTENT_1 = 'PERSISTENT_1'
24+
PERSISTENT_1 = 'PERSISTENT_1',
25+
/**
26+
* Newer type of long term storage with higher throughput tiers.
27+
* Data is replicated and file servers are replaced if they fail.
28+
*/
29+
PERSISTENT_2 = 'PERSISTENT_2',
2530
}
2631

2732
/**
@@ -276,12 +281,20 @@ export class LustreFileSystem extends FileSystemBase {
276281
private validatePerUnitStorageThroughput(deploymentType: LustreDeploymentType, perUnitStorageThroughput?: number) {
277282
if (perUnitStorageThroughput === undefined) { return; }
278283

279-
if (deploymentType !== LustreDeploymentType.PERSISTENT_1) {
280-
throw new Error('perUnitStorageThroughput can only be set for the PERSISTENT_1 deployment type');
284+
if (deploymentType !== LustreDeploymentType.PERSISTENT_1 && deploymentType !== LustreDeploymentType.PERSISTENT_2) {
285+
throw new Error('perUnitStorageThroughput can only be set for the PERSISTENT_1/PERSISTENT_2 deployment types, received: ' + deploymentType);
286+
}
287+
288+
if (deploymentType === LustreDeploymentType.PERSISTENT_1) {
289+
if (![50, 100, 200].includes(perUnitStorageThroughput)) {
290+
throw new Error('perUnitStorageThroughput must be 50, 100, or 200 MB/s/TiB for PERSISTENT_1 deployment type, got: ' + perUnitStorageThroughput);
291+
}
281292
}
282293

283-
if (![50, 100, 200].includes(perUnitStorageThroughput)) {
284-
throw new Error('perUnitStorageThroughput must be 50, 100, or 200 MB/s/TiB');
294+
if (deploymentType === LustreDeploymentType.PERSISTENT_2) {
295+
if (![125, 250, 500, 1000].includes(perUnitStorageThroughput)) {
296+
throw new Error('perUnitStorageThroughput must be 125, 250, 500 or 1000 MB/s/TiB for PERSISTENT_2 deployment type, got: ' + perUnitStorageThroughput);
297+
}
285298
}
286299
}
287300

Diff for: packages/@aws-cdk/aws-fsx/test/lustre-file-system.test.ts

+65-4
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,16 @@ describe('FSx for Lustre File System', () => {
436436
});
437437
});
438438

439-
test('invalid perUnitStorageThroughput', () => {
439+
test.each([
440+
1,
441+
125,
442+
250,
443+
500,
444+
1000,
445+
])('invalid perUnitStorageThroughput', (invalidValue: number) => {
440446
lustreConfiguration = {
441447
deploymentType: LustreDeploymentType.PERSISTENT_1,
442-
perUnitStorageThroughput: 1,
448+
perUnitStorageThroughput: invalidValue,
443449
};
444450

445451
expect(() => {
@@ -449,7 +455,7 @@ describe('FSx for Lustre File System', () => {
449455
vpc,
450456
vpcSubnet,
451457
});
452-
}).toThrowError('perUnitStorageThroughput must be 50, 100, or 200 MB/s/TiB');
458+
}).toThrowError('perUnitStorageThroughput must be 50, 100, or 200 MB/s/TiB for PERSISTENT_1 deployment type, got: ' + invalidValue);
453459
});
454460

455461
test('setting perUnitStorageThroughput on wrong deploymentType', () => {
@@ -465,7 +471,57 @@ describe('FSx for Lustre File System', () => {
465471
vpc,
466472
vpcSubnet,
467473
});
468-
}).toThrowError('perUnitStorageThroughput can only be set for the PERSISTENT_1 deployment type');
474+
}).toThrowError('perUnitStorageThroughput can only be set for the PERSISTENT_1/PERSISTENT_2 deployment types');
475+
});
476+
});
477+
478+
describe('perUnitStorageThroughput_Persistent_2', () => {
479+
test.each([
480+
125,
481+
250,
482+
500,
483+
1000,
484+
])('valid perUnitStorageThroughput of %d', (throughput: number) => {
485+
lustreConfiguration = {
486+
deploymentType: LustreDeploymentType.PERSISTENT_2,
487+
perUnitStorageThroughput: throughput,
488+
};
489+
490+
new LustreFileSystem(stack, 'FsxFileSystem', {
491+
lustreConfiguration,
492+
storageCapacityGiB: storageCapacity,
493+
vpc,
494+
vpcSubnet,
495+
});
496+
497+
Template.fromStack(stack).hasResourceProperties('AWS::FSx::FileSystem', {
498+
LustreConfiguration: {
499+
DeploymentType: LustreDeploymentType.PERSISTENT_2,
500+
PerUnitStorageThroughput: throughput,
501+
},
502+
});
503+
});
504+
505+
test.each([
506+
1,
507+
50,
508+
100,
509+
200,
510+
550,
511+
])('invalid perUnitStorageThroughput', (invalidValue: number) => {
512+
lustreConfiguration = {
513+
deploymentType: LustreDeploymentType.PERSISTENT_2,
514+
perUnitStorageThroughput: invalidValue,
515+
};
516+
517+
expect(() => {
518+
new LustreFileSystem(stack, 'FsxFileSystem', {
519+
lustreConfiguration,
520+
storageCapacityGiB: storageCapacity,
521+
vpc,
522+
vpcSubnet,
523+
});
524+
}).toThrowError('perUnitStorageThroughput must be 125, 250, 500 or 1000 MB/s/TiB for PERSISTENT_2 deployment type, got: ' + invalidValue);
469525
});
470526
});
471527

@@ -477,6 +533,9 @@ describe('FSx for Lustre File System', () => {
477533
[1200, LustreDeploymentType.PERSISTENT_1],
478534
[2400, LustreDeploymentType.PERSISTENT_1],
479535
[4800, LustreDeploymentType.PERSISTENT_1],
536+
[1200, LustreDeploymentType.PERSISTENT_2],
537+
[2400, LustreDeploymentType.PERSISTENT_2],
538+
[4800, LustreDeploymentType.PERSISTENT_2],
480539
])('proper multiple for storage capacity of %d on %s', (value: number, deploymentType: LustreDeploymentType) => {
481540
lustreConfiguration = {
482541
deploymentType,
@@ -502,6 +561,8 @@ describe('FSx for Lustre File System', () => {
502561
[2401, LustreDeploymentType.SCRATCH_2],
503562
[1, LustreDeploymentType.PERSISTENT_1],
504563
[2401, LustreDeploymentType.PERSISTENT_1],
564+
[1, LustreDeploymentType.PERSISTENT_2],
565+
[2401, LustreDeploymentType.PERSISTENT_2],
505566
])('invalid value of %d for storage capacity on %s', (invalidValue: number, deploymentType: LustreDeploymentType) => {
506567
lustreConfiguration = {
507568
deploymentType,

0 commit comments

Comments
 (0)