Skip to content
v2.273.0

Amazon FSx Construct Library ​

Amazon FSx provides fully managed third-party file systems with the native compatibility and feature sets for workloads such as Microsoft Windows–based storage, high-performance computing, machine learning, and electronic design automation.

Amazon FSx supports two file system types: Lustre and Windows File Server.

FSx for Lustre ​

Amazon FSx for Lustre makes it easy and cost-effective to launch and run the popular, high-performance Lustre file system. You use Lustre for workloads where speed matters, such as machine learning, high performance computing (HPC), video processing, and financial modeling.

The open-source Lustre file system is designed for applications that require fast storage—where you want your storage to keep up with your compute. Lustre was built to solve the problem of quickly and cheaply processing the world's ever-growing datasets. It's a widely used file system designed for the fastest computers in the world. It provides submillisecond latencies, up to hundreds of GBps of throughput, and up to millions of IOPS. For more information on Lustre, see the Lustre website.

As a fully managed service, Amazon FSx makes it easier for you to use Lustre for workloads where storage speed matters. Amazon FSx for Lustre eliminates the traditional complexity of setting up and managing Lustre file systems, enabling you to spin up and run a battle-tested high-performance file system in minutes. It also provides multiple deployment options so you can optimize cost for your needs.

Amazon FSx for Lustre is POSIX-compliant, so you can use your current Linux-based applications without having to make any changes. Amazon FSx for Lustre provides a native file system interface and works as any file system does with your Linux operating system. It also provides read-after-write consistency and supports file locking.

Installation ​

Import to your project:

ts
import * as fsx from 'aws-cdk-lib/aws-fsx';
python
import aws_cdk.aws_fsx as fsx
java
import software.amazon.awscdk.services.fsx.*;
csharp
using Amazon.CDK.AWS.FSx;
go
import fsx "github.com/aws/aws-cdk-go/awscdk"

Basic Usage ​

Setup required properties and create:

ts
declare const vpc: ec2.Vpc;

const fileSystem = new fsx.LustreFileSystem(this, 'FsxLustreFileSystem', {
  lustreConfiguration: { deploymentType: fsx.LustreDeploymentType.SCRATCH_2 },
  storageCapacityGiB: 1200,
  vpc,
  vpcSubnet: vpc.privateSubnets[0],
});
python
# vpc: ec2.Vpc


file_system = fsx.LustreFileSystem(self, "FsxLustreFileSystem",
    lustre_configuration=fsx.LustreConfiguration(deployment_type=fsx.LustreDeploymentType.SCRATCH_2),
    storage_capacity_gi_b=1200,
    vpc=vpc,
    vpc_subnet=vpc.private_subnets[0]
)
java
Vpc vpc;


LustreFileSystem fileSystem = LustreFileSystem.Builder.create(this, "FsxLustreFileSystem")
        .lustreConfiguration(LustreConfiguration.builder().deploymentType(LustreDeploymentType.SCRATCH_2).build())
        .storageCapacityGiB(1200)
        .vpc(vpc)
        .vpcSubnet(vpc.getPrivateSubnets()[0])
        .build();
csharp
Vpc vpc;


var fileSystem = new LustreFileSystem(this, "FsxLustreFileSystem", new LustreFileSystemProps {
    LustreConfiguration = new LustreConfiguration { DeploymentType = LustreDeploymentType.SCRATCH_2 },
    StorageCapacityGiB = 1200,
    Vpc = vpc,
    VpcSubnet = vpc.PrivateSubnets[0]
});
go
var vpc Vpc


fileSystem := fsx.NewLustreFileSystem(this, jsii.String("FsxLustreFileSystem"), &LustreFileSystemProps{
	LustreConfiguration: &LustreConfiguration{
		DeploymentType: fsx.LustreDeploymentType_SCRATCH_2,
	},
	StorageCapacityGiB: jsii.Number(1200),
	Vpc: Vpc,
	VpcSubnet: vpc.PrivateSubnets[jsii.Number(0)],
})

File System Type Version ​

You can set the Lustre version for the file system. To do this, use the fileSystemTypeVersion property:

ts
declare const vpc: ec2.Vpc;

const fileSystem = new fsx.LustreFileSystem(this, 'FsxLustreFileSystem', {
lustreConfiguration: { deploymentType: fsx.LustreDeploymentType.SCRATCH_2 },
  storageCapacityGiB: 1200,
  vpc,
  vpcSubnet: vpc.privateSubnets[0],
  fileSystemTypeVersion: fsx.FileSystemTypeVersion.V_2_15,
});
python
# vpc: ec2.Vpc


file_system = fsx.LustreFileSystem(self, "FsxLustreFileSystem",
    lustre_configuration=fsx.LustreConfiguration(deployment_type=fsx.LustreDeploymentType.SCRATCH_2),
    storage_capacity_gi_b=1200,
    vpc=vpc,
    vpc_subnet=vpc.private_subnets[0],
    file_system_type_version=fsx.FileSystemTypeVersion.V_2_15
)
java
Vpc vpc;


LustreFileSystem fileSystem = LustreFileSystem.Builder.create(this, "FsxLustreFileSystem")
        .lustreConfiguration(LustreConfiguration.builder().deploymentType(LustreDeploymentType.SCRATCH_2).build())
        .storageCapacityGiB(1200)
        .vpc(vpc)
        .vpcSubnet(vpc.getPrivateSubnets()[0])
        .fileSystemTypeVersion(FileSystemTypeVersion.V_2_15)
        .build();
csharp
Vpc vpc;


var fileSystem = new LustreFileSystem(this, "FsxLustreFileSystem", new LustreFileSystemProps {
    LustreConfiguration = new LustreConfiguration { DeploymentType = LustreDeploymentType.SCRATCH_2 },
    StorageCapacityGiB = 1200,
    Vpc = vpc,
    VpcSubnet = vpc.PrivateSubnets[0],
    FileSystemTypeVersion = FileSystemTypeVersion.V_2_15
});
go
var vpc Vpc


