{"id":8859,"library":"aws-cdk-aws-efs","title":"AWS CDK EFS Construct Library (v1)","description":"The AWS CDK Construct Library for AWS EFS (Amazon Elastic File System) provides constructs to create and manage EFS resources as infrastructure-as-code. This package is part of the AWS CDK v1 ecosystem (version 1.204.0), which is currently in maintenance mode. AWS CDK v1 typically sees infrequent updates, primarily for critical bug fixes or security patches.","status":"maintenance","version":"1.204.0","language":"en","source_language":"en","source_url":"https://github.com/aws/aws-cdk.git","tags":["aws","cdk","efs","infrastructure-as-code","cloud","v1"],"install":[{"cmd":"pip install aws-cdk.aws-efs aws-cdk.core","lang":"bash","label":"Install for AWS CDK v1"}],"dependencies":[{"reason":"Required for core CDK constructs and app definition in v1.","package":"aws-cdk.core","optional":false}],"imports":[{"note":"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.","wrong":"from aws_cdk.aws_efs import FileSystem","symbol":"FileSystem","correct":"from aws_cdk import aws_efs"},{"note":"Ensure the full submodule name 'aws_efs' is used, not a shorthand 'efs'.","wrong":"from aws_cdk import efs","symbol":"AccessPoint","correct":"from aws_cdk import aws_efs"}],"quickstart":{"code":"import os\nfrom aws_cdk import (\n    core as cdk,\n    aws_ec2 as ec2,\n    aws_efs as efs,\n)\n\nclass EfsStack(cdk.Stack):\n    def __init__(self, scope: cdk.Construct, construct_id: str, **kwargs) -> None:\n        super().__init__(scope, construct_id, **kwargs)\n\n        # Create a VPC for the EFS File System\n        vpc = ec2.Vpc(self, \"EfsVpc\", max_azs=2)\n\n        # Create an EFS File System\n        file_system = efs.FileSystem(self, \"MyEfsFileSystem\",\n            vpc=vpc,\n            performance_mode=efs.PerformanceMode.GENERAL_PURPOSE,\n            throughput_mode=efs.ThroughputMode.BURSTING,\n            encrypted=True\n        )\n\n        # Optional: Create an Access Point for granular access control\n        efs.AccessPoint(self, \"MyEfsAccessPoint\",\n            file_system=file_system,\n            path=\"/mydata\",\n            create_acl=efs.Acl(owner_uid=\"1001\", owner_gid=\"1001\", permissions=\"755\"),\n            posix_user=efs.PosixUser(uid=\"1001\", gid=\"1001\")\n        )\n\n        cdk.CfnOutput(self, \"FileSystemId\", value=file_system.file_system_id)\n\napp = cdk.App()\nEfsStack(app, \"EfsQuickstartStack\",\n         env=cdk.Environment(account=os.environ.get(\"CDK_DEFAULT_ACCOUNT\", \"\"), \n                             region=os.environ.get(\"CDK_DEFAULT_REGION\", \"\"))\n)\napp.synth()","lang":"python","description":"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`."},"warnings":[{"fix":"For 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`.","message":"This 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.","severity":"breaking","affected_versions":"All v1.x versions when used with v2 CDK projects."},{"fix":"Plan a migration to AWS CDK v2 (`aws-cdk-lib`). The migration guide provides details on necessary code changes.","message":"AWS 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.","severity":"deprecated","affected_versions":"All v1.x versions."},{"fix":"Always 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.","message":"EFS 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.","severity":"gotcha","affected_versions":"All versions."}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Ensure `pip install aws-cdk.aws-efs aws-cdk.core` has been run for CDK v1. If using CDK v2, install `aws-cdk-lib` instead and use `from aws_cdk import aws_efs` (without the separate package).","cause":"The `aws-cdk.aws-efs` Python package is not installed or the `from aws_cdk import aws_efs` import path is incorrect for the installed CDK version.","error":"ModuleNotFoundError: No module named 'aws_cdk.aws_efs'"},{"fix":"Verify that all your `aws-cdk.*` packages are consistently either v1 or v2. If using v1, ensure all libraries are installed separately (e.g., `aws-cdk.core`, `aws-cdk.aws-ec2`, `aws-cdk.aws-efs`). If using v2, install only `aws-cdk-lib`.","cause":"This often occurs when mixing AWS CDK v1 and v2 constructs or core libraries. A v1 construct might be expecting a v1 `cdk.Construct` but receives a v2 equivalent (or vice-versa).","error":"TypeError: Argument 'scope' must be instance of Construct, not <class 'aws_cdk.aws_ec2.Vpc'>"},{"fix":"Check the security group attached to the EFS mount target (automatically created or custom) allows inbound port 2049 from the requesting resources. Also, confirm the subnets associated with the VPC have enough available IP addresses and are correctly routed.","cause":"This typically indicates an issue with the VPC configuration for the EFS mount targets, often related to security groups, network ACLs, or insufficient IP addresses in subnets.","error":"Resource handler returned message: \"EFS file system mount target could not be created\" (RequestToken: ..., HandlerErrorCode: InvalidRequest)"}]}