Skip to content
GitHubXDiscord

FileSystem

The FileSystem resource allows you to manage AWS EFS FileSystems for scalable file storage in the AWS cloud.

Create a basic EFS FileSystem with default settings and encryption enabled.

import AWS from "alchemy/aws/control";
const efsFileSystem = await AWS.EFS.FileSystem("myFileSystem", {
Encrypted: true,
PerformanceMode: "generalPurpose", // Options: "generalPurpose", "maxIO"
ThroughputMode: "bursting", // Options: "bursting", "provisioned"
ProvisionedThroughputInMibps: 1024 // Optional: Only for provisioned mode
});

Set up a FileSystem with a custom KMS key for encryption, lifecycle policies, and a backup policy.

const advancedEfsFileSystem = await AWS.EFS.FileSystem("advancedFileSystem", {
KmsKeyId: "arn:aws:kms:us-east-1:123456789012:key/abcd1234-efgh-5678-ijkl-90mnopqrst",
Encrypted: true,
LifecyclePolicies: [{
TransitionToIa: "AFTER_30_DAYS" // Transition files to Infrequent Access after 30 days
}],
BackupPolicy: {
Status: "ENABLED" // Enable backup for the FileSystem
}
});

Create an EFS FileSystem with custom tags for better resource management.

const taggedEfsFileSystem = await AWS.EFS.FileSystem("taggedFileSystem", {
FileSystemTags: [
{ Key: "Environment", Value: "Development" },
{ Key: "Project", Value: "AlchemyDemo" }
]
});

Set up a FileSystem with a replication configuration for better durability.

const replicatedEfsFileSystem = await AWS.EFS.FileSystem("replicatedFileSystem", {
ReplicationConfiguration: {
Region: "us-west-2", // Target region for replication
RoleArn: "arn:aws:iam::123456789012:role/EFSReplicationRole" // Role with permissions for replication
}
});