fileSystem := fsx.NewLustreFileSystem(this, jsii.String("FsxLustreFileSystem"), &LustreFileSystemProps{
	LustreConfiguration: &LustreConfiguration{
		DeploymentType: fsx.LustreDeploymentType_SCRATCH_2,
	},
	StorageCapacityGiB: jsii.Number(1200),
	Vpc: Vpc,
	VpcSubnet: vpc.PrivateSubnets[jsii.Number(0)],
	FileSystemTypeVersion: fsx.FileSystemTypeVersion_V_2_15,
})

Note: The fileSystemTypeVersion has a restrictions on the values that can be set based on the deploymentType.

  • V_2_10 is supported by the Scratch and PERSISTENT_1 deployment types.
  • V_2_12 is supported by all Lustre deployment types.
  • V_2_15 is supported by all Lustre deployment types and is recommended for all new file systems.

Note: The default value of fileSystemTypeVersion is V_2_10 except for PERSISTENT_2 deployment type where the default value is V_2_12.

Connecting ​

To control who can access the file system, use the .connections attribute. FSx has a fixed default port, so you don't need to specify the port. This example allows an EC2 instance to connect to a file system:

ts
declare const fileSystem: fsx.LustreFileSystem;
declare const instance: ec2.Instance;

fileSystem.connections.allowDefaultPortFrom(instance);
python
# file_system: fsx.LustreFileSystem
# instance: ec2.Instance


file_system.connections.allow_default_port_from(instance)
java
LustreFileSystem fileSystem;
Instance instance;


fileSystem.connections.allowDefaultPortFrom(instance);
csharp
LustreFileSystem fileSystem;
Instance instance;


fileSystem.Connections.AllowDefaultPortFrom(instance);
go
var fileSystem LustreFileSystem
var instance Instance


fileSystem.Connections.AllowDefaultPortFrom(instance)

Mounting ​

The LustreFileSystem Construct exposes both the DNS name of the file system as well as its mount name, which can be used to mount the file system on an EC2 instance. The following example shows how to bring up a file system and EC2 instance, and then use User Data to mount the file system on the instance at start-up:

ts
import * as iam from 'aws-cdk-lib/aws-iam';

declare const vpc: ec2.Vpc;
const lustreConfiguration = {
  deploymentType: fsx.LustreDeploymentType.SCRATCH_2,
};

const fs = new fsx.LustreFileSystem(this, 'FsxLustreFileSystem', {
  lustreConfiguration,
  storageCapacityGiB: 1200,
  vpc,
  vpcSubnet: vpc.privateSubnets[0],
});

const inst = new ec2.Instance(this, 'inst', {
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.LARGE),
  machineImage: new ec2.AmazonLinuxImage({
    generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
  }),
  vpc,
  vpcSubnets: {
    subnetType: ec2.SubnetType.PUBLIC,
  },
});
fs.connections.allowDefaultPortFrom(inst);

// Need to give the instance access to read information about FSx to determine the file system's mount name.
inst.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonFSxReadOnlyAccess'));

const mountPath = '/mnt/fsx';
const dnsName = fs.dnsName;
const mountName = fs.mountName;

inst.userData.addCommands(
  'set -eux',
  'yum update -y',
  'amazon-linux-extras install -y lustre2.10',
  // Set up the directory to mount the file system to and change the owner to the AL2 default ec2-user.
  `mkdir -p ${mountPath}`,
  `chmod 777 ${mountPath}`,
  `chown ec2-user:ec2-user ${mountPath}`,
  // Set the file system up to mount automatically on start up and mount it.
  `echo "${dnsName}@tcp:/${mountName} ${mountPath} lustre defaults,noatime,flock,_netdev 0 0" >> /etc/fstab`,
  'mount -a',
);
python
import aws_cdk.aws_iam as iam

# vpc: ec2.Vpc

lustre_configuration = {
    "deployment_type": fsx.LustreDeploymentType.SCRATCH_2
}

fs = fsx.LustreFileSystem(self, "FsxLustreFileSystem",
    lustre_configuration=lustre_configuration,
    storage_capacity_gi_b=1200,
    vpc=vpc,
    vpc_subnet=vpc.private_subnets[0]
)

inst = ec2.Instance(self, "inst",
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.LARGE),
    machine_image=ec2.AmazonLinuxImage(
        generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
    ),
    vpc=vpc,
    vpc_subnets=ec2.SubnetSelection(
        subnet_type=ec2.SubnetType.PUBLIC
    )
)
fs.connections.allow_default_port_from(inst)

# Need to give the instance access to read information about FSx to determine the file system's mount name.
inst.role.add_managed_policy(iam.ManagedPolicy.from_aws_managed_policy_name("AmazonFSxReadOnlyAccess"))

mount_path = "/mnt/fsx"
dns_name = fs.dns_name
mount_name = fs.mount_name

inst.user_data.add_commands("set -eux", "yum update -y", "amazon-linux-extras install -y lustre2.10", f"mkdir -p {mountPath}", f"chmod 777 {mountPath}", f"chown ec2-user:ec2-user {mountPath}", f"echo \"{dnsName}@tcp:/{mountName} {mountPath} lustre defaults,noatime,flock,_netdev 0 0\" >> /etc/fstab", "mount -a")
java
import software.amazon.awscdk.services.iam.*;

Vpc vpc;

Map<String, LustreDeploymentType> lustreConfiguration = Map.of(
        "deploymentType", LustreDeploymentType.SCRATCH_2);

LustreFileSystem fs = LustreFileSystem.Builder.create(this, "FsxLustreFileSystem")
        .lustreConfiguration(lustreConfiguration)
        .storageCapacityGiB(1200)
        .vpc(vpc)
        .vpcSubnet(vpc.getPrivateSubnets()[0])
        .build();

