Skip to content

Commit

Permalink
feat(fsx): add support for FSx Lustre Persistent_2 deployment type (#…
Browse files Browse the repository at this point in the history
…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*
  • Loading branch information
siddharthsalot authored Feb 2, 2022
1 parent bdeb8eb commit 6036d99
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 9 deletions.
23 changes: 18 additions & 5 deletions packages/@aws-cdk/aws-fsx/lib/lustre-file-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ export enum LustreDeploymentType {
/**
* Long term storage. Data is replicated and file servers are replaced if they fail.
*/
PERSISTENT_1 = 'PERSISTENT_1'
PERSISTENT_1 = 'PERSISTENT_1',
/**
* Newer type of long term storage with higher throughput tiers.
* Data is replicated and file servers are replaced if they fail.
*/
PERSISTENT_2 = 'PERSISTENT_2',
}

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

if (deploymentType !== LustreDeploymentType.PERSISTENT_1) {
throw new Error('perUnitStorageThroughput can only be set for the PERSISTENT_1 deployment type');
if (deploymentType !== LustreDeploymentType.PERSISTENT_1 && deploymentType !== LustreDeploymentType.PERSISTENT_2) {
throw new Error('perUnitStorageThroughput can only be set for the PERSISTENT_1/PERSISTENT_2 deployment types, received: ' + deploymentType);
}

if (deploymentType === LustreDeploymentType.PERSISTENT_1) {
if (![50, 100, 200].includes(perUnitStorageThroughput)) {
throw new Error('perUnitStorageThroughput must be 50, 100, or 200 MB/s/TiB for PERSISTENT_1 deployment type, got: ' + perUnitStorageThroughput);
}
}

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

Expand Down
69 changes: 65 additions & 4 deletions packages/@aws-cdk/aws-fsx/test/lustre-file-system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,16 @@ describe('FSx for Lustre File System', () => {
});
});

test('invalid perUnitStorageThroughput', () => {
test.each([
1,
125,
250,
500,
1000,
])('invalid perUnitStorageThroughput', (invalidValue: number) => {
lustreConfiguration = {
deploymentType: LustreDeploymentType.PERSISTENT_1,
perUnitStorageThroughput: 1,
perUnitStorageThroughput: invalidValue,
};

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

test('setting perUnitStorageThroughput on wrong deploymentType', () => {
Expand All @@ -465,7 +471,57 @@ describe('FSx for Lustre File System', () => {
vpc,
vpcSubnet,
});
}).toThrowError('perUnitStorageThroughput can only be set for the PERSISTENT_1 deployment type');
}).toThrowError('perUnitStorageThroughput can only be set for the PERSISTENT_1/PERSISTENT_2 deployment types');
});
});

describe('perUnitStorageThroughput_Persistent_2', () => {
test.each([
125,
250,
500,
1000,
])('valid perUnitStorageThroughput of %d', (throughput: number) => {
lustreConfiguration = {
deploymentType: LustreDeploymentType.PERSISTENT_2,
perUnitStorageThroughput: throughput,
};

new LustreFileSystem(stack, 'FsxFileSystem', {
lustreConfiguration,
storageCapacityGiB: storageCapacity,
vpc,
vpcSubnet,
});

Template.fromStack(stack).hasResourceProperties('AWS::FSx::FileSystem', {
LustreConfiguration: {
DeploymentType: LustreDeploymentType.PERSISTENT_2,
PerUnitStorageThroughput: throughput,
},
});
});

test.each([
1,
50,
100,
200,
550,
])('invalid perUnitStorageThroughput', (invalidValue: number) => {
lustreConfiguration = {
deploymentType: LustreDeploymentType.PERSISTENT_2,
perUnitStorageThroughput: invalidValue,
};

expect(() => {
new LustreFileSystem(stack, 'FsxFileSystem', {
lustreConfiguration,
storageCapacityGiB: storageCapacity,
vpc,
vpcSubnet,
});
}).toThrowError('perUnitStorageThroughput must be 125, 250, 500 or 1000 MB/s/TiB for PERSISTENT_2 deployment type, got: ' + invalidValue);
});
});

Expand All @@ -477,6 +533,9 @@ describe('FSx for Lustre File System', () => {
[1200, LustreDeploymentType.PERSISTENT_1],
[2400, LustreDeploymentType.PERSISTENT_1],
[4800, LustreDeploymentType.PERSISTENT_1],
[1200, LustreDeploymentType.PERSISTENT_2],
[2400, LustreDeploymentType.PERSISTENT_2],
[4800, LustreDeploymentType.PERSISTENT_2],
])('proper multiple for storage capacity of %d on %s', (value: number, deploymentType: LustreDeploymentType) => {
lustreConfiguration = {
deploymentType,
Expand All @@ -502,6 +561,8 @@ describe('FSx for Lustre File System', () => {
[2401, LustreDeploymentType.SCRATCH_2],
[1, LustreDeploymentType.PERSISTENT_1],
[2401, LustreDeploymentType.PERSISTENT_1],
[1, LustreDeploymentType.PERSISTENT_2],
[2401, LustreDeploymentType.PERSISTENT_2],
])('invalid value of %d for storage capacity on %s', (invalidValue: number, deploymentType: LustreDeploymentType) => {
lustreConfiguration = {
deploymentType,
Expand Down

0 comments on commit 6036d99

Please sign in to comment.