A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources with infrastructure-as-code.
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Amazon EFS provides scalable file storage for use with EC2 instances.
import * as aws from "@pulumi/aws";
const fs = new aws.efs.FileSystem("shared-fs", {
encrypted: true,
performanceMode: "generalPurpose",
throughputMode: "bursting",
tags: { Name: "shared-storage" },
});import * as aws from "@pulumi/aws";
const mountTargets = subnets.map((subnet, i) =>
new aws.efs.MountTarget(`mount-${i}`, {
fileSystemId: fs.id,
subnetId: subnet.id,
securityGroups: [sg.id],
})
);import * as aws from "@pulumi/aws";
const fs = new aws.efs.FileSystem("high-throughput-fs", {
encrypted: true,
performanceMode: "maxIO",
throughputMode: "provisioned",
provisionedThroughputInMibps: 100,
tags: { Name: "high-performance" },
});class FileSystem extends pulumi.CustomResource {
constructor(name: string, args?: FileSystemArgs, opts?: pulumi.CustomResourceOptions);
readonly arn: pulumi.Output<string>;
readonly id: pulumi.Output<string>;
}
interface FileSystemArgs {
encrypted?: pulumi.Input<boolean>;
kmsKeyId?: pulumi.Input<string>;
performanceMode?: pulumi.Input<"generalPurpose" | "maxIO">;
throughputMode?: pulumi.Input<"bursting" | "provisioned">;
provisionedThroughputInMibps?: pulumi.Input<number>;
tags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
}Example: Create encrypted file system with custom KMS key
const fs = new aws.efs.FileSystem("secure-fs", {
encrypted: true,
kmsKeyId: kmsKey.id,
performanceMode: "generalPurpose",
throughputMode: "bursting",
tags: {
Name: "secure-shared-storage",
Environment: "production",
Compliance: "HIPAA"
},
});Example: High-performance file system
const hpc = new aws.efs.FileSystem("hpc-storage", {
encrypted: true,
performanceMode: "maxIO", // For high concurrent operations
throughputMode: "provisioned",
provisionedThroughputInMibps: 256, // Dedicated throughput
tags: {
Name: "hpc-shared-storage",
Workload: "high-performance-computing"
},
});class MountTarget extends pulumi.CustomResource {
constructor(name: string, args: MountTargetArgs, opts?: pulumi.CustomResourceOptions);
}
interface MountTargetArgs {
fileSystemId: pulumi.Input<string>;
subnetId: pulumi.Input<string>;
securityGroups?: pulumi.Input<pulumi.Input<string>[]>;
}Example: Multi-AZ mount targets
// Create mount target in each availability zone
const privateSubnets = [subnet1, subnet2, subnet3];
const mountTargets = privateSubnets.map((subnet, index) =>
new aws.efs.MountTarget(`mount-target-${index}`, {
fileSystemId: fs.id,
subnetId: subnet.id,
securityGroups: [efsSecurityGroup.id],
})
);Example: Mount target with security group
// Security group for EFS access
const efsSg = new aws.ec2.SecurityGroup("efs-sg", {
vpcId: vpc.id,
ingress: [{
protocol: "tcp",
fromPort: 2049, // NFS port
toPort: 2049,
cidrBlocks: [vpc.cidrBlock],
}],
tags: { Name: "efs-mount-sg" },
});
// Create mount target
const mount = new aws.efs.MountTarget("mount-target", {
fileSystemId: fs.id,
subnetId: privateSubnet.id,
securityGroups: [efsSg.id],
});Install with Tessl CLI
npx tessl i tessl/npm-pulumi--aws@7.16.0