Show / Hide Table of Contents

Namespace Amazon.CDK.AWS.Lambda

AWS Lambda Construct Library

--- cfn-resources: Stable cdk-constructs: Stable

This construct library allows you to define AWS Lambda Functions.

// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
using Amazon.CDK.AWS.Lambda;
using Path;

Function fn = new Function(this, "MyFunction", new FunctionProps {
    Runtime = Runtime.NODEJS_10_X,
    Handler = "index.handler",
    Code = Code.FromAsset(Join(__dirname, "lambda-handler"))
});

Handler Code

The lambda.Code class includes static convenience methods for various types of runtime code.

    The following example shows how to define a Python function and deploy the code from the local directory my-lambda-handler to it:

    // Example automatically generated. See https://github.com/aws/jsii/issues/826
    new Function(this, "MyLambda", new FunctionProps {
        Code = Code.FromAsset(Join(__dirname, "my-lambda-handler")),
        Handler = "index.main",
        Runtime = Runtime.PYTHON_3_6
    });

    When deploying a stack that contains this code, the directory will be zip archived and then uploaded to an S3 bucket, then the exact location of the S3 objects will be passed when the stack is deployed.

    During synthesis, the CDK expects to find a directory on disk at the asset directory specified. Note that we are referencing the asset directory relatively to our CDK project directory. This is especially important when we want to share this construct through a library. Different programming languages will have different techniques for bundling resources into libraries.

    Docker Images

    Lambda functions allow specifying their handlers within docker images. The docker image can be an image from ECR or a local asset that the CDK will package and load into ECR.

    The following DockerImageFunction construct uses a local folder with a Dockerfile as the asset that will be used as the function handler.

    // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
    new lambda.DockerImageFunction(this, "AssetFunction", new Struct {
        Code = lambda.DockerImageCode.FromImageAsset(path.Join(__dirname, "docker-handler"))
    });

    You can also specify an image that already exists in ECR as the function handler.

    // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
    using Amazon.CDK.AWS.ECR;
    Repository repo = new Repository(this, "Repository");
    
    new lambda.DockerImageFunction(this, "ECRFunction", new Struct {
        Code = lambda.DockerImageCode.FromEcr(repo)
    });

    Execution Role

    Lambda functions assume an IAM role during execution. In CDK by default, Lambda functions will use an autogenerated Role if one is not provided.

    The autogenerated Role is automatically given permissions to execute the Lambda function. To reference the autogenerated Role:

    // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
    var fn = new lambda.Function(this, "MyFunction", new Struct {
        Runtime = lambda.Runtime.NODEJS_10_X,
        Handler = "index.handler",
        Code = lambda.Code.FromAsset(path.Join(__dirname, "lambda-handler")),
    
        Fn = fn,  = .Role
    });

    You can also provide your own IAM role. Provided IAM roles will not automatically be given permissions to execute the Lambda function. To provide a role and grant it appropriate permissions:

    // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
    var fn = new lambda.Function(this, "MyFunction", new Struct {
        Runtime = lambda.Runtime.NODEJS_10_X,
        Handler = "index.handler",
        Code = lambda.Code.FromAsset(path.Join(__dirname, "lambda-handler")),
        Role = myRole
    });
    
    myRole.AddManagedPolicy(ManagedPolicy.FromAwsManagedPolicyName("service-role/AWSLambdaBasicExecutionRole"));
    myRole.AddManagedPolicy(ManagedPolicy.FromAwsManagedPolicyName("service-role/AWSLambdaVPCAccessExecutionRole"));

    Versions and Aliases

    You can use versions to manage the deployment of your AWS Lambda functions. For example, you can publish a new version of a function for beta testing without affecting users of the stable production version.

    The function version includes the following information:

      You can define one or more aliases for your AWS Lambda function. A Lambda alias is like a pointer to a specific Lambda function version. Users can access the function version using the alias ARN.

      The fn.currentVersion property can be used to obtain a lambda.Version resource that represents the AWS Lambda function defined in your application. Any change to your function's code or configuration will result in the creation of a new version resource. You can specify options for this version through the currentVersionOptions property.

      The <code>currentVersion</code> property is only supported when your AWS Lambda function
      uses either <code>lambda.Code.fromAsset</code> or <code>lambda.Code.fromInline</code>. Other types
      of code providers (such as <code>lambda.Code.fromBucket</code>) require that you define a
      

      lambda.Version resource directly since the CDK is unable to determine if their contents had changed.

      An alternative to defining a lambda.Version is to set an environment variable which changes at least as often as your code does. This makes sure the function always has the latest code.

          // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
          string codeVersion = "stringOrMethodToGetCodeVersion";
          var fn = new lambda.Function(this, "MyFunction", new Struct {
              Environment = new Struct {
                  CodeVersionString = codeVersion
              }
          });

      The version.addAlias() method can be used to define an AWS Lambda alias that points to a specific version.

      The following example defines an alias named live which will always point to a version that represents the function as defined in your CDK app. When you change your lambda code or configuration, a new resource will be created. You can specify options for the current version through the currentVersionOptions property.

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      var fn = new lambda.Function(this, "MyFunction", new Struct {
          CurrentVersionOptions = new Struct {
              RemovalPolicy = RemovalPolicy.RETAIN, // retain old versions
              RetryAttempts = 1
          }
      });
      
      fn.CurrentVersion.AddAlias("live");
      NOTE: The <code>fn.latestVersion</code> property returns a <code>lambda.IVersion</code> which
      represents the <code>$LATEST</code> pseudo-version. Most AWS services require a specific
      AWS Lambda version, and won&apos;t allow you to use <code>$LATEST</code>. Therefore, you would
      normally want to use <code>lambda.currentVersion</code>.
      

      Layers

      The lambda.LayerVersion class can be used to define Lambda layers and manage granting permissions to other AWS accounts or organizations.

      // Example automatically generated. See https://github.com/aws/jsii/issues/826
      LayerVersion layer = new LayerVersion(stack, "MyLayer", new LayerVersionProps {
          Code = Code.FromAsset(Join(__dirname, "layer-code")),
          CompatibleRuntimes = new [] { Runtime.NODEJS_10_X },
          License = "Apache-2.0",
          Description = "A layer to test the L2 construct"
      });
      
      // To grant usage by other AWS accounts
      layer.AddPermission("remote-account-grant", new LayerVersionPermission { AccountId = awsAccountId });
      
      // To grant usage to all accounts in some AWS Ogranization
      // layer.grantUsage({ accountId: '*', organizationId });
      
      // To grant usage to all accounts in some AWS Ogranization
      // layer.grantUsage({ accountId: '*', organizationId });
      new Function(stack, "MyLayeredLambda", new FunctionProps {
          Code = new InlineCode("foo"),
          Handler = "index.handler",
          Runtime = Runtime.NODEJS_10_X,
          Layers = new [] { layer }
      });

      By default, updating a layer creates a new layer version, and CloudFormation will delete the old version as part of the stack update.

      Alternatively, a removal policy can be used to retain the old version:

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      using Amazon.CDK.AWS.Lambda;
      new LayerVersion(this, "MyLayer", new LayerVersionProps {
          RemovalPolicy = RemovalPolicy.RETAIN
      });

      Event Rule Target

      You can use an AWS Lambda function as a target for an Amazon CloudWatch event rule:

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      using Amazon.CDK.AWS.Events.Targets;
      rule.AddTarget(new LambdaFunction(myFunction));

      Event Sources

      AWS Lambda supports a variety of event sources.

      In most cases, it is possible to trigger a function as a result of an event by using one of the add<Event>Notification methods on the source construct. For example, the s3.Bucket construct has an onEvent method which can be used to trigger a Lambda when an event, such as PutObject occurs on an S3 bucket.

      An alternative way to add event sources to a function is to use function.addEventSource(source). This method accepts an IEventSource object. The module @aws-cdk/aws-lambda-event-sources includes classes for the various event sources supported by AWS Lambda.

      For example, the following code adds an SQS queue as an event source for a function:

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      using Amazon.CDK.AWS.Lambda.EventSources;
      fn.AddEventSource(new SqsEventSource(queue));

      The following code adds an S3 bucket notification as an event source:

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      using Amazon.CDK.AWS.Lambda.EventSources;
      fn.AddEventSource(new S3EventSource(bucket, new S3EventSourceProps {
          Events = new [] { s3.EventType.OBJECT_CREATED, s3.EventType.OBJECT_DELETED },
          Filters = new [] { new NotificationKeyFilter { Prefix = "subdir/" } }
      }));

      See the documentation for the @aws-cdk/aws-lambda-event-sources module for more details.

      Lambda with DLQ

      A dead-letter queue can be automatically created for a Lambda function by setting the deadLetterQueueEnabled: true configuration.

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      using Amazon.CDK.AWS.Lambda;
      
      Function fn = new Function(this, "MyFunction", new FunctionProps {
          Runtime = Runtime.NODEJS_10_X,
          Handler = "index.handler",
          Code = Code.FromInline("exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); }"),
          DeadLetterQueueEnabled = true
      });

      It is also possible to provide a dead-letter queue instead of getting a new queue created:

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      using Amazon.CDK.AWS.Lambda;
      using Amazon.CDK.AWS.SQS;
      
      Queue dlq = new Queue(this, "DLQ");
      Function fn = new Function(this, "MyFunction", new FunctionProps {
          Runtime = Runtime.NODEJS_10_X,
          Handler = "index.handler",
          Code = Code.FromInline("exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); }"),
          DeadLetterQueue = dlq
      });

      See the AWS documentation to learn more about AWS Lambdas and DLQs.

      Lambda with X-Ray Tracing

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      using Amazon.CDK.AWS.Lambda;
      
      Function fn = new Function(this, "MyFunction", new FunctionProps {
          Runtime = Runtime.NODEJS_10_X,
          Handler = "index.handler",
          Code = Code.FromInline("exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); }"),
          Tracing = Tracing.ACTIVE
      });

      See the AWS documentation to learn more about AWS Lambda's X-Ray support.

      Lambda with Profiling

      The following code configures the lambda function with CodeGuru profiling. By default, this creates a new CodeGuru profiling group -

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      using Amazon.CDK.AWS.Lambda;
      
      Function fn = new Function(this, "MyFunction", new FunctionProps {
          Runtime = Runtime.PYTHON_3_6,
          Handler = "index.handler",
          Code = Code.FromAsset("lambda-handler"),
          Profiling = true
      });

      The profilingGroup property can be used to configure an existing CodeGuru profiler group.

      CodeGuru profiling is supported for all Java runtimes and Python3.6+ runtimes.

      See the AWS documentation to learn more about AWS Lambda's Profiling support.

      Lambda with Reserved Concurrent Executions

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      using Amazon.CDK.AWS.Lambda;
      
      Function fn = new Function(this, "MyFunction", new FunctionProps {
          Runtime = Runtime.NODEJS_10_X,
          Handler = "index.handler",
          Code = Code.FromInline("exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); }"),
          ReservedConcurrentExecutions = 100
      });

      See the AWS documentation managing concurrency.

      AutoScaling

      You can use Application AutoScaling to automatically configure the provisioned concurrency for your functions. AutoScaling can be set to track utilization or be based on a schedule. To configure AutoScaling on a function alias:

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      var alias = new lambda.Alias(stack, "Alias", new Struct {
          AliasName = "prod",
          Version = version
      });
      
      // Create AutoScaling target
      var as = alias.AddAutoScaling(new Struct { MaxCapacity = 50 });
      
      // Configure Target Tracking
      as.ScaleOnUtilization(new Struct {
          UtilizationTarget = 0.5
      });
      
      // Configure Scheduled Scaling
      as.ScaleOnSchedule("ScaleUpInTheMorning", new Struct {
          Schedule = appscaling.Schedule.Cron(new Struct { Hour = "8", Minute = "0" }),
          MinCapacity = 20
      });
      // Example automatically generated. See https://github.com/aws/jsii/issues/826
      using Amazon.CDK.AWS.ApplicationAutoScaling;
      using Amazon.CDK;
      using Lib;
      
      /**
      * Stack verification steps:
      * aws application-autoscaling describe-scalable-targets --service-namespace lambda --resource-ids function:<function name>:prod
      * has a minCapacity of 3 and maxCapacity of 50
      */
      class TestStack : Stack
      {
          public MyClass(App scope, string id) : base(scope, id)
          {
      
              Function fn = new Function(this, "MyLambda", new FunctionProps {
                  Code = new InlineCode("exports.handler = async () => { console.log('hello world'); };"),
                  Handler = "index.handler",
                  Runtime = Runtime.NODEJS_10_X
              });
      
              Version version = fn.AddVersion("1", undefined, "integ-test");
      
              Alias alias = new Alias(this, "Alias", new AliasProps {
                  AliasName = "prod",
                  Version = version
              });
      
              IScalableFunctionAttribute scalingTarget = alias.AddAutoScaling(new AutoScalingOptions { MinCapacity = 3, MaxCapacity = 50 });
      
              scalingTarget.ScaleOnUtilization(new UtilizationScalingOptions {
                  UtilizationTarget = 0.5
              });
      
              scalingTarget.ScaleOnSchedule("ScaleUpInTheMorning", new ScalingSchedule {
                  Schedule = Schedule.Cron(new CronOptions { Hour = "8", Minute = "0" }),
                  MinCapacity = 20
              });
      
              scalingTarget.ScaleOnSchedule("ScaleDownAtNight", new ScalingSchedule {
                  Schedule = Schedule.Cron(new CronOptions { Hour = "20", Minute = "0" }),
                  MaxCapacity = 20
              });
      
              new CfnOutput(this, "FunctionName", new CfnOutputProps {
                  Value = fn.FunctionName
              });
          }
      }
      
      App app = new App();
      
      new TestStack(app, "aws-lambda-autoscaling");
      
      app.Synth();

      See the AWS documentation on autoscaling lambda functions.

      Log Group

      Lambda functions automatically create a log group with the name /aws/lambda/<function-name> upon first execution with log data set to never expire.

      The logRetention property can be used to set a different expiration period.

      It is possible to obtain the function's log group as a logs.ILogGroup by calling the logGroup property of the Function construct.

      By default, CDK uses the AWS SDK retry options when creating a log group. The logRetentionRetryOptions property allows you to customize the maximum number of retries and base backoff duration.

      Note that, if either logRetention is set or logGroup property is called, a CloudFormation custom resource is added to the stack that pre-creates the log group as part of the stack deployment, if it already doesn't exist, and sets the correct log retention period (never expire, by default).

      Further note that, if the log group already exists and the logRetention is not set, the custom resource will reset the log retention to never expire even if it was configured with a different value.

      FileSystem Access

      You can configure a function to mount an Amazon Elastic File System (Amazon EFS) to a directory in your runtime environment with the filesystem property. To access Amazon EFS from lambda function, the Amazon EFS access point will be required.

      The following sample allows the lambda function to mount the Amazon EFS access point to /mnt/msg in the runtime environment and access the filesystem with the POSIX identity defined in posixUser.

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      // create a new Amazon EFS filesystem
      var fileSystem = new efs.FileSystem(stack, "Efs", new Struct { Vpc = vpc });
      
      // create a new access point from the filesystem
      var accessPoint = fileSystem.AddAccessPoint("AccessPoint", new Struct {
          // 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 = new Struct {
              OwnerUid = "1001",
              OwnerGid = "1001",
              Permissions = "750"
          },
          // enforce the POSIX identity so lambda function will access with this identity
          PosixUser = new Struct {
              Uid = "1001",
              Gid = "1001"
          }
      });
      
      var fn = new lambda.Function(stack, "MyLambda", new Struct {
          Code = code,
          Handler = handler,
          Runtime = runtime,
          Vpc = vpc,
          // mount the access point to /mnt/msg in the lambda runtime environment
          Filesystem = lambda.FileSystem.FromEfsAccessPoint(accessPoint, "/mnt/msg")
      });

      Singleton Function

      The SingletonFunction construct is a way to guarantee that a lambda function will be guaranteed to be part of the stack, once and only once, irrespective of how many times the construct is declared to be part of the stack. This is guaranteed as long as the uuid property and the optional lambdaPurpose property stay the same whenever they're declared into the stack.

      A typical use case of this function is when a higher level construct needs to declare a Lambda function as part of it but needs to guarantee that the function is declared once. However, a user of this higher level construct can declare it any number of times and with different properties. Using SingletonFunction here with a fixed uuid will guarantee this.

      For example, the LogRetention construct requires only one single lambda function for all different log groups whose retention it seeks to manage.

      Bundling Asset Code

      When using lambda.Code.fromAsset(path) it is possible to bundle the code by running a command in a Docker container. The asset path will be mounted at /asset-input. The Docker container is responsible for putting content at /asset-output. The content at /asset-output will be zipped and used as Lambda code.

      Example with Python:

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      new lambda.Function(this, "Function", new Struct {
          Code = lambda.Code.FromAsset(path.Join(__dirname, "my-python-handler"), new Struct {
              Bundling = new Struct {
                  Image = lambda.Runtime.PYTHON_3_6.BundlingDockerImage,
                  Command = new [] { "bash", "-c", "pip install -r requirements.txt -t /asset-output && cp -au . /asset-output" }
              }
          }),
          Runtime = lambda.Runtime.PYTHON_3_6,
          Handler = "index.handler"
      });

      Runtimes expose a bundlingDockerImage property that points to the AWS SAM build image.

      Use cdk.BundlingDockerImage.fromRegistry(image) to use an existing image or cdk.BundlingDockerImage.fromAsset(path) to build a specific image:

      // Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
      using Amazon.CDK;
      
      new lambda.Function(this, "Function", new Struct {
          Code = lambda.Code.FromAsset("/path/to/handler", new Struct {
              Bundling = new Struct {
                  Image = BundlingDockerImage.FromAsset("/path/to/dir/with/DockerFile", new DockerBuildOptions {
                      BuildArgs = new Dictionary<string, string> {
                          { "ARG1", "value1" }
                      }
                  }),
                  Command = new [] { "my", "cool", "command" }
              }
          })
      });

      Language-specific APIs

      Language-specific higher level constructs are provided in separate modules:

        Classes

        Alias

        A new alias to a particular version of a Lambda function.

        AliasAttributes
        AliasOptions

        Options for lambda.Alias.

        AliasProps

        Properties for a new Lambda alias.

        AssetCode

        Lambda code from a local directory.

        AssetImageCode

        Represents an ECR image that will be constructed from the specified asset and can be bound as Lambda code.

        AssetImageCodeProps

        Properties to initialize a new AssetImage.

        AutoScalingOptions

        Properties for enabling Lambda autoscaling.

        CfnAlias

        A CloudFormation AWS::Lambda::Alias.

        CfnAlias.AliasRoutingConfigurationProperty
        CfnAlias.ProvisionedConcurrencyConfigurationProperty
        CfnAlias.VersionWeightProperty
        CfnAliasProps

        Properties for defining a AWS::Lambda::Alias.

        CfnCodeSigningConfig

        A CloudFormation AWS::Lambda::CodeSigningConfig.

        CfnCodeSigningConfig.AllowedPublishersProperty
        CfnCodeSigningConfig.CodeSigningPoliciesProperty
        CfnCodeSigningConfigProps

        Properties for defining a AWS::Lambda::CodeSigningConfig.

        CfnEventInvokeConfig

        A CloudFormation AWS::Lambda::EventInvokeConfig.

        CfnEventInvokeConfig.DestinationConfigProperty
        CfnEventInvokeConfig.OnFailureProperty
        CfnEventInvokeConfig.OnSuccessProperty
        CfnEventInvokeConfigProps

        Properties for defining a AWS::Lambda::EventInvokeConfig.

        CfnEventSourceMapping

        A CloudFormation AWS::Lambda::EventSourceMapping.

        CfnEventSourceMapping.DestinationConfigProperty
        CfnEventSourceMapping.EndpointsProperty
        CfnEventSourceMapping.OnFailureProperty
        CfnEventSourceMapping.SelfManagedEventSourceProperty
        CfnEventSourceMapping.SourceAccessConfigurationProperty
        CfnEventSourceMappingProps

        Properties for defining a AWS::Lambda::EventSourceMapping.

        CfnFunction

        A CloudFormation AWS::Lambda::Function.

        CfnFunction.CodeProperty
        CfnFunction.DeadLetterConfigProperty
        CfnFunction.EnvironmentProperty
        CfnFunction.FileSystemConfigProperty
        CfnFunction.ImageConfigProperty
        CfnFunction.TracingConfigProperty
        CfnFunction.VpcConfigProperty
        CfnFunctionProps

        Properties for defining a AWS::Lambda::Function.

        CfnLayerVersion

        A CloudFormation AWS::Lambda::LayerVersion.

        CfnLayerVersion.ContentProperty
        CfnLayerVersionPermission

        A CloudFormation AWS::Lambda::LayerVersionPermission.

        CfnLayerVersionPermissionProps

        Properties for defining a AWS::Lambda::LayerVersionPermission.

        CfnLayerVersionProps

        Properties for defining a AWS::Lambda::LayerVersion.

        CfnParametersCode

        Lambda code defined using 2 CloudFormation parameters.

        CfnParametersCodeProps

        Construction properties for {@link CfnParametersCode}.

        CfnPermission

        A CloudFormation AWS::Lambda::Permission.

        CfnPermissionProps

        Properties for defining a AWS::Lambda::Permission.

        CfnVersion

        A CloudFormation AWS::Lambda::Version.

        CfnVersion.ProvisionedConcurrencyConfigurationProperty
        CfnVersionProps

        Properties for defining a AWS::Lambda::Version.

        Code

        Represents the Lambda Handler Code.

        CodeConfig

        Result of binding Code into a Function.

        CodeImageConfig

        Result of the bind when an ECR image is used.

        DestinationConfig

        A destination configuration.

        DestinationOptions

        Options when binding a destination to a function.

        DestinationType

        The type of destination.

        DlqDestinationConfig

        A destination configuration.

        DockerImageCode

        Code property for the DockerImageFunction construct.

        DockerImageFunction

        Create a lambda function where the handler is a docker image.

        DockerImageFunctionProps

        Properties to configure a new DockerImageFunction construct.

        EcrImageCode

        Represents a Docker image in ECR that can be bound as Lambda Code.

        EcrImageCodeProps

        Properties to initialize a new EcrImageCode.

        EnvironmentOptions

        Environment variables options.

        EventInvokeConfig

        Configure options for asynchronous invocation on a version or an alias.

        EventInvokeConfigOptions

        Options to add an EventInvokeConfig to a function.

        EventInvokeConfigProps

        Properties for an EventInvokeConfig.

        EventSourceMapping

        Defines a Lambda EventSourceMapping resource.

        EventSourceMappingOptions
        EventSourceMappingProps

        Properties for declaring a new event source mapping.

        FileSystem

        (experimental) Represents the filesystem for the Lambda function.

        FileSystemConfig

        (experimental) FileSystem configurations for the Lambda function.

        Function

        Deploys a file from from inside the construct library as a function.

        FunctionAttributes

        Represents a Lambda function defined outside of this stack.

        FunctionBase
        FunctionOptions

        Non runtime options.

        FunctionProps
        Handler

        Lambda function handler.

        InlineCode

        Lambda code from an inline string (limited to 4KiB).

        LambdaRuntimeProps
        LayerVersion

        Defines a new Lambda Layer version.

        LayerVersionAttributes

        Properties necessary to import a LayerVersion.

        LayerVersionOptions

        Non runtime options.

        LayerVersionPermission

        Identification of an account (or organization) that is allowed to access a Lambda Layer Version.

        LayerVersionProps
        LogRetention

        (deprecated) Creates a custom resource to control the retention policy of a CloudWatch Logs log group.

        LogRetentionProps

        (deprecated) Construction properties for a LogRetention.

        LogRetentionRetryOptions

        (deprecated) Retry options for all AWS API calls.

        Permission

        Represents a permission statement that can be added to a Lambda's resource policy via the addToResourcePolicy method.

        QualifiedFunctionBase
        ResourceBindOptions
        Runtime

        Lambda function runtime environment.

        RuntimeFamily
        S3Code

        Lambda code from an S3 archive.

        SingletonFunction

        A Lambda that will only ever be added to a stack once.

        SingletonFunctionProps

        Properties for a newly created singleton Lambda.

        StartingPosition

        The position in the DynamoDB, Kinesis or MSK stream where AWS Lambda should start reading.

        Tracing

        X-Ray Tracing Modes (https://docs.aws.amazon.com/lambda/latest/dg/API_TracingConfig.html).

        UtilizationScalingOptions

        Options for enabling Lambda utilization tracking.

        Version_

        A single newly-deployed version of a Lambda function.

        VersionAttributes
        VersionOptions

        Options for lambda.Version.

        VersionProps

        Properties for a new Lambda version.

        VersionWeight

        A version/weight pair for routing traffic to Lambda functions.

        Interfaces

        CfnAlias.IAliasRoutingConfigurationProperty
        CfnAlias.IProvisionedConcurrencyConfigurationProperty
        CfnAlias.IVersionWeightProperty
        CfnCodeSigningConfig.IAllowedPublishersProperty
        CfnCodeSigningConfig.ICodeSigningPoliciesProperty
        CfnEventInvokeConfig.IDestinationConfigProperty
        CfnEventInvokeConfig.IOnFailureProperty
        CfnEventInvokeConfig.IOnSuccessProperty
        CfnEventSourceMapping.IDestinationConfigProperty
        CfnEventSourceMapping.IEndpointsProperty
        CfnEventSourceMapping.IOnFailureProperty
        CfnEventSourceMapping.ISelfManagedEventSourceProperty
        CfnEventSourceMapping.ISourceAccessConfigurationProperty
        CfnFunction.ICodeProperty
        CfnFunction.IDeadLetterConfigProperty
        CfnFunction.IEnvironmentProperty
        CfnFunction.IFileSystemConfigProperty
        CfnFunction.IImageConfigProperty
        CfnFunction.ITracingConfigProperty
        CfnFunction.IVpcConfigProperty
        CfnLayerVersion.IContentProperty
        CfnVersion.IProvisionedConcurrencyConfigurationProperty
        IAlias
        IAliasAttributes
        IAliasOptions

        Options for lambda.Alias.

        IAliasProps

        Properties for a new Lambda alias.

        IAssetImageCodeProps

        Properties to initialize a new AssetImage.

        IAutoScalingOptions

        Properties for enabling Lambda autoscaling.

        ICfnAliasProps

        Properties for defining a AWS::Lambda::Alias.

        ICfnCodeSigningConfigProps

        Properties for defining a AWS::Lambda::CodeSigningConfig.

        ICfnEventInvokeConfigProps

        Properties for defining a AWS::Lambda::EventInvokeConfig.

        ICfnEventSourceMappingProps

        Properties for defining a AWS::Lambda::EventSourceMapping.

        ICfnFunctionProps

        Properties for defining a AWS::Lambda::Function.

        ICfnLayerVersionPermissionProps

        Properties for defining a AWS::Lambda::LayerVersionPermission.

        ICfnLayerVersionProps

        Properties for defining a AWS::Lambda::LayerVersion.

        ICfnParametersCodeProps

        Construction properties for {@link CfnParametersCode}.

        ICfnPermissionProps

        Properties for defining a AWS::Lambda::Permission.

        ICfnVersionProps

        Properties for defining a AWS::Lambda::Version.

        ICodeConfig

        Result of binding Code into a Function.

        ICodeImageConfig

        Result of the bind when an ECR image is used.

        IDestination

        A Lambda destination.

        IDestinationConfig

        A destination configuration.

        IDestinationOptions

        Options when binding a destination to a function.

        IDlqDestinationConfig

        A destination configuration.

        IDockerImageFunctionProps

        Properties to configure a new DockerImageFunction construct.

        IEcrImageCodeProps

        Properties to initialize a new EcrImageCode.

        IEnvironmentOptions

        Environment variables options.

        IEventInvokeConfigOptions

        Options to add an EventInvokeConfig to a function.

        IEventInvokeConfigProps

        Properties for an EventInvokeConfig.

        IEventSource

        An abstract class which represents an AWS Lambda event source.

        IEventSourceDlq

        A DLQ for an event source.

        IEventSourceMapping

        Represents an event source mapping for a lambda function.

        IEventSourceMappingOptions
        IEventSourceMappingProps

        Properties for declaring a new event source mapping.

        IFileSystemConfig

        (experimental) FileSystem configurations for the Lambda function.

        IFunction
        IFunctionAttributes

        Represents a Lambda function defined outside of this stack.

        IFunctionOptions

        Non runtime options.

        IFunctionProps
        ILambdaRuntimeProps
        ILayerVersion
        ILayerVersionAttributes

        Properties necessary to import a LayerVersion.

        ILayerVersionOptions

        Non runtime options.

        ILayerVersionPermission

        Identification of an account (or organization) that is allowed to access a Lambda Layer Version.

        ILayerVersionProps
        ILogRetentionProps

        (deprecated) Construction properties for a LogRetention.

        ILogRetentionRetryOptions

        (deprecated) Retry options for all AWS API calls.

        IPermission

        Represents a permission statement that can be added to a Lambda's resource policy via the addToResourcePolicy method.

        IResourceBindOptions
        IScalableFunctionAttribute

        Interface for scalable attributes.

        ISingletonFunctionProps

        Properties for a newly created singleton Lambda.

        IUtilizationScalingOptions

        Options for enabling Lambda utilization tracking.

        IVersion
        IVersionAttributes
        IVersionOptions

        Options for lambda.Version.

        IVersionProps

        Properties for a new Lambda version.

        IVersionWeight

        A version/weight pair for routing traffic to Lambda functions.

        Back to top Generated by DocFX