Instance inst = Instance.Builder.create(this, "inst")
        .instanceType(InstanceType.of(InstanceClass.T2, InstanceSize.LARGE))
        .machineImage(AmazonLinuxImage.Builder.create()
                .generation(AmazonLinuxGeneration.AMAZON_LINUX_2)
                .build())
        .vpc(vpc)
        .vpcSubnets(SubnetSelection.builder()
                .subnetType(SubnetType.PUBLIC)
                .build())
        .build();
fs.connections.allowDefaultPortFrom(inst);

// Need to give the instance access to read information about FSx to determine the file system's mount name.
inst.role.addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName("AmazonFSxReadOnlyAccess"));

String mountPath = "/mnt/fsx";
String dnsName = fs.getDnsName();
String mountName = fs.getMountName();

inst.userData.addCommands("set -eux", "yum update -y", "amazon-linux-extras install -y lustre2.10", String.format("mkdir -p %s", mountPath), String.format("chmod 777 %s", mountPath), String.format("chown ec2-user:ec2-user %s", mountPath), String.format("echo \"%s@tcp:/%s %s lustre defaults,noatime,flock,_netdev 0 0\" >> /etc/fstab", dnsName, mountName, mountPath), "mount -a");
csharp
using Amazon.CDK.AWS.IAM;

Vpc vpc;

IDictionary<string, LustreDeploymentType> lustreConfiguration = new Dictionary<string, LustreDeploymentType> {
    { "deploymentType", LustreDeploymentType.SCRATCH_2 }
};

var fs = new LustreFileSystem(this, "FsxLustreFileSystem", new LustreFileSystemProps {
    LustreConfiguration = lustreConfiguration,
    StorageCapacityGiB = 1200,
    Vpc = vpc,
    VpcSubnet = vpc.PrivateSubnets[0]
});

var inst = new Instance(this, "inst", new InstanceProps {
    InstanceType = InstanceType.Of(InstanceClass.T2, InstanceSize.LARGE),
    MachineImage = new AmazonLinuxImage(new AmazonLinuxImageProps {
        Generation = AmazonLinuxGeneration.AMAZON_LINUX_2
    }),
    Vpc = vpc,
    VpcSubnets = new SubnetSelection {
        SubnetType = SubnetType.PUBLIC
    }
});
fs.Connections.AllowDefaultPortFrom(inst);

// Need to give the instance access to read information about FSx to determine the file system's mount name.
inst.Role.AddManagedPolicy(ManagedPolicy.FromAwsManagedPolicyName("AmazonFSxReadOnlyAccess"));

var mountPath = "/mnt/fsx";
var dnsName = fs.DnsName;
var mountName = fs.MountName;

inst.UserData.AddCommands("set -eux", "yum update -y", "amazon-linux-extras install -y lustre2.10", $"mkdir -p {mountPath}", $"chmod 777 {mountPath}", $"chown ec2-user:ec2-user {mountPath}", $"echo \"{dnsName}@tcp:/{mountName} {mountPath} lustre defaults,noatime,flock,_netdev 0 0\" >> /etc/fstab", "mount -a");
go
import iam "github.com/aws/aws-cdk-go/awscdk"

var vpc Vpc

lustreConfiguration := map[string]LustreDeploymentType{
	"deploymentType": fsx.LustreDeploymentType_SCRATCH_2,
}

fs := fsx.NewLustreFileSystem(this, jsii.String("FsxLustreFileSystem"), &LustreFileSystemProps{
	LustreConfiguration: LustreConfiguration,
	StorageCapacityGiB: jsii.Number(1200),
	Vpc: Vpc,
	VpcSubnet: vpc.PrivateSubnets[jsii.Number(0)],
})

inst := ec2.NewInstance(this, jsii.String("inst"), &InstanceProps{
	InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_T2, ec2.InstanceSize_LARGE),
	MachineImage: ec2.NewAmazonLinuxImage(&AmazonLinuxImageProps{
		Generation: ec2.AmazonLinuxGeneration_AMAZON_LINUX_2,
	}),
	Vpc: Vpc,
	VpcSubnets: &SubnetSelection{
		SubnetType: ec2.SubnetType_PUBLIC,
	},
})
fs.Connections.AllowDefaultPortFrom(inst)

// Need to give the instance access to read information about FSx to determine the file system's mount name.
inst.Role.AddManagedPolicy(iam.ManagedPolicy_FromAwsManagedPolicyName(jsii.String("AmazonFSxReadOnlyAccess")))

mountPath := "/mnt/fsx"
dnsName := fs.DnsName
mountName := fs.MountName

inst.UserData.AddCommands(jsii.String("set -eux"), jsii.String("yum update -y"), jsii.String("amazon-linux-extras install -y lustre2.10"),
// Set up the directory to mount the file system to and change the owner to the AL2 default ec2-user.
fmt.Sprintf("mkdir -p %v", mountPath),
fmt.Sprintf("chmod 777 %v", mountPath),
fmt.Sprintf("chown ec2-user:ec2-user %v", mountPath),
// Set the file system up to mount automatically on start up and mount it.
fmt.Sprintf("echo \"%v@tcp:/%v %v lustre defaults,noatime,flock,_netdev 0 0\" >> /etc/fstab", dnsName, mountName, mountPath), jsii.String("mount -a"))

Importing an existing Lustre filesystem ​

An FSx for Lustre file system can be imported with fromLustreFileSystemAttributes(this, id, attributes). The following example lays out how you could import the SecurityGroup a file system belongs to, use that to import the file system, and then also import the VPC the file system is in and add an EC2 instance to it, giving it access to the file system.

