Install & Compatibility
Where this runs
tested against v1.204.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 48.7MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 5.5s · import 0.000s · 49MB
50MB installed
● package 50MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
FileSystem
✓ from aws_cdk import aws_efs
✗ from aws_cdk.aws_efs import FileSystem
In AWS CDK v1, construct libraries are typically imported as submodules of 'aws_cdk' (e.g., 'aws_cdk.aws_efs'), not directly from 'aws_cdk.aws_efs' which is more common in v2.
AccessPoint
✓ from aws_cdk import aws_efs
✗ from aws_cdk import efs
Ensure the full submodule name 'aws_efs' is used, not a shorthand 'efs'.
This quickstart demonstrates how to create an AWS EFS File System within a new VPC, including an optional Access Point for POSIX-compliant access. It's designed for AWS CDK v1 projects. Remember to configure your AWS credentials and default region/account for `cdk deploy`.
import os
from aws_cdk import (
core as cdk,
aws_ec2 as ec2,
aws_efs as efs,
)
class EfsStack(cdk.Stack):
def __init__(self, scope: cdk.Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
# Create a VPC for the EFS File System
vpc = ec2.Vpc(self, "EfsVpc", max_azs=2)
# Create an EFS File System
file_system = efs.FileSystem(self, "MyEfsFileSystem",
vpc=vpc,
performance_mode=efs.PerformanceMode.GENERAL_PURPOSE,
throughput_mode=efs.ThroughputMode.BURSTING,
encrypted=True
)
# Optional: Create an Access Point for granular access control
efs.AccessPoint(self, "MyEfsAccessPoint",
file_system=file_system,
path="/mydata",
create_acl=efs.Acl(owner_uid="1001", owner_gid="1001", permissions="755"),
posix_user=efs.PosixUser(uid="1001", gid="1001")
)
cdk.CfnOutput(self, "FileSystemId", value=file_system.file_system_id)
app = cdk.App()
EfsStack(app, "EfsQuickstartStack",
env=cdk.Environment(account=os.environ.get("CDK_DEFAULT_ACCOUNT", ""),
region=os.environ.get("CDK_DEFAULT_REGION", ""))
)
app.synth()
Debug
Known issues
breakingThis package is for AWS CDK v1. Using it with an AWS CDK v2 application (which uses the `aws-cdk-lib` package) will cause `TypeError` or `AttributeError` due to incompatible types and API differences. The v2 equivalent constructs are part of the `aws-cdk-lib` package.fixFor new projects, prefer AWS CDK v2 (`pip install aws-cdk-lib`). For existing v1 projects, ensure `aws-cdk.core` is pinned to a v1 version compatible with `aws-cdk.aws-efs`.
affects: All v1.x versions when used with v2 CDK projects.
deprecatedAWS CDK v1 is in maintenance mode and no longer receives new feature development. Users are strongly encouraged to migrate to AWS CDK v2 for new projects to benefit from active development, consolidated packages, and improved features.fixPlan a migration to AWS CDK v2 (`aws-cdk-lib`). The migration guide provides details on necessary code changes.
affects: All v1.x versions.
gotchaEFS File Systems require a VPC and correctly configured security groups for EC2 instances to mount them. Failing to specify a VPC or providing inadequate security group rules will prevent instances from accessing the EFS share.fixAlways provide a `vpc` property when creating `efs.FileSystem`. Ensure that the security group attached to the EFS mount targets allows inbound TCP port 2049 from the security groups of your EC2 instances.
affects: All versions.
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
aws-cdk.corerequiredRequired for core CDK constructs and app definition in v1.