Class CfnFileSystem
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.s3files.CfnFileSystem
- All Implemented Interfaces:
IInspectable,IEnvironmentAware,IFileSystemRef,ITaggableV2,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)",
date="2026-04-14T18:32:03.774Z")
@Stability(Stable)
public class CfnFileSystem
extends CfnResource
implements IInspectable, IFileSystemRef, ITaggableV2
Resource Type definition for AWS::S3Files::FileSystem.
Example:
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.s3.*;
import software.amazon.awscdk.services.s3files.*;
Vpc vpc = new Vpc(this, "Vpc");
// Versioning is required — S3 Files relies on object versions for consistency.
Bucket bucket = Bucket.Builder.create(this, "Bucket").versioned(true).build();
// S3 Files assumes this role to sync data between S3 and the file system.
Role role = Role.Builder.create(this, "S3FilesRole")
.assumedBy(new ServicePrincipal("elasticfilesystem.amazonaws.com"))
.build();
// S3 permissions: read/write access to the bucket and objects
role.addToPolicy(PolicyStatement.Builder.create()
.actions(List.of("s3:ListBucket*"))
.resources(List.of(bucket.getBucketArn()))
.build());
role.addToPolicy(PolicyStatement.Builder.create()
.actions(List.of("s3:AbortMultipartUpload", "s3:DeleteObject", "s3:GetObject*", "s3:List*", "s3:PutObject*"))
.resources(List.of(bucket.arnForObjects("*")))
.build());
// EventBridge permissions: S3 Files creates rules prefixed "DO-NOT-DELETE-S3-Files"
// to detect S3 object changes and trigger data synchronization.
role.addToPolicy(PolicyStatement.Builder.create()
.actions(List.of("events:DeleteRule", "events:DisableRule", "events:EnableRule", "events:PutRule", "events:PutTargets", "events:RemoveTargets"))
.resources(List.of(String.format("arn:%s:events:*:*:rule/DO-NOT-DELETE-S3-Files*", Aws.PARTITION)))
.conditions(Map.of("StringEquals", Map.of("events:ManagedBy", "elasticfilesystem.amazonaws.com")))
.build());
role.addToPolicy(PolicyStatement.Builder.create()
.actions(List.of("events:DescribeRule", "events:ListRuleNamesByTarget", "events:ListRules", "events:ListTargetsByRule"))
.resources(List.of(String.format("arn:%s:events:*:*:rule/*", Aws.PARTITION)))
.build());
CfnFileSystem fileSystem = CfnFileSystem.Builder.create(this, "S3FilesFs")
.bucket(bucket.getBucketArn())
.roleArn(role.getRoleArn())
.build();
SecurityGroup sg = SecurityGroup.Builder.create(this, "MountTargetSG").vpc(vpc).build();
// Create a mount target in each private subnet so Lambda can reach the file system via NFS.
vpc.privateSubnets.forEach((subnet, i) =>
new s3files.CfnMountTarget(this, `MountTarget${i}`, {
fileSystemId: fileSystem.attrFileSystemId,
subnetId: subnet.subnetId,
securityGroups: [sg.securityGroupId],
}));
// The access point defines the POSIX identity and root path Lambda uses on the file system.
CfnAccessPoint accessPoint = CfnAccessPoint.Builder.create(this, "AccessPoint")
.fileSystemId(fileSystem.getAttrFileSystemId())
.rootDirectory(RootDirectoryProperty.builder()
.path("/export/lambda")
.creationPermissions(CreationPermissionsProperty.builder().ownerGid("1001").ownerUid("1001").permissions("750").build())
.build())
.posixUser(PosixUserProperty.builder().gid("1001").uid("1001").build())
.build();
Function fn = Function.Builder.create(this, "MyFunction")
.runtime(Runtime.NODEJS_LATEST)
.handler("index.handler")
.code(Code.fromAsset(join(__dirname, "lambda-handler")))
.vpc(vpc)
.filesystem(FileSystem.fromS3FilesAccessPoint(accessPoint, "/mnt/s3files"))
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnFileSystem.static interfaceExample:static interfaceExample:static interfaceExample:Nested 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.interfaces.s3files.IFileSystemRef
IFileSystemRef.Jsii$Default, IFileSystemRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggableV2
ITaggableV2.Jsii$Default, ITaggableV2.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnFileSystem(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnFileSystem(software.amazon.jsii.JsiiObjectRef objRef) CfnFileSystem(software.constructs.Construct scope, String id, CfnFileSystemProps props) Create a newAWS::S3Files::FileSystem. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringarnForFileSystem(IFileSystemRef resource) Returns union: eitherBooleanorIResolvableTag Manager which manages the tags for this resource.A reference to a FileSystem resource.Returns union: eitherIResolvableorCfnFileSystem.SynchronizationConfigurationPropertygetTags()voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.static BooleanChecks whether the given object is a CfnFileSystem.renderProperties(Map<String, Object> props) voidsetAcceptBucketWarning(Boolean value) voidvoidvoidsetClientToken(String value) voidsetKmsKeyId(String value) voidvoidsetRoleArn(String value) voidvoidvoidMethods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId, withMethods inherited from class software.constructs.Construct
getNode, isConstructMethods 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
getNode, withMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnFileSystem
protected CfnFileSystem(software.amazon.jsii.JsiiObjectRef objRef) -
CfnFileSystem
protected CfnFileSystem(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnFileSystem
@Stability(Stable) public CfnFileSystem(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnFileSystemProps props) Create a newAWS::S3Files::FileSystem.- Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties. This parameter is required.
-
-
Method Details
-
arnForFileSystem
- Parameters:
resource- This parameter is required.
-
isCfnFileSystem
Checks whether the given object is a CfnFileSystem.- Parameters:
x- This parameter is required.
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrCreationTime
-
getAttrFileSystemArn
-
getAttrFileSystemId
-
getAttrOwnerId
-
getAttrStatus
-
getAttrStatusMessage
-
getAttrSynchronizationConfigurationLatestVersionNumber
-
getCdkTagManager
Tag Manager which manages the tags for this resource.- Specified by:
getCdkTagManagerin interfaceITaggableV2
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getFileSystemRef
A reference to a FileSystem resource.- Specified by:
getFileSystemRefin interfaceIFileSystemRef
-
getBucket
-
setBucket
-
getRoleArn
-
setRoleArn
-
getAcceptBucketWarning
Returns union: eitherBooleanorIResolvable -
setAcceptBucketWarning
-
setAcceptBucketWarning
-
getClientToken
-
setClientToken
-
getKmsKeyId
-
setKmsKeyId
-
getPrefix
-
setPrefix
-
getSynchronizationConfiguration
Returns union: eitherIResolvableorCfnFileSystem.SynchronizationConfigurationProperty -
setSynchronizationConfiguration
-
setSynchronizationConfiguration
@Stability(Stable) public void setSynchronizationConfiguration(@Nullable CfnFileSystem.SynchronizationConfigurationProperty value) -
getTags
-
setTags
-