ts
const sg = ec2.SecurityGroup.fromSecurityGroupId(this, 'FsxSecurityGroup', '{SECURITY-GROUP-ID}');
const fs = fsx.LustreFileSystem.fromLustreFileSystemAttributes(this, 'FsxLustreFileSystem', {
  dnsName: '{FILE-SYSTEM-DNS-NAME}',
  fileSystemId: '{FILE-SYSTEM-ID}',
  securityGroup: sg,
});

const vpc = ec2.Vpc.fromVpcAttributes(this, 'Vpc', {
  availabilityZones: ['us-west-2a', 'us-west-2b'],
  publicSubnetIds: ['{US-WEST-2A-SUBNET-ID}', '{US-WEST-2B-SUBNET-ID}'],
  vpcId: '{VPC-ID}',
});

const inst = new ec2.Instance(this, 'inst', {
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.LARGE),
  machineImage: new ec2.AmazonLinuxImage({
    generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
  }),
  vpc,
  vpcSubnets: {
    subnetType: ec2.SubnetType.PUBLIC,
  },
});

fs.connections.allowDefaultPortFrom(inst);
python
sg = ec2.SecurityGroup.from_security_group_id(self, "FsxSecurityGroup", "{SECURITY-GROUP-ID}")
fs = fsx.LustreFileSystem.from_lustre_file_system_attributes(self, "FsxLustreFileSystem",
    dns_name="{FILE-SYSTEM-DNS-NAME}",
    file_system_id="{FILE-SYSTEM-ID}",
    security_group=sg
)

vpc = ec2.Vpc.from_vpc_attributes(self, "Vpc",
    availability_zones=["us-west-2a", "us-west-2b"],
    public_subnet_ids=["{US-WEST-2A-SUBNET-ID}", "{US-WEST-2B-SUBNET-ID}"],
    vpc_id="{VPC-ID}"
)

inst = ec2.Instance(self, "inst",
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.LARGE),
    machine_image=ec2.AmazonLinuxImage(
        generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
    ),
    vpc=vpc,
    vpc_subnets=ec2.SubnetSelection(
        subnet_type=ec2.SubnetType.PUBLIC
    )
)

fs.connections.allow_default_port_from(inst)
java
ISecurityGroup sg = SecurityGroup.fromSecurityGroupId(this, "FsxSecurityGroup", "{SECURITY-GROUP-ID}");
IFileSystem fs = LustreFileSystem.fromLustreFileSystemAttributes(this, "FsxLustreFileSystem", FileSystemAttributes.builder()
        .dnsName("{FILE-SYSTEM-DNS-NAME}")
        .fileSystemId("{FILE-SYSTEM-ID}")
        .securityGroup(sg)
        .build());

IVpc vpc = Vpc.fromVpcAttributes(this, "Vpc", VpcAttributes.builder()
        .availabilityZones(List.of("us-west-2a", "us-west-2b"))
        .publicSubnetIds(List.of("{US-WEST-2A-SUBNET-ID}", "{US-WEST-2B-SUBNET-ID}"))
        .vpcId("{VPC-ID}")
        .build());

Instance inst = Instance.Builder.create(this, "inst")
        .instanceType(InstanceType.of(InstanceClass.T2, InstanceSize.LARGE))
        .machineImage(AmazonLinuxImage.Builder.create()
                .generation(AmazonLinuxGeneration.AMAZON_LINUX_2)
                .build())
        .vpc(vpc)
        .vpcSubnets(SubnetSelection.builder()
                .subnetType(SubnetType.PUBLIC)
                .build())
        .build();

fs.connections.allowDefaultPortFrom(inst);
csharp
var sg = SecurityGroup.FromSecurityGroupId(this, "FsxSecurityGroup", "{SECURITY-GROUP-ID}");
var fs = LustreFileSystem.FromLustreFileSystemAttributes(this, "FsxLustreFileSystem", new FileSystemAttributes {
    DnsName = "{FILE-SYSTEM-DNS-NAME}",
    FileSystemId = "{FILE-SYSTEM-ID}",
    SecurityGroup = sg
});

var vpc = Vpc.FromVpcAttributes(this, "Vpc", new VpcAttributes {
    AvailabilityZones = new [] { "us-west-2a", "us-west-2b" },
    PublicSubnetIds = new [] { "{US-WEST-2A-SUBNET-ID}", "{US-WEST-2B-SUBNET-ID}" },
    VpcId = "{VPC-ID}"
});

var inst = new Instance(this, "inst", new InstanceProps {
    InstanceType = InstanceType.Of(InstanceClass.T2, InstanceSize.LARGE),
    MachineImage = new AmazonLinuxImage(new AmazonLinuxImageProps {
        Generation = AmazonLinuxGeneration.AMAZON_LINUX_2
    }),
    Vpc = vpc,
    VpcSubnets = new SubnetSelection {
        SubnetType = SubnetType.PUBLIC
    }
});

fs.Connections.AllowDefaultPortFrom(inst);
go
sg := ec2.SecurityGroup_FromSecurityGroupId(this, jsii.String("FsxSecurityGroup"), jsii.String("{SECURITY-GROUP-ID}"))
fs := fsx.LustreFileSystem_FromLustreFileSystemAttributes(this, jsii.String("FsxLustreFileSystem"), &FileSystemAttributes{
	DnsName: jsii.String("{FILE-SYSTEM-DNS-NAME}"),
	FileSystemId: jsii.String("{FILE-SYSTEM-ID}"),
	SecurityGroup: sg,
})

vpc := ec2.Vpc_FromVpcAttributes(this, jsii.String("Vpc"), &VpcAttributes{
	AvailabilityZones: []*string{
		jsii.String("us-west-2a"),
		jsii.String("us-west-2b"),
	},
	PublicSubnetIds: []*string{
		jsii.String("{US-WEST-2A-SUBNET-ID}"),
		jsii.String("{US-WEST-2B-SUBNET-ID}"),
	},
	VpcId: jsii.String("{VPC-ID}"),
})

