Class FileSystem
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.efs.FileSystem
- All Implemented Interfaces:
IResource,IConnectable,IFileSystem,IResourceWithPolicy,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-29T11:15:39.452Z")
@Stability(Stable)
public class FileSystem
extends Resource
implements IFileSystem
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.
Example:
import software.amazon.awscdk.services.iam.*;
Role role = Role.Builder.create(this, "ClientRole")
.assumedBy(new AnyPrincipal())
.build();
FileSystem fileSystem = FileSystem.Builder.create(this, "MyEfsFileSystem")
.vpc(new Vpc(this, "VPC"))
.allowAnonymousAccess(true)
.build();
fileSystem.grantRead(role);
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.efs.IFileSystem
IFileSystem.Jsii$Default, IFileSystem.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFileSystem(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedFileSystem(software.amazon.jsii.JsiiObjectRef objRef) FileSystem(software.constructs.Construct scope, String id, FileSystemProps props) Constructor for creating a new EFS FileSystem. -
Method Summary
Modifier and TypeMethodDescriptionaddAccessPoint(String id) create access point from this filesystem.addAccessPoint(String id, AccessPointOptions accessPointOptions) create access point from this filesystem.addToResourcePolicy(PolicyStatement statement) Adds a statement to the resource policy associated with this file system.static IFileSystemfromFileSystemAttributes(software.constructs.Construct scope, String id, FileSystemAttributes attrs) Import an existing File System from the given properties.The security groups/rules used to allow network connections to the file system.The ARN of the file system.The ID of the file system, assigned by Amazon EFS.software.constructs.IDependableDependable that can be depended upon to ensure the mount targets of the filesystem are ready.grant(IGrantable grantee, String... actions) Grant the actions defined in actions to the given grantee on this File System resource.grantRead(IGrantable grantee) Grant read permissions for this file system to an IAM principal.grantReadWrite(IGrantable grantee) Grant read and write permissions for this file system to an IAM principal.grantRootAccess(IGrantable grantee) As root user, grant read and write permissions for this file system to an IAM principal.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
DEFAULT_PORT
The default port File System listens on. -
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
FileSystem
protected FileSystem(software.amazon.jsii.JsiiObjectRef objRef) -
FileSystem
protected FileSystem(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
FileSystem
@Stability(Stable) public FileSystem(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull FileSystemProps props) Constructor for creating a new EFS FileSystem.- Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromFileSystemAttributes
@Stability(Stable) @NotNull public static IFileSystem fromFileSystemAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull FileSystemAttributes attrs) Import an existing File System from the given properties.- Parameters:
scope- This parameter is required.id- This parameter is required.attrs- This parameter is required.
-
addAccessPoint
@Stability(Stable) @NotNull public AccessPoint addAccessPoint(@NotNull String id, @Nullable AccessPointOptions accessPointOptions) create access point from this filesystem.- Parameters:
id- This parameter is required.accessPointOptions-
-
addAccessPoint
create access point from this filesystem.- Parameters:
id- This parameter is required.
-
addToResourcePolicy
@Stability(Stable) @NotNull public AddToResourcePolicyResult addToResourcePolicy(@NotNull PolicyStatement statement) Adds a statement to the resource policy associated with this file system.A resource policy will be automatically created upon the first call to
addToResourcePolicy.Note that this does not work with imported file systems.
- Specified by:
addToResourcePolicyin interfaceIResourceWithPolicy- Parameters:
statement- The policy statement to add. This parameter is required.
-
grant
@Stability(Stable) @NotNull public Grant grant(@NotNull IGrantable grantee, @NotNull String... actions) Grant the actions defined in actions to the given grantee on this File System resource.- Specified by:
grantin interfaceIFileSystem- Parameters:
grantee- Principal to grant right to. This parameter is required.actions- The actions to grant. This parameter is required.
-
grantRead
Grant read permissions for this file system to an IAM principal.- Specified by:
grantReadin interfaceIFileSystem- Parameters:
grantee- The principal to grant read to. This parameter is required.
-
grantReadWrite
Grant read and write permissions for this file system to an IAM principal.- Specified by:
grantReadWritein interfaceIFileSystem- Parameters:
grantee- The principal to grant read and write to. This parameter is required.
-
grantRootAccess
As root user, grant read and write permissions for this file system to an IAM principal.- Specified by:
grantRootAccessin interfaceIFileSystem- Parameters:
grantee- The principal to grant root access to. This parameter is required.
-
getConnections
The security groups/rules used to allow network connections to the file system.- Specified by:
getConnectionsin interfaceIConnectable
-
getFileSystemArn
The ARN of the file system.- Specified by:
getFileSystemArnin interfaceIFileSystem
-
getFileSystemId
The ID of the file system, assigned by Amazon EFS.- Specified by:
getFileSystemIdin interfaceIFileSystem
-
getMountTargetsAvailable
@Stability(Stable) @NotNull public software.constructs.IDependable getMountTargetsAvailable()Dependable that can be depended upon to ensure the mount targets of the filesystem are ready.- Specified by:
getMountTargetsAvailablein interfaceIFileSystem
-