Class FileSystem

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.lambda.FileSystem
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:40.736Z") @Stability(Stable) public class FileSystem extends software.amazon.jsii.JsiiObject
Represents the filesystem for the Lambda function.

Example:

 import software.amazon.awscdk.services.ec2.*;
 import software.amazon.awscdk.services.efs.*;
 // create a new VPC
 Vpc vpc = new Vpc(this, "VPC");
 // create a new Amazon EFS filesystem
 FileSystem fileSystem = FileSystem.Builder.create(this, "Efs").vpc(vpc).build();
 // create a new access point from the filesystem
 AccessPoint accessPoint = fileSystem.addAccessPoint("AccessPoint", AccessPointOptions.builder()
         // set /export/lambda as the root of the access point
         .path("/export/lambda")
         // as /export/lambda does not exist in a new efs filesystem, the efs will create the directory with the following createAcl
         .createAcl(Acl.builder()
                 .ownerUid("1001")
                 .ownerGid("1001")
                 .permissions("750")
                 .build())
         // enforce the POSIX identity so lambda function will access with this identity
         .posixUser(PosixUser.builder()
                 .uid("1001")
                 .gid("1001")
                 .build())
         .build());
 Function fn = Function.Builder.create(this, "MyLambda")
         // mount the access point to /mnt/msg in the lambda runtime environment
         .filesystem(FileSystem.fromEfsAccessPoint(accessPoint, "/mnt/msg"))
         .runtime(Runtime.NODEJS_16_X)
         .handler("index.handler")
         .code(Code.fromAsset(join(__dirname, "lambda-handler")))
         .vpc(vpc)
         .build();
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
    protected
    FileSystem(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    FileSystem(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static FileSystem
    mount the filesystem from Amazon EFS.
    the FileSystem configurations for the Lambda function.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • FileSystem

      protected FileSystem(software.amazon.jsii.JsiiObjectRef objRef)
    • FileSystem

      protected FileSystem(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • FileSystem

      @Stability(Stable) protected FileSystem(@NotNull FileSystemConfig config)
      Parameters:
      config - the FileSystem configurations for the Lambda function. This parameter is required.
  • Method Details

    • fromEfsAccessPoint

      @Stability(Stable) @NotNull public static FileSystem fromEfsAccessPoint(@NotNull IAccessPoint ap, @NotNull String mountPath)
      mount the filesystem from Amazon EFS.

      Parameters:
      ap - the Amazon EFS access point. This parameter is required.
      mountPath - the target path in the lambda runtime environment. This parameter is required.
    • getConfig

      @Stability(Stable) @NotNull public FileSystemConfig getConfig()
      the FileSystem configurations for the Lambda function.