inst := ec2.NewInstance(this, jsii.String("inst"), &InstanceProps{
	InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_T2, ec2.InstanceSize_LARGE),
	MachineImage: ec2.NewAmazonLinuxImage(&AmazonLinuxImageProps{
		Generation: ec2.AmazonLinuxGeneration_AMAZON_LINUX_2,
	}),
	Vpc: Vpc,
	VpcSubnets: &SubnetSelection{
		SubnetType: ec2.SubnetType_PUBLIC,
	},
})

fs.Connections.AllowDefaultPortFrom(inst)

Lustre Data Repository Association support ​

The LustreFilesystem Construct supports one Data Repository Association (DRA) to an S3 bucket. This allows Lustre hierarchical storage management to S3 buckets, which in turn makes it possible to use S3 as a permanent backing store, and use FSx for Lustre as a temporary high performance cache.

Note: CloudFormation does not currently support for PERSISTENT_2 filesystems, and so neither does CDK.

The following example illustrates setting up a DRA to an S3 bucket, including automated metadata import whenever a file is changed, created or deleted in the S3 bucket:

ts
import { aws_s3 as s3 } from 'aws-cdk-lib';

declare const vpc: ec2.Vpc;
declare const bucket: s3.Bucket;

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

const fs = new fsx.LustreFileSystem(this, "FsxLustreFileSystem", {
  vpc: vpc,
  vpcSubnet: vpc.privateSubnets[0],
  storageCapacityGiB: 1200,
  lustreConfiguration,
});
python
from aws_cdk import aws_s3 as s3

# vpc: ec2.Vpc
# bucket: s3.Bucket


lustre_configuration = {
    "deployment_type": fsx.LustreDeploymentType.SCRATCH_2,
    "export_path": bucket.s3_url_for_object(),
    "import_path": bucket.s3_url_for_object(),
    "auto_import_policy": fsx.LustreAutoImportPolicy.NEW_CHANGED_DELETED
}

fs = fsx.LustreFileSystem(self, "FsxLustreFileSystem",
    vpc=vpc,
    vpc_subnet=vpc.private_subnets[0],
    storage_capacity_gi_b=1200,
    lustre_configuration=lustre_configuration
)
java
import software.amazon.awscdk.services.s3.*;

Vpc vpc;
Bucket bucket;


Map<String, Object> lustreConfiguration = Map.of(
        "deploymentType", LustreDeploymentType.SCRATCH_2,
        "exportPath", bucket.s3UrlForObject(),
        "importPath", bucket.s3UrlForObject(),
        "autoImportPolicy", LustreAutoImportPolicy.NEW_CHANGED_DELETED);

LustreFileSystem fs = LustreFileSystem.Builder.create(this, "FsxLustreFileSystem")
        .vpc(vpc)
        .vpcSubnet(vpc.getPrivateSubnets()[0])
        .storageCapacityGiB(1200)
        .lustreConfiguration(lustreConfiguration)
        .build();
csharp
using Amazon.CDK.AWS.S3;

Vpc vpc;
Bucket bucket;


IDictionary<string, object> lustreConfiguration = new Dictionary<string, object> {
    { "deploymentType", LustreDeploymentType.SCRATCH_2 },
    { "exportPath", bucket.S3UrlForObject() },
    { "importPath", bucket.S3UrlForObject() },
    { "autoImportPolicy", LustreAutoImportPolicy.NEW_CHANGED_DELETED }
};

var fs = new LustreFileSystem(this, "FsxLustreFileSystem", new LustreFileSystemProps {
    Vpc = vpc,
    VpcSubnet = vpc.PrivateSubnets[0],
    StorageCapacityGiB = 1200,
    LustreConfiguration = lustreConfiguration
});
go
import "github.com/aws/aws-cdk-go/awscdk"

var vpc Vpc
var bucket Bucket


lustreConfiguration := map[string]interface{}{
	"deploymentType": fsx.LustreDeploymentType_SCRATCH_2,
	"exportPath": bucket.s3UrlForObject(),
	"importPath": bucket.s3UrlForObject(),
	"autoImportPolicy": fsx.LustreAutoImportPolicy_NEW_CHANGED_DELETED,
}

fs := fsx.NewLustreFileSystem(this, jsii.String("FsxLustreFileSystem"), &LustreFileSystemProps{
	Vpc: vpc,
	VpcSubnet: vpc.PrivateSubnets[jsii.Number(0)],
	StorageCapacityGiB: jsii.Number(1200),
	LustreConfiguration: LustreConfiguration,
})

Compression ​

By default, transparent compression of data within FSx for Lustre is switched off. To enable it, add the following to your lustreConfiguration:

ts
const lustreConfiguration = {
  // ...
  dataCompressionType: fsx.LustreDataCompressionType.LZ4,
  // ...
}
python
lustre_configuration = {
    # ...
    "data_compression_type": fsx.LustreDataCompressionType.LZ4
}
java
Map<String, LustreDataCompressionType> lustreConfiguration = Map.of(
        // ...
        "dataCompressionType", LustreDataCompressionType.LZ4);
csharp
IDictionary<string, LustreDataCompressionType> lustreConfiguration = new Dictionary<string, LustreDataCompressionType> {
    // ...
    { "dataCompressionType", LustreDataCompressionType.LZ4 }
};
go
lustreConfiguration := map[string]LustreDataCompressionType{
	// ...
	"dataCompressionType": fsx.LustreDataCompressionType_LZ4,
}

When you turn data compression on for an existing file system, only newly written files are compressed. Existing files are not compressed. For more information, see Compressing previously written files.

Backups ​

You can take daily automatic backups by setting automaticBackupRetention to a non-zero day in the lustreConfiguration.

Additionally, you can set the backup window by specifying the dailyAutomaticBackupStartTime.

ts
import * as cdk from 'aws-cdk-lib';

