Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fsx): support AutoImportPolicy in LustreFilesystem #21301

Merged
merged 22 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
39ec4cf
Added support for AutoImportPolicy in LustreConfiguration
Jul 23, 2022
49a407d
Added integration test for autoImportPolicy
Jul 23, 2022
bda5dca
Merge branch 'main' into LustreAutoImportPolicy
tcutts Jul 23, 2022
777602b
Merge branch 'main' into LustreAutoImportPolicy
tcutts Jul 24, 2022
e62d27f
chore(deps): Bump awscli from 1.25.31 to 1.25.36 in /packages/@aws-cd…
dependabot[bot] Jul 25, 2022
cb92055
chore(cli): add integ test for asset bundling in a stage (#21294)
corymhall Jul 25, 2022
59f9fdf
fix(pkglint): allow dependencies on L1 only modules (#21208)
comcalvi Jul 25, 2022
13e1ebe
feat(api-gateway): allow configuration of deployment description (#21…
josephedward Jul 25, 2022
e93a31c
fix(ecs-patterns): memory limit is not set at the container level (#2…
gnagy Jul 25, 2022
cb732fc
feat(cfnspec): cloudformation spec v81.1.0 (#21307)
aws-cdk-automation Jul 26, 2022
c4fc41d
fix(ecs): firelens configFileValue is unnecessarily required (#20636)
PettitWesley Jul 26, 2022
db9edfa
fix(cli): large context causes E2BIG error during synthesis on Linux …
otaviomacedo Jul 27, 2022
c473fba
Revert "fix(cli): large context causes E2BIG error during synthesis o…
RomainMuller Jul 27, 2022
fe9c5e4
chore: npm-check-updates && yarn upgrade (#21340)
aws-cdk-automation Jul 27, 2022
f294922
fix(bootstrap): remove image scanning configuration (#21342)
rix0rrr Jul 27, 2022
95a8457
fix(aws-lambda): FunctionUrl incorrectly uses Alias ARNs (#21353)
RomainMuller Jul 28, 2022
bcb370a
chore: fixup cli THIRD_PARTY_LICENSES (#21355)
RomainMuller Jul 28, 2022
be3941a
feat(core): cache fingerprints of large assets (#21321)
bdonlan Jul 28, 2022
a497152
feat(config): add support for eks-cluster-xxx-version managed rule (#…
watany-dev Jul 28, 2022
ee78e22
fix(ecs): new arn format not supported (under feature flag) (#18140)
jumic Jul 28, 2022
ab5900e
doc: Description and example for AutoImportPolicy
Jul 28, 2022
748b959
Merge branch 'main' into LustreAutoImportPolicy
tcutts Jul 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions packages/@aws-cdk/aws-fsx/lib/lustre-file-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ export enum LustreDeploymentType {
*/
PERSISTENT_2 = 'PERSISTENT_2',
}
/**
* The different auto import policies which are allowed
*/
export enum LustreAutoImportPolicy {
/**
* AutoImport is off. Amazon FSx only updates file and directory listings from the linked S3 bucket when the file system is created. FSx does not update file and directory listings for any new or changed objects after choosing this option.
*/
NONE = 'NONE',
/**
* AutoImport is on. Amazon FSx automatically imports directory listings of any new objects added to the linked S3 bucket that do not currently exist in the FSx file system.
*/
NEW = 'NEW',
/**
* AutoImport is on. Amazon FSx automatically imports file and directory listings of any new objects added to the S3 bucket and any existing objects that are changed in the S3 bucket after you choose this option.
*/
NEW_CHANGED = 'NEW_CHANGED',
/**
* AutoImport is on. Amazon FSx automatically imports file and directory listings of any new objects added to the S3 bucket, any existing objects that are changed in the S3 bucket, and any objects that were deleted in the S3 bucket.
* */
NEW_CHANGED_DELETED = 'NEW_CHANGED_DELETED',
}

/**
* The configuration for the Amazon FSx for Lustre file system.
Expand Down Expand Up @@ -69,6 +90,18 @@ export interface LustreConfiguration {
*/
readonly importPath?: string;

/**
* Available with `Scratch` and `Persistent_1` deployment types. When you create your file system, your existing S3 objects appear as file and directory listings. Use this property to choose how Amazon FSx keeps your file and directory listings up to date as you add or modify objects in your linked S3 bucket. `AutoImportPolicy` can have the following values:
*
* For more information, see [Automatically import updates from your S3 bucket](https://docs.aws.amazon.com/fsx/latest/LustreGuide/autoimport-data-repo.html) .
*
* > This parameter is not supported for Lustre file systems using the `Persistent_2` deployment type.
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-fsx-filesystem-lustreconfiguration.html#cfn-fsx-filesystem-lustreconfiguration-autoimportpolicy
* @default - no import policy
*/
readonly autoImportPolicy?: LustreAutoImportPolicy;

/**
* Required for the PERSISTENT_1 deployment type, describes the amount of read and write throughput for each 1
* tebibyte of storage, in MB/s/TiB. Valid values are 50, 100, 200.
Expand Down Expand Up @@ -222,10 +255,25 @@ export class LustreFileSystem extends FileSystemBase {
this.validateExportPath(lustreConfiguration.exportPath, lustreConfiguration.importPath);

this.validateImportedFileChunkSize(lustreConfiguration.importedFileChunkSizeMiB);
this.validateAutoImportPolicy(deploymentType, lustreConfiguration.importPath, lustreConfiguration.autoImportPolicy);
this.validatePerUnitStorageThroughput(deploymentType, lustreConfiguration.perUnitStorageThroughput);
this.validateStorageCapacity(deploymentType, props.storageCapacityGiB);
}

/**
* Validates the auto import policy
*/

private validateAutoImportPolicy(deploymentType: LustreDeploymentType, importPath?: string, autoImportPolicy?: LustreAutoImportPolicy): void {
if (autoImportPolicy === undefined) { return; }
if (importPath === undefined) {
throw new Error('autoImportPolicy requires importPath to be defined');
}
if (deploymentType === LustreDeploymentType.PERSISTENT_2) {
throw new Error('autoImportPolicy is not supported with PERSISTENT_2 deployments');
}
}

/**
* Validates the export path is in the correct format and matches the import path.
*/
Expand Down
5 changes: 4 additions & 1 deletion packages/@aws-cdk/aws-fsx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,22 @@
"devDependencies": {
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/integ-runner": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/integ-runner": "0.0.0",
"@aws-cdk/integ-tests": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.5.2"
},
"dependencies": {
"@aws-cdk/aws-s3": "0.0.0",
"@aws-cdk/aws-ec2": "0.0.0",
"@aws-cdk/aws-iam": "0.0.0",
"@aws-cdk/aws-kms": "0.0.0",
"@aws-cdk/core": "0.0.0",
"constructs": "^10.0.0"
},
"peerDependencies": {
"@aws-cdk/aws-s3": "0.0.0",
"@aws-cdk/aws-ec2": "0.0.0",
"@aws-cdk/aws-iam": "0.0.0",
"@aws-cdk/aws-kms": "0.0.0",
Expand Down
36 changes: 36 additions & 0 deletions packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as ec2 from '@aws-cdk/aws-ec2';
import * as s3 from '@aws-cdk/aws-s3';
import { App, RemovalPolicy, Stack } from '@aws-cdk/core';
import * as integ from '@aws-cdk/integ-tests';
import * as fsx from '../lib';

const app = new App();

const stack = new Stack(app, 'AwsCdkFsxLustre');

const vpc = new ec2.Vpc(stack, 'VPC');

const bucket = new s3.Bucket(stack, 'ImportBucket', {
removalPolicy: RemovalPolicy.DESTROY,
});

const storageCapacity = 1200;
const lustreConfiguration = {
deploymentType: fsx.LustreDeploymentType.SCRATCH_2,
importPath: bucket.s3UrlForObject(),
autoImportPolicy: fsx.LustreAutoImportPolicy.NEW_CHANGED_DELETED,
};

new fsx.LustreFileSystem(stack, 'FsxLustreFileSystem', {
lustreConfiguration,
storageCapacityGiB: storageCapacity,
vpc,
vpcSubnet: vpc.privateSubnets[0],
removalPolicy: RemovalPolicy.DESTROY,
});

new integ.IntegTest(app, 'FsxLustreWithS3Test', {
testCases: [stack],
});

app.synth();
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "20.0.0",
"files": {
"e5c2880bdb5feb3722b4fec17f3f9cfbe63b27acf4cf4ef5534d672ad6765484": {
"source": {
"path": "AwsCdkFsxLustre.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "e5c2880bdb5feb3722b4fec17f3f9cfbe63b27acf4cf4ef5534d672ad6765484.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Loading