Class DockerImageFunction.Builder

java.lang.Object
software.amazon.awscdk.services.lambda.DockerImageFunction.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<DockerImageFunction>
Enclosing class:
DockerImageFunction

@Stability(Stable) public static final class DockerImageFunction.Builder extends Object implements software.amazon.jsii.Builder<DockerImageFunction>
A fluent builder for DockerImageFunction.
  • Method Details

    • create

      @Stability(Stable) public static DockerImageFunction.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of DockerImageFunction.Builder.
    • maxEventAge

      @Stability(Stable) public DockerImageFunction.Builder maxEventAge(Duration maxEventAge)
      The maximum age of a request that Lambda sends to a function for processing.

      Minimum: 60 seconds Maximum: 6 hours

      Default: Duration.hours(6)

      Parameters:
      maxEventAge - The maximum age of a request that Lambda sends to a function for processing. This parameter is required.
      Returns:
      this
    • onFailure

      @Stability(Stable) public DockerImageFunction.Builder onFailure(IDestination onFailure)
      The destination for failed invocations.

      Default: - no destination

      Parameters:
      onFailure - The destination for failed invocations. This parameter is required.
      Returns:
      this
    • onSuccess

      @Stability(Stable) public DockerImageFunction.Builder onSuccess(IDestination onSuccess)
      The destination for successful invocations.

      Default: - no destination

      Parameters:
      onSuccess - The destination for successful invocations. This parameter is required.
      Returns:
      this
    • retryAttempts

      @Stability(Stable) public DockerImageFunction.Builder retryAttempts(Number retryAttempts)
      The maximum number of times to retry when the function returns an error.

      Minimum: 0 Maximum: 2

      Default: 2

      Parameters:
      retryAttempts - The maximum number of times to retry when the function returns an error. This parameter is required.
      Returns:
      this
    • adotInstrumentation

      @Stability(Stable) public DockerImageFunction.Builder adotInstrumentation(AdotInstrumentationConfig adotInstrumentation)
      Specify the configuration of AWS Distro for OpenTelemetry (ADOT) instrumentation.

      Default: - No ADOT instrumentation

      Parameters:
      adotInstrumentation - Specify the configuration of AWS Distro for OpenTelemetry (ADOT) instrumentation. This parameter is required.
      Returns:
      this
      See Also:
    • allowAllIpv6Outbound

      @Stability(Stable) public DockerImageFunction.Builder allowAllIpv6Outbound(Boolean allowAllIpv6Outbound)
      Whether to allow the Lambda to send all ipv6 network traffic.

      If set to true, there will only be a single egress rule which allows all outbound ipv6 traffic. If set to false, you must individually add traffic rules to allow the Lambda to connect to network targets using ipv6.

      Do not specify this property if the securityGroups or securityGroup property is set. Instead, configure allowAllIpv6Outbound directly on the security group.

      Default: false

      Parameters:
      allowAllIpv6Outbound - Whether to allow the Lambda to send all ipv6 network traffic. This parameter is required.
      Returns:
      this
    • allowAllOutbound

      @Stability(Stable) public DockerImageFunction.Builder allowAllOutbound(Boolean allowAllOutbound)
      Whether to allow the Lambda to send all network traffic (except ipv6).

      If set to false, you must individually add traffic rules to allow the Lambda to connect to network targets.

      Do not specify this property if the securityGroups or securityGroup property is set. Instead, configure allowAllOutbound directly on the security group.

      Default: true

      Parameters:
      allowAllOutbound - Whether to allow the Lambda to send all network traffic (except ipv6). This parameter is required.
      Returns:
      this
    • allowPublicSubnet

      @Stability(Stable) public DockerImageFunction.Builder allowPublicSubnet(Boolean allowPublicSubnet)
      Lambda Functions in a public subnet can NOT access the internet.

      Use this property to acknowledge this limitation and still place the function in a public subnet.

      Default: false

      Parameters:
      allowPublicSubnet - Lambda Functions in a public subnet can NOT access the internet. This parameter is required.
      Returns:
      this
      See Also:
    • applicationLogLevel

      @Stability(Deprecated) @Deprecated public DockerImageFunction.Builder applicationLogLevel(String applicationLogLevel)
      Deprecated.
      Use applicationLogLevelV2 as a property instead.
      (deprecated) Sets the application log level for the function.

      Default: "INFO"

      Parameters:
      applicationLogLevel - Sets the application log level for the function. This parameter is required.
      Returns:
      this
    • applicationLogLevelV2

      @Stability(Stable) public DockerImageFunction.Builder applicationLogLevelV2(ApplicationLogLevel applicationLogLevelV2)
      Sets the application log level for the function.

      Default: ApplicationLogLevel.INFO

      Parameters:
      applicationLogLevelV2 - Sets the application log level for the function. This parameter is required.
      Returns:
      this
    • architecture

      @Stability(Stable) public DockerImageFunction.Builder architecture(Architecture architecture)
      The system architectures compatible with this lambda function.

      Default: Architecture.X86_64

      Parameters:
      architecture - The system architectures compatible with this lambda function. This parameter is required.
      Returns:
      this
    • codeSigningConfig

      @Stability(Stable) public DockerImageFunction.Builder codeSigningConfig(ICodeSigningConfig codeSigningConfig)
      Code signing config associated with this function.

      Default: - Not Sign the Code

      Parameters:
      codeSigningConfig - Code signing config associated with this function. This parameter is required.
      Returns:
      this
    • currentVersionOptions

      @Stability(Stable) public DockerImageFunction.Builder currentVersionOptions(VersionOptions currentVersionOptions)
      Options for the lambda.Version resource automatically created by the fn.currentVersion method.

      Default: - default options as described in `VersionOptions`

      Parameters:
      currentVersionOptions - Options for the lambda.Version resource automatically created by the fn.currentVersion method. This parameter is required.
      Returns:
      this
    • deadLetterQueue

      @Stability(Stable) public DockerImageFunction.Builder deadLetterQueue(IQueue deadLetterQueue)
      The SQS queue to use if DLQ is enabled.

      If SNS topic is desired, specify deadLetterTopic property instead.

      Default: - SQS queue with 14 day retention period if `deadLetterQueueEnabled` is `true`

      Parameters:
      deadLetterQueue - The SQS queue to use if DLQ is enabled. This parameter is required.
      Returns:
      this
    • deadLetterQueueEnabled

      @Stability(Stable) public DockerImageFunction.Builder deadLetterQueueEnabled(Boolean deadLetterQueueEnabled)
      Enabled DLQ.

      If deadLetterQueue is undefined, an SQS queue with default options will be defined for your Function.

      Default: - false unless `deadLetterQueue` is set, which implies DLQ is enabled.

      Parameters:
      deadLetterQueueEnabled - Enabled DLQ. This parameter is required.
      Returns:
      this
    • deadLetterTopic

      @Stability(Stable) public DockerImageFunction.Builder deadLetterTopic(ITopic deadLetterTopic)
      The SNS topic to use as a DLQ.

      Note that if deadLetterQueueEnabled is set to true, an SQS queue will be created rather than an SNS topic. Using an SNS topic as a DLQ requires this property to be set explicitly.

      Default: - no SNS topic

      Parameters:
      deadLetterTopic - The SNS topic to use as a DLQ. This parameter is required.
      Returns:
      this
    • description

      @Stability(Stable) public DockerImageFunction.Builder description(String description)
      A description of the function.

      Default: - No description.

      Parameters:
      description - A description of the function. This parameter is required.
      Returns:
      this
    • environment

      @Stability(Stable) public DockerImageFunction.Builder environment(Map<String,String> environment)
      Key-value pairs that Lambda caches and makes available for your Lambda functions.

      Use environment variables to apply configuration changes, such as test and production environment configurations, without changing your Lambda function source code.

      Default: - No environment variables.

      Parameters:
      environment - Key-value pairs that Lambda caches and makes available for your Lambda functions. This parameter is required.
      Returns:
      this
    • environmentEncryption

      @Stability(Stable) public DockerImageFunction.Builder environmentEncryption(IKey environmentEncryption)
      The AWS KMS key that's used to encrypt your function's environment variables.

      Default: - AWS Lambda creates and uses an AWS managed customer master key (CMK).

      Parameters:
      environmentEncryption - The AWS KMS key that's used to encrypt your function's environment variables. This parameter is required.
      Returns:
      this
    • ephemeralStorageSize

      @Stability(Stable) public DockerImageFunction.Builder ephemeralStorageSize(Size ephemeralStorageSize)
      The size of the function’s /tmp directory in MiB.

      Default: 512 MiB

      Parameters:
      ephemeralStorageSize - The size of the function’s /tmp directory in MiB. This parameter is required.
      Returns:
      this
    • events

      @Stability(Stable) public DockerImageFunction.Builder events(List<? extends IEventSource> events)
      Event sources for this function.

      You can also add event sources using addEventSource.

      Default: - No event sources.

      Parameters:
      events - Event sources for this function. This parameter is required.
      Returns:
      this
    • filesystem

      @Stability(Stable) public DockerImageFunction.Builder filesystem(FileSystem filesystem)
      The filesystem configuration for the lambda function.

      Default: - will not mount any filesystem

      Parameters:
      filesystem - The filesystem configuration for the lambda function. This parameter is required.
      Returns:
      this
    • functionName

      @Stability(Stable) public DockerImageFunction.Builder functionName(String functionName)
      A name for the function.

      Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the function's name. For more information, see Name Type.

      Parameters:
      functionName - A name for the function. This parameter is required.
      Returns:
      this
    • initialPolicy

      @Stability(Stable) public DockerImageFunction.Builder initialPolicy(List<? extends PolicyStatement> initialPolicy)
      Initial policy statements to add to the created Lambda Role.

      You can call addToRolePolicy to the created lambda to add statements post creation.

      Default: - No policy statements are added to the created Lambda role.

      Parameters:
      initialPolicy - Initial policy statements to add to the created Lambda Role. This parameter is required.
      Returns:
      this
    • insightsVersion

      @Stability(Stable) public DockerImageFunction.Builder insightsVersion(LambdaInsightsVersion insightsVersion)
      Specify the version of CloudWatch Lambda insights to use for monitoring.

      Default: - No Lambda Insights

      Parameters:
      insightsVersion - Specify the version of CloudWatch Lambda insights to use for monitoring. This parameter is required.
      Returns:
      this
      See Also:
    • ipv6AllowedForDualStack

      @Stability(Stable) public DockerImageFunction.Builder ipv6AllowedForDualStack(Boolean ipv6AllowedForDualStack)
      Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets.

      Only used if 'vpc' is supplied.

      Default: false

      Parameters:
      ipv6AllowedForDualStack - Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets. This parameter is required.
      Returns:
      this
    • layers

      @Stability(Stable) public DockerImageFunction.Builder layers(List<? extends ILayerVersion> layers)
      A list of layers to add to the function's execution environment.

      You can configure your Lambda function to pull in additional code during initialization in the form of layers. Layers are packages of libraries or other dependencies that can be used by multiple functions.

      Default: - No layers.

      Parameters:
      layers - A list of layers to add to the function's execution environment. This parameter is required.
      Returns:
      this
    • logFormat

      @Stability(Deprecated) @Deprecated public DockerImageFunction.Builder logFormat(String logFormat)
      Deprecated.
      Use loggingFormat as a property instead.
      (deprecated) Sets the logFormat for the function.

      Default: "Text"

      Parameters:
      logFormat - Sets the logFormat for the function. This parameter is required.
      Returns:
      this
    • loggingFormat

      @Stability(Stable) public DockerImageFunction.Builder loggingFormat(LoggingFormat loggingFormat)
      Sets the loggingFormat for the function.

      Default: LoggingFormat.TEXT

      Parameters:
      loggingFormat - Sets the loggingFormat for the function. This parameter is required.
      Returns:
      this
    • logGroup

      @Stability(Stable) public DockerImageFunction.Builder logGroup(ILogGroup logGroup)
      The log group the function sends logs to.

      By default, Lambda functions send logs to an automatically created default log group named /aws/lambda/. However you cannot change the properties of this auto-created log group using the AWS CDK, e.g. you cannot set a different log retention.

      Use the logGroup property to create a fully customizable LogGroup ahead of time, and instruct the Lambda function to send logs to it.

      Providing a user-controlled log group was rolled out to commercial regions on 2023-11-16. If you are deploying to another type of region, please check regional availability first.

      Default: `/aws/lambda/${this.functionName}` - default log group created by Lambda

      Parameters:
      logGroup - The log group the function sends logs to. This parameter is required.
      Returns:
      this
    • logRetention

      @Stability(Stable) public DockerImageFunction.Builder logRetention(RetentionDays logRetention)
      The number of days log events are kept in CloudWatch Logs.

      When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to INFINITE.

      This is a legacy API and we strongly recommend you move away from it if you can. Instead create a fully customizable log group with logs.LogGroup and use the logGroup property to instruct the Lambda function to send logs to it. Migrating from logRetention to logGroup will cause the name of the log group to change. Users and code and referencing the name verbatim will have to adjust.

      In AWS CDK code, you can access the log group name directly from the LogGroup construct:

       import software.amazon.awscdk.services.logs.*;
       LogGroup myLogGroup;
       myLogGroup.getLogGroupName();
       

      Default: logs.RetentionDays.INFINITE

      Parameters:
      logRetention - The number of days log events are kept in CloudWatch Logs. This parameter is required.
      Returns:
      this
    • logRetentionRetryOptions

      @Stability(Stable) public DockerImageFunction.Builder logRetentionRetryOptions(LogRetentionRetryOptions logRetentionRetryOptions)
      When log retention is specified, a custom resource attempts to create the CloudWatch log group.

      These options control the retry policy when interacting with CloudWatch APIs.

      This is a legacy API and we strongly recommend you migrate to logGroup if you can. logGroup allows you to create a fully customizable log group and instruct the Lambda function to send logs to it.

      Default: - Default AWS SDK retry options.

      Parameters:
      logRetentionRetryOptions - When log retention is specified, a custom resource attempts to create the CloudWatch log group. This parameter is required.
      Returns:
      this
    • logRetentionRole

      @Stability(Stable) public DockerImageFunction.Builder logRetentionRole(IRole logRetentionRole)
      The IAM role for the Lambda function associated with the custom resource that sets the retention policy.

      This is a legacy API and we strongly recommend you migrate to logGroup if you can. logGroup allows you to create a fully customizable log group and instruct the Lambda function to send logs to it.

      Default: - A new role is created.

      Parameters:
      logRetentionRole - The IAM role for the Lambda function associated with the custom resource that sets the retention policy. This parameter is required.
      Returns:
      this
    • memorySize

      @Stability(Stable) public DockerImageFunction.Builder memorySize(Number memorySize)
      The amount of memory, in MB, that is allocated to your Lambda function.

      Lambda uses this value to proportionally allocate the amount of CPU power. For more information, see Resource Model in the AWS Lambda Developer Guide.

      Default: 128

      Parameters:
      memorySize - The amount of memory, in MB, that is allocated to your Lambda function. This parameter is required.
      Returns:
      this
    • paramsAndSecrets

      @Stability(Stable) public DockerImageFunction.Builder paramsAndSecrets(ParamsAndSecretsLayerVersion paramsAndSecrets)
      Specify the configuration of Parameters and Secrets Extension.

      Default: - No Parameters and Secrets Extension

      Parameters:
      paramsAndSecrets - Specify the configuration of Parameters and Secrets Extension. This parameter is required.
      Returns:
      this
      See Also:
    • profiling

      @Stability(Stable) public DockerImageFunction.Builder profiling(Boolean profiling)
      Enable profiling.

      Default: - No profiling.

      Parameters:
      profiling - Enable profiling. This parameter is required.
      Returns:
      this
      See Also:
    • profilingGroup

      @Stability(Stable) public DockerImageFunction.Builder profilingGroup(IProfilingGroup profilingGroup)
      Profiling Group.

      Default: - A new profiling group will be created if `profiling` is set.

      Parameters:
      profilingGroup - Profiling Group. This parameter is required.
      Returns:
      this
      See Also:
    • recursiveLoop

      @Stability(Stable) public DockerImageFunction.Builder recursiveLoop(RecursiveLoop recursiveLoop)
      Sets the Recursive Loop Protection for Lambda Function.

      It lets Lambda detect and terminate unintended recursive loops.

      Default: RecursiveLoop.Terminate

      Parameters:
      recursiveLoop - Sets the Recursive Loop Protection for Lambda Function. This parameter is required.
      Returns:
      this
    • reservedConcurrentExecutions

      @Stability(Stable) public DockerImageFunction.Builder reservedConcurrentExecutions(Number reservedConcurrentExecutions)
      The maximum of concurrent executions you want to reserve for the function.

      Default: - No specific limit - account limit.

      Parameters:
      reservedConcurrentExecutions - The maximum of concurrent executions you want to reserve for the function. This parameter is required.
      Returns:
      this
      See Also:
    • role

      @Stability(Stable) public DockerImageFunction.Builder role(IRole role)
      Lambda execution role.

      This is the role that will be assumed by the function upon execution. It controls the permissions that the function will have. The Role must be assumable by the 'lambda.amazonaws.com' service principal.

      The default Role automatically has permissions granted for Lambda execution. If you provide a Role, you must add the relevant AWS managed policies yourself.

      The relevant managed policies are "service-role/AWSLambdaBasicExecutionRole" and "service-role/AWSLambdaVPCAccessExecutionRole".

      Default: - A unique role will be generated for this lambda function. Both supplied and generated roles can always be changed by calling `addToRolePolicy`.

      Parameters:
      role - Lambda execution role. This parameter is required.
      Returns:
      this
    • runtimeManagementMode

      @Stability(Stable) public DockerImageFunction.Builder runtimeManagementMode(RuntimeManagementMode runtimeManagementMode)
      Sets the runtime management configuration for a function's version.

      Default: Auto

      Parameters:
      runtimeManagementMode - Sets the runtime management configuration for a function's version. This parameter is required.
      Returns:
      this
    • securityGroups

      @Stability(Stable) public DockerImageFunction.Builder securityGroups(List<? extends ISecurityGroup> securityGroups)
      The list of security groups to associate with the Lambda's network interfaces.

      Only used if 'vpc' is supplied.

      Default: - If the function is placed within a VPC and a security group is not specified, either by this or securityGroup prop, a dedicated security group will be created for this function.

      Parameters:
      securityGroups - The list of security groups to associate with the Lambda's network interfaces. This parameter is required.
      Returns:
      this
    • snapStart

      @Stability(Stable) public DockerImageFunction.Builder snapStart(SnapStartConf snapStart)
      Enable SnapStart for Lambda Function.

      SnapStart is currently supported for Java 11, Java 17, Python 3.12, Python 3.13, and .NET 8 runtime

      Default: - No snapstart

      Parameters:
      snapStart - Enable SnapStart for Lambda Function. This parameter is required.
      Returns:
      this
    • systemLogLevel

      @Stability(Deprecated) @Deprecated public DockerImageFunction.Builder systemLogLevel(String systemLogLevel)
      Deprecated.
      Use systemLogLevelV2 as a property instead.
      (deprecated) Sets the system log level for the function.

      Default: "INFO"

      Parameters:
      systemLogLevel - Sets the system log level for the function. This parameter is required.
      Returns:
      this
    • systemLogLevelV2

      @Stability(Stable) public DockerImageFunction.Builder systemLogLevelV2(SystemLogLevel systemLogLevelV2)
      Sets the system log level for the function.

      Default: SystemLogLevel.INFO

      Parameters:
      systemLogLevelV2 - Sets the system log level for the function. This parameter is required.
      Returns:
      this
    • timeout

      @Stability(Stable) public DockerImageFunction.Builder timeout(Duration timeout)
      The function execution time (in seconds) after which Lambda terminates the function.

      Because the execution time affects cost, set this value based on the function's expected execution time.

      Default: Duration.seconds(3)

      Parameters:
      timeout - The function execution time (in seconds) after which Lambda terminates the function. This parameter is required.
      Returns:
      this
    • tracing

      @Stability(Stable) public DockerImageFunction.Builder tracing(Tracing tracing)
      Enable AWS X-Ray Tracing for Lambda Function.

      Default: Tracing.Disabled

      Parameters:
      tracing - Enable AWS X-Ray Tracing for Lambda Function. This parameter is required.
      Returns:
      this
    • vpc

      @Stability(Stable) public DockerImageFunction.Builder vpc(IVpc vpc)
      VPC network to place Lambda network interfaces.

      Specify this if the Lambda function needs to access resources in a VPC. This is required when vpcSubnets is specified.

      Default: - Function is not placed within a VPC.

      Parameters:
      vpc - VPC network to place Lambda network interfaces. This parameter is required.
      Returns:
      this
    • vpcSubnets

      @Stability(Stable) public DockerImageFunction.Builder vpcSubnets(SubnetSelection vpcSubnets)
      Where to place the network interfaces within the VPC.

      This requires vpc to be specified in order for interfaces to actually be placed in the subnets. If vpc is not specify, this will raise an error.

      Note: Internet access for Lambda Functions requires a NAT Gateway, so picking public subnets is not allowed (unless allowPublicSubnet is set to true).

      Default: - the Vpc default strategy if not specified

      Parameters:
      vpcSubnets - Where to place the network interfaces within the VPC. This parameter is required.
      Returns:
      this
    • code

      @Stability(Stable) public DockerImageFunction.Builder code(DockerImageCode code)
      The source code of your Lambda function.

      You can point to a file in an Amazon Simple Storage Service (Amazon S3) bucket or specify your source code as inline text.

      Parameters:
      code - The source code of your Lambda function. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public DockerImageFunction build()
      Specified by:
      build in interface software.amazon.jsii.Builder<DockerImageFunction>
      Returns:
      a newly built instance of DockerImageFunction.