const lustreConfiguration = {
  // ...
  automaticBackupRetention: cdk.Duration.days(3), // backup retention
  copyTagsToBackups: true, // if true, tags are copied to backups
  dailyAutomaticBackupStartTime: new fsx.DailyAutomaticBackupStartTime({ hour: 11, minute: 30 }),  // backup window
  // ...
}
python
import aws_cdk as cdk


lustre_configuration = {
    # ...
    "automatic_backup_retention": cdk.Duration.days(3),  # backup retention
    "copy_tags_to_backups": True,  # if true, tags are copied to backups
    "daily_automatic_backup_start_time": fsx.DailyAutomaticBackupStartTime(hour=11, minute=30)
}
java
import software.amazon.awscdk.*;


Map<String, Object> lustreConfiguration = Map.of(
        // ...
        "automaticBackupRetention", Duration.days(3),  // backup retention
        "copyTagsToBackups", true,  // if true, tags are copied to backups
        "dailyAutomaticBackupStartTime", DailyAutomaticBackupStartTime.Builder.create().hour(11).minute(30).build());
csharp
using Amazon.CDK;

IDictionary<string, object> lustreConfiguration = new Dictionary<string, object> {
    // ...
    { "automaticBackupRetention", Duration.Days(3) },  // backup retention
    { "copyTagsToBackups", true },  // if true, tags are copied to backups
    { "dailyAutomaticBackupStartTime", new DailyAutomaticBackupStartTime(new DailyAutomaticBackupStartTimeProps { Hour = 11, Minute = 30 }) }
};
go
import cdk "github.com/aws/aws-cdk-go/awscdk"


lustreConfiguration := map[string]interface{}{
	// ...
	"automaticBackupRetention": cdk.Duration_days(jsii.Number(3)),
	 // backup retention
	"copyTagsToBackups": jsii.Boolean(true),
	 // if true, tags are copied to backups
	"dailyAutomaticBackupStartTime": fsx.NewDailyAutomaticBackupStartTime(&DailyAutomaticBackupStartTimeProps{
		"hour": jsii.Number(11),
		"minute": jsii.Number(30),
	}),
}

For more information, see Working with backups .

Storage Type ​

By default, FSx for Lustre uses SSD storage. To use HDD storage, specify storageType:

ts
declare const vpc: ec2.Vpc;

const fileSystem = new fsx.LustreFileSystem(this, 'FsxLustreFileSystem', {
  lustreConfiguration: { deploymentType: fsx.LustreDeploymentType.PERSISTENT_1 },
  storageCapacityGiB: 1200,
  vpc,
  vpcSubnet: vpc.privateSubnets[0],
  storageType: fsx.StorageType.HDD,
});
python
# vpc: ec2.Vpc


file_system = fsx.LustreFileSystem(self, "FsxLustreFileSystem",
    lustre_configuration=fsx.LustreConfiguration(deployment_type=fsx.LustreDeploymentType.PERSISTENT_1),
    storage_capacity_gi_b=1200,
    vpc=vpc,
    vpc_subnet=vpc.private_subnets[0],
    storage_type=fsx.StorageType.HDD
)
java
Vpc vpc;


LustreFileSystem fileSystem = LustreFileSystem.Builder.create(this, "FsxLustreFileSystem")
        .lustreConfiguration(LustreConfiguration.builder().deploymentType(LustreDeploymentType.PERSISTENT_1).build())
        .storageCapacityGiB(1200)
        .vpc(vpc)
        .vpcSubnet(vpc.getPrivateSubnets()[0])
        .storageType(StorageType.HDD)
        .build();
csharp
Vpc vpc;


var fileSystem = new LustreFileSystem(this, "FsxLustreFileSystem", new LustreFileSystemProps {
    LustreConfiguration = new LustreConfiguration { DeploymentType = LustreDeploymentType.PERSISTENT_1 },
    StorageCapacityGiB = 1200,
    Vpc = vpc,
    VpcSubnet = vpc.PrivateSubnets[0],
    StorageType = StorageType.HDD
});
go
var vpc Vpc


fileSystem := fsx.NewLustreFileSystem(this, jsii.String("FsxLustreFileSystem"), &LustreFileSystemProps{
	LustreConfiguration: &LustreConfiguration{
		DeploymentType: fsx.LustreDeploymentType_PERSISTENT_1,
	},
	StorageCapacityGiB: jsii.Number(1200),
	Vpc: Vpc,
	VpcSubnet: vpc.PrivateSubnets[jsii.Number(0)],
	StorageType: fsx.StorageType_HDD,
})

Note: The HDD storage type is only supported for PERSISTENT_1 deployment types.

To improve the performance of frequently accessed files by caching up to 20% of the total storage capacity of the file system, set driveCacheType to READ:

ts
declare const vpc: ec2.Vpc;

const fileSystem = new fsx.LustreFileSystem(this, 'FsxLustreFileSystem', {
  lustreConfiguration: {
    deploymentType: fsx.LustreDeploymentType.PERSISTENT_1,
    driveCacheType: fsx.DriveCacheType.READ,
    },
  storageCapacityGiB: 1200,
  vpc,
  vpcSubnet: vpc.privateSubnets[0],
  storageType: fsx.StorageType.HDD,
});
python
# vpc: ec2.Vpc


file_system = fsx.LustreFileSystem(self, "FsxLustreFileSystem",
    lustre_configuration=fsx.LustreConfiguration(
        deployment_type=fsx.LustreDeploymentType.PERSISTENT_1,
        drive_cache_type=fsx.DriveCacheType.READ
    ),
    storage_capacity_gi_b=1200,
    vpc=vpc,
    vpc_subnet=vpc.private_subnets[0],
    storage_type=fsx.StorageType.HDD
)
java
Vpc vpc;


