What is @aws-cdk/aws-efs?
@aws-cdk/aws-efs is an AWS CDK library that allows you to define and manage Amazon Elastic File System (EFS) resources in your AWS infrastructure as code. It provides constructs for creating and configuring EFS file systems, access points, and mount targets.
What are @aws-cdk/aws-efs's main functionalities?
Create an EFS File System
This code sample demonstrates how to create an EFS file system with specific lifecycle policies, performance mode, and throughput mode.
const efs = require('@aws-cdk/aws-efs');
const cdk = require('@aws-cdk/core');
const app = new cdk.App();
const stack = new cdk.Stack(app, 'EfsStack');
const fileSystem = new efs.FileSystem(stack, 'MyEfsFileSystem', {
vpc: vpc,
lifecyclePolicy: efs.LifecyclePolicy.AFTER_14_DAYS,
performanceMode: efs.PerformanceMode.GENERAL_PURPOSE,
throughputMode: efs.ThroughputMode.BURSTING,
});
app.synth();
Create an EFS Access Point
This code sample demonstrates how to create an EFS access point with specific POSIX user and ACL settings.
const efs = require('@aws-cdk/aws-efs');
const cdk = require('@aws-cdk/core');
const app = new cdk.App();
const stack = new cdk.Stack(app, 'EfsStack');
const fileSystem = new efs.FileSystem(stack, 'MyEfsFileSystem', {
vpc: vpc,
});
const accessPoint = new efs.AccessPoint(stack, 'MyAccessPoint', {
fileSystem: fileSystem,
path: '/export/lambda',
posixUser: {
uid: '1001',
gid: '1001'
},
createAcl: {
ownerUid: '1001',
ownerGid: '1001',
permissions: '755'
},
});
app.synth();
Create an EFS Mount Target
This code sample demonstrates how to create an EFS mount target in a specific subnet with a security group.
const efs = require('@aws-cdk/aws-efs');
const cdk = require('@aws-cdk/core');
const app = new cdk.App();
const stack = new cdk.Stack(app, 'EfsStack');
const fileSystem = new efs.FileSystem(stack, 'MyEfsFileSystem', {
vpc: vpc,
});
const mountTarget = new efs.CfnMountTarget(stack, 'MyMountTarget', {
fileSystemId: fileSystem.fileSystemId,
subnetId: vpc.privateSubnets[0].subnetId,
securityGroups: [securityGroup.securityGroupId],
});
app.synth();
Other packages similar to @aws-cdk/aws-efs
@aws-cdk/aws-s3
@aws-cdk/aws-s3 is a CDK library for defining Amazon S3 buckets and related resources. While it focuses on object storage rather than file storage, it provides similar infrastructure-as-code capabilities for managing storage resources in AWS.
@aws-cdk/aws-ec2
@aws-cdk/aws-ec2 is a CDK library for defining Amazon EC2 instances, VPCs, and related networking resources. It can be used in conjunction with @aws-cdk/aws-efs to set up the necessary networking infrastructure for EFS file systems.
@aws-cdk/aws-rds
@aws-cdk/aws-rds is a CDK library for defining Amazon RDS databases and related resources. While it focuses on relational databases rather than file storage, it provides similar infrastructure-as-code capabilities for managing database resources in AWS.