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, out_of_infrequent_access_policy=None, performance_mode=None, provisioned_throughput_per_second=None, removal_policy=None, security_group=None, throughput_mode=None, vpc_subnets=None)
Bases:
Resource
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
- Resource:
AWS::EFS::FileSystem
- ExampleMetadata:
infused
Example:
file_system = efs.FileSystem(self, "MyEfsFileSystem", vpc=ec2.Vpc(self, "VPC"), lifecycle_policy=efs.LifecyclePolicy.AFTER_14_DAYS, # files are not transitioned to infrequent access (IA) storage by default performance_mode=efs.PerformanceMode.GENERAL_PURPOSE, # default out_of_infrequent_access_policy=efs.OutOfInfrequentAccessPolicy.AFTER_1_ACCESS )
Constructor for creating a new EFS FileSystem.
- Parameters:
scope (
Construct
) –id (
str
) –vpc (
IVpc
) – VPC to launch the file system in.enable_automatic_backups (
Optional
[bool
]) – Whether to enable automatic backups for the file system. Default: falseencrypted (
Optional
[bool
]) – Defines if the data at rest in the file system is encrypted or not. Default: - If your application has the ‘file_system_name (
Optional
[str
]) – The file system’s name. Default: - CDK generated namekms_key (
Optional
[IKey
]) – 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 usedlifecycle_policy (
Optional
[LifecyclePolicy
]) – 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.out_of_infrequent_access_policy (
Optional
[OutOfInfrequentAccessPolicy
]) – A policy used by EFS lifecycle management to transition files from Infrequent Access (IA) storage class to primary storage class. Default: - None. EFS will not transition files from IA storage to primary storage.performance_mode (
Optional
[PerformanceMode
]) – 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_PURPOSEprovisioned_throughput_per_second (
Optional
[Size
]) – 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 outremoval_policy (
Optional
[RemovalPolicy
]) – The removal policy to apply to the file system. Default: RemovalPolicy.RETAINsecurity_group (
Optional
[ISecurityGroup
]) – Security Group to assign to this file system. Default: - creates new security group which allows all outbound trafficthroughput_mode (
Optional
[ThroughputMode
]) – Enum to mention the throughput mode of the file system. Default: ThroughputMode.BURSTINGvpc_subnets (
Union
[SubnetSelection
,Dict
[str
,Any
],None
]) – Which subnets to place the mount target in the VPC. Default: - the Vpc default strategy if not specified
Methods
- add_access_point(id, *, create_acl=None, path=None, posix_user=None)
create access point from this filesystem.
- Parameters:
id (
str
) –create_acl (
Union
[Acl
,Dict
[str
,Any
],None
]) – Specifies the POSIX IDs and permissions to apply when creating the access point’s root directory. If the root directory specified bypath
does not exist, EFS creates the root directory and applies the permissions specified here. If the specifiedpath
does not exist, you must specifycreateAcl
. Default: - None. The directory specified bypath
must exist.path (
Optional
[str
]) – 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 (
Union
[PosixUser
,Dict
[str
,Any
],None
]) – 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
- Return type:
- 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.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
RemovalPolicy
) –- Return type:
None
- grant(grantee, *actions)
Grant the actions defined in actions to the given grantee on this File System resource.
- Parameters:
grantee (
IGrantable
) – Principal to grant right to.actions (
str
) – The actions to grant.
- Return type:
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- DEFAULT_PORT = 2049
- connections
The security groups/rules used to allow network connections to the file system.
- 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.
- file_system_arn
The ARN of the file system.
- Attribute:
true
- file_system_id
The ID of the file system, assigned by Amazon EFS.
- Attribute:
true
- mount_targets_available
Dependable that can be depended upon to ensure the mount targets of the filesystem are ready.
- node
The construct tree node associated with this construct.
- stack
The stack in which this resource is defined.
Static Methods
- classmethod from_file_system_attributes(scope, id, *, security_group, file_system_arn=None, file_system_id=None)
Import an existing File System from the given properties.
- Parameters:
scope (
Construct
) –id (
str
) –security_group (
ISecurityGroup
) – The security group of the file system.file_system_arn (
Optional
[str
]) – The File System’s Arn. Default: - determined based on fileSystemIdfile_system_id (
Optional
[str
]) – The File System’s ID. Default: - determined based on fileSystemArn
- Return type:
- 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