LustreFileSystem fileSystem = LustreFileSystem.Builder.create(this, "FsxLustreFileSystem")
        .lustreConfiguration(LustreConfiguration.builder()
                .deploymentType(LustreDeploymentType.PERSISTENT_1)
                .driveCacheType(DriveCacheType.READ)
                .build())
        .storageCapacityGiB(1200)
        .vpc(vpc)
        .vpcSubnet(vpc.getPrivateSubnets()[0])
        .storageType(StorageType.HDD)
        .build();
csharp
Vpc vpc;


var fileSystem = new LustreFileSystem(this, "FsxLustreFileSystem", new LustreFileSystemProps {
    LustreConfiguration = new LustreConfiguration {
        DeploymentType = LustreDeploymentType.PERSISTENT_1,
        DriveCacheType = DriveCacheType.READ
    },
    StorageCapacityGiB = 1200,
    Vpc = vpc,
    VpcSubnet = vpc.PrivateSubnets[0],
    StorageType = StorageType.HDD
});
go
var vpc Vpc


fileSystem := fsx.NewLustreFileSystem(this, jsii.String("FsxLustreFileSystem"), &LustreFileSystemProps{
	LustreConfiguration: &LustreConfiguration{
		DeploymentType: fsx.LustreDeploymentType_PERSISTENT_1,
		DriveCacheType: fsx.DriveCacheType_READ,
	},
	StorageCapacityGiB: jsii.Number(1200),
	Vpc: Vpc,
	VpcSubnet: vpc.PrivateSubnets[jsii.Number(0)],
	StorageType: fsx.StorageType_HDD,
})

FSx for Windows File Server ​

The L2 construct for the FSx for Windows File Server has not yet been implemented. To instantiate an FSx for Windows file system, the L1 constructs can be used as defined by CloudFormation.

Types ​

