Skip to main content

cdk-aws-ec2-efs

Project description

EC2 with EFS AWS CDK construct

npm version PyPI version

This Construct provides an easy way to mount an EFS on EC2 in AWS CDK.

It will inject mount commands as user data script to EC2. And the EFS will be mounted after initializing.

Installation

JavaScript & TypeScript

npm i cdk-aws-ec2-efs

Python

pip install cdk-aws-ec2-efs

Usage

Create an AWS CDK project, in your application stack create EC2 and EFS resources. Note EC2 and EFS must be in the same VPC so EC2 can reach EFS. Then use the construct to mount EFS to EC2:

    const fileSystem = new cdk.aws_efs.FileSystem(this, "fileSystem", {
      ...
    });
    const ec2Instance = new ec2.Instance(this, "ec2-instance", {
      ...
    });
    new Ec2WithEfs(this, "EfsMount", {
      instance: ec2Instance,
      fileSystem: fileSystem,
      configureConnection: true,
    });

In the above example we pass configureConnection as true, This tell construct to take care of adding rules to EFS security groups to enable EC2 access.

Refer to API.md for full documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdk-aws-ec2-efs-0.0.3.tar.gz (27.7 kB view hashes)

Uploaded Source

Built Distribution

cdk_aws_ec2_efs-0.0.3-py3-none-any.whl (26.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page