FileSystem

class aws_cdk.aws_efs.FileSystem(scope, id, *, vpc, enable_automatic_backups=None, encrypted=None, file_system_name=None, kms_key=None, lifecycle_policy=None, performance_mode=None, provisioned_throughput_per_second=None, removal_policy=None, security_group=None, throughput_mode=None, vpc_subnets=None)

Bases: aws_cdk.core.Resource

(experimental) The Elastic File System implementation of IFileSystem.

It creates a new, empty file system in Amazon Elastic File System (Amazon EFS). It also creates mount target (AWS::EFS::MountTarget) implicitly to mount the EFS file system on an Amazon Elastic Compute Cloud (Amazon EC2) instance or another resource.

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html

Stability

experimental

Resource

AWS::EFS::FileSystem

(experimental) Constructor for creating a new EFS FileSystem.

Parameters
  • scope (Construct) –

  • id (str) –

  • vpc (IVpc) – (experimental) VPC to launch the file system in.

  • enable_automatic_backups (Optional[bool]) – (experimental) Whether to enable automatic backups for the file system. Default: false

  • encrypted (Optional[bool]) – (experimental) Defines if the data at rest in the file system is encrypted or not. Default: false

  • file_system_name (Optional[str]) – (experimental) The file system’s name. Default: - CDK generated name

  • kms_key (Optional[IKey]) – (experimental) The KMS key used for encryption. This is required to encrypt the data at rest if @encrypted is set to true. Default: - if ‘encrypted’ is true, the default key for EFS (/aws/elasticfilesystem) is used

  • lifecycle_policy (Optional[LifecyclePolicy]) – (experimental) A policy used by EFS lifecycle management to transition files to the Infrequent Access (IA) storage class. Default: - None. EFS will not transition files to the IA storage class.

  • performance_mode (Optional[PerformanceMode]) – (experimental) The performance mode that the file system will operate under. An Amazon EFS file system’s performance mode can’t be changed after the file system has been created. Updating this property will replace the file system. Default: PerformanceMode.GENERAL_PURPOSE

  • provisioned_throughput_per_second (Optional[Size]) – (experimental) Provisioned throughput for the file system. This is a required property if the throughput mode is set to PROVISIONED. Must be at least 1MiB/s. Default: - none, errors out

  • removal_policy (Optional[RemovalPolicy]) – (experimental) The removal policy to apply to the file system. Default: RemovalPolicy.RETAIN

  • security_group (Optional[ISecurityGroup]) – (experimental) Security Group to assign to this file system. Default: - creates new security group which allows all outbound traffic

  • throughput_mode (Optional[ThroughputMode]) – (experimental) Enum to mention the throughput mode of the file system. Default: ThroughputMode.BURSTING

  • vpc_subnets (Optional[SubnetSelection]) – (experimental) Which subnets to place the mount target in the VPC. Default: - the Vpc default strategy if not specified

Stability

experimental

Methods

add_access_point(id, *, create_acl=None, path=None, posix_user=None)

(experimental) create access point from this filesystem.

Parameters
  • id (str) –

  • create_acl (Optional[Acl]) – (experimental) Specifies the POSIX IDs and permissions to apply when creating the access point’s root directory. If the root directory specified by path does not exist, EFS creates the root directory and applies the permissions specified here. If the specified path does not exist, you must specify createAcl. Default: - None. The directory specified by path must exist.

  • path (Optional[str]) – (experimental) Specifies the path on the EFS file system to expose as the root directory to NFS clients using the access point to access the EFS file system. Default: ‘/’

  • posix_user (Optional[PosixUser]) – (experimental) The full POSIX identity, including the user ID, group ID, and any secondary group IDs, on the access point that is used for all file system operations performed by NFS clients using the access point. Specify this to enforce a user identity using an access point. Default: - user identity not enforced

Stability

experimental

Return type

AccessPoint

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DELETE), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters

policy (RemovalPolicy) –

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

DEFAULT_PORT = 2049
connections

(experimental) The security groups/rules used to allow network connections to the file system.

Stability

experimental

Return type

Connections

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

Return type

ResourceEnvironment

file_system_id

(experimental) The ID of the file system, assigned by Amazon EFS.

Stability

experimental

Attribute

true

Return type

str

mount_targets_available

(experimental) Dependable that can be depended upon to ensure the mount targets of the filesystem are ready.

Stability

experimental

Return type

IDependable

node

The construct tree node associated with this construct.

Return type

ConstructNode

stack

The stack in which this resource is defined.

Return type

Stack

Static Methods

classmethod from_file_system_attributes(scope, id, *, file_system_id, security_group)

(experimental) Import an existing File System from the given properties.

Parameters
  • scope (Construct) –

  • id (str) –

  • file_system_id (str) – (experimental) The File System’s ID.

  • security_group (ISecurityGroup) – (experimental) The security group of the file system.

Stability

experimental

Return type

IFileSystem

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters

construct (IConstruct) –

Return type

bool