NameKindSummary
FileSystemBaseConstruct (L2)A new or imported FSx file system.
LustreFileSystemConstruct (L2)The FSx for Lustre File System implementation of IFileSystem.
CfnBackupConstruct (L1)Creates a backup of an existing Amazon FSx for Windows File Server file system, Amazon FSx for Lustre file system, Amazon FSx for NetApp ONTAP volume, or Amazon FSx for OpenZFS file system.
CfnDataRepositoryAssociationConstruct (L1)Creates an Amazon FSx for Lustre data repository association (DRA).
CfnFileCacheConstruct (L1)Resource Type definition for AWS::FSx::FileCache.
CfnFileSystemConstruct (L1)The AWS::FSx::FileSystem resource is an Amazon FSx resource type that specifies an Amazon FSx file system.
CfnS3AccessPointAttachmentConstruct (L1)An S3 access point attached to an Amazon FSx volume.
CfnSnapshotConstruct (L1)A snapshot of an Amazon FSx for OpenZFS volume.
CfnStorageVirtualMachineConstruct (L1)Creates a storage virtual machine (SVM) for an Amazon FSx for ONTAP file system.
CfnVolumeConstruct (L1)Creates an FSx for ONTAP or Amazon FSx for OpenZFS storage volume.
CfnBackupPropsStructProperties for defining a CfnBackup.
CfnDataRepositoryAssociation.AutoExportPolicyPropertyStructDescribes a data repository association's automatic export policy.
CfnDataRepositoryAssociation.AutoImportPolicyPropertyStructDescribes the data repository association's automatic import policy.
CfnDataRepositoryAssociation.S3PropertyStructThe configuration for an Amazon S3 data repository linked to an Amazon FSx Lustre file system with a data repository association.
CfnDataRepositoryAssociationPropsStructProperties for defining a CfnDataRepositoryAssociation.
CfnFileCache.DataRepositoryAssociationPropertyStruct
CfnFileCache.LogConfigurationPropertyStruct
CfnFileCache.LustreConfigurationPropertyStruct
CfnFileCache.MetadataConfigurationPropertyStruct
CfnFileCachePropsStructProperties for defining a CfnFileCache.
CfnFileSystem.AuditLogConfigurationPropertyStructThe configuration that Amazon FSx for Windows File Server uses to audit and log user accesses of files, folders, and file shares on the Amazon FSx for Windows File Server file system.
CfnFileSystem.ClientConfigurationsPropertyStructSpecifies who can mount an OpenZFS file system and the options available while mounting the file system.
CfnFileSystem.DataReadCacheConfigurationPropertyStructThe configuration for the optional provisioned SSD read cache on Amazon FSx for Lustre file systems that use the Intelligent-Tiering storage class.
CfnFileSystem.DiskIopsConfigurationPropertyStructThe SSD IOPS (input/output operations per second) configuration for an Amazon FSx for NetApp ONTAP, Amazon FSx for Windows File Server, or FSx for OpenZFS file system.
CfnFileSystem.FsrmConfigurationPropertyStruct
CfnFileSystem.LogConfigurationPropertyStruct
CfnFileSystem.LustreConfigurationPropertyStructThe configuration for the Amazon FSx for Lustre file system.
CfnFileSystem.MetadataConfigurationPropertyStructThe configuration that allows you to specify the performance of metadata operations for an FSx for Lustre file system.
CfnFileSystem.NfsExportsPropertyStructThe configuration object for mounting a file system.
CfnFileSystem.OntapConfigurationPropertyStructThe configuration for this Amazon FSx for NetApp ONTAP file system.
CfnFileSystem.OpenZFSConfigurationPropertyStructThe OpenZFS configuration for the file system that's being created.
CfnFileSystem.ReadCacheConfigurationPropertyStructThe configuration for the optional provisioned SSD read cache on Amazon FSx for OpenZFS file systems that use the Intelligent-Tiering storage class.
CfnFileSystem.RootVolumeConfigurationPropertyStructThe configuration of an Amazon FSx for OpenZFS root volume.
CfnFileSystem.SelfManagedActiveDirectoryConfigurationPropertyStructThe configuration that Amazon FSx uses to join a FSx for Windows File Server file system or an FSx for ONTAP storage virtual machine (SVM) to a self-managed (including on-premises) Microsoft Active Directory (AD) directory.
CfnFileSystem.UserAndGroupQuotasPropertyStructUsed to configure quotas that define how much storage a user or group can use on an FSx for OpenZFS volume.
CfnFileSystem.WindowsConfigurationPropertyStructThe Microsoft Windows configuration for the file system that's being created.
CfnFileSystemPropsStructProperties for defining a CfnFileSystem.
CfnS3AccessPointAttachment.FileSystemGIDPropertyStructThe GID of the file system user.
CfnS3AccessPointAttachment.OntapFileSystemIdentityPropertyStructSpecifies the file system user identity that will be used for authorizing all file access requests that are made using the S3 access point.
CfnS3AccessPointAttachment.OntapUnixFileSystemUserPropertyStructThe FSx for ONTAP UNIX file system user that is used for authorizing all file access requests that are made using the S3 access point.
CfnS3AccessPointAttachment.OntapWindowsFileSystemUserPropertyStructThe FSx for ONTAP Windows file system user that is used for authorizing all file access requests that are made using the S3 access point.
CfnS3AccessPointAttachment.OpenZFSFileSystemIdentityPropertyStructSpecifies the file system user identity that will be used for authorizing all file access requests that are made using the S3 access point.
CfnS3AccessPointAttachment.OpenZFSPosixFileSystemUserPropertyStructThe FSx for OpenZFS file system user that is used for authorizing all file access requests that are made using the S3 access point.
CfnS3AccessPointAttachment.S3AccessPointOntapConfigurationPropertyStructDescribes the FSx for ONTAP attachment configuration of an S3 access point attachment.
CfnS3AccessPointAttachment.S3AccessPointOpenZFSConfigurationPropertyStructDescribes the FSx for OpenZFS attachment configuration of an S3 access point attachment.
CfnS3AccessPointAttachment.S3AccessPointPropertyStructDescribes the S3 access point configuration of the S3 access point attachment.
CfnS3AccessPointAttachment.S3AccessPointVpcConfigurationPropertyStructIf included, Amazon S3 restricts access to this access point to requests from the specified virtual private cloud (VPC).
CfnS3AccessPointAttachmentPropsStructProperties for defining a CfnS3AccessPointAttachment.
CfnSnapshotPropsStructProperties for defining a CfnSnapshot.
CfnStorageVirtualMachine.ActiveDirectoryConfigurationPropertyStructDescribes the self-managed Microsoft Active Directory to which you want to join the SVM.
CfnStorageVirtualMachine.SelfManagedActiveDirectoryConfigurationPropertyStructThe configuration that Amazon FSx uses to join the ONTAP storage virtual machine (SVM) to your self-managed (including on-premises) Microsoft Active Directory directory.
CfnStorageVirtualMachinePropsStructProperties for defining a CfnStorageVirtualMachine.
CfnVolume.AggregateConfigurationPropertyStructUse to specify configuration options for a volume’s storage aggregate or aggregates.
CfnVolume.AutocommitPeriodPropertyStructSets the autocommit period of files in an FSx for ONTAP SnapLock volume, which determines how long the files must remain unmodified before they're automatically transitioned to the write once, read many (WORM) state.
CfnVolume.ClientConfigurationsPropertyStructSpecifies who can mount an OpenZFS file system and the options available while mounting the file system.
CfnVolume.NfsExportsPropertyStructThe configuration object for mounting a Network File System (NFS) file system.
CfnVolume.OntapConfigurationPropertyStructSpecifies the configuration of the ONTAP volume that you are creating.
CfnVolume.OpenZFSConfigurationPropertyStructSpecifies the configuration of the Amazon FSx for OpenZFS volume that you are creating.
CfnVolume.OriginSnapshotPropertyStructThe configuration object that specifies the snapshot to use as the origin of the data for the volume.
CfnVolume.RetentionPeriodPropertyStructSpecifies the retention period of an FSx for ONTAP SnapLock volume.
CfnVolume.SnaplockConfigurationPropertyStructSpecifies the SnapLock configuration for an FSx for ONTAP SnapLock volume.
CfnVolume.SnaplockRetentionPeriodPropertyStructThe configuration to set the retention period of an FSx for ONTAP SnapLock volume.
CfnVolume.TieringPolicyPropertyStructDescribes the data tiering policy for an ONTAP volume.
CfnVolume.UserAndGroupQuotasPropertyStructConfigures how much storage users and groups can use on the volume.
CfnVolumePropsStructProperties for defining a CfnVolume.
DailyAutomaticBackupStartTimeClassClass for scheduling a daily automatic backup time.
DailyAutomaticBackupStartTimePropsStructProperties required for setting up a daily automatic backup time.
DriveCacheTypeEnumThe type of drive cache used by PERSISTENT_1 file systems that are provisioned with HDD storage devices.
FileSystemAttributesStructProperties that describe an existing FSx file system.
FileSystemPropsStructProperties for the FSx file system.
FileSystemTypeVersionEnumThe Lustre version for the file system.
IFileSystemInterfaceInterface to implement FSx File Systems.
LustreAutoImportPolicyEnumThe different auto import policies which are allowed.
LustreConfigurationStructThe configuration for the Amazon FSx for Lustre file system.
LustreDataCompressionTypeEnumThe permitted Lustre data compression algorithms.
LustreDeploymentTypeEnumThe different kinds of file system deployments used by Lustre.
LustreFileSystemPropsStructProperties specific to the Lustre version of the FSx file system.
LustreMaintenanceTimeClassClass for scheduling a weekly maintenance time.
LustreMaintenanceTimePropsStructProperties required for setting up a weekly maintenance time.
StorageTypeEnumThe storage type for the file system.
WeekdayEnumEnum for representing all the days of the week.