Class CfnFunctionPropsMixin

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.Mixin
software.amazon.awscdk.cfnpropertymixins.services.lambda.CfnFunctionPropsMixin
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable, software.constructs.IMixin

@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)", date="2026-03-11T13:20:00.913Z") @Stability(Stable) public class CfnFunctionPropsMixin extends Mixin implements software.constructs.IMixin
The AWS::Lambda::Function resource creates a Lambda function.

To create a function, you need a deployment package and an execution role . The deployment package is a .zip file archive or container image that contains your function code. The execution role grants the function permission to use AWS services, such as Amazon CloudWatch Logs for log streaming and AWS X-Ray for request tracing.

You set the package type to Image if the deployment package is a container image . For these functions, include the URI of the container image in the Amazon ECR registry in the ImageUri property of the Code property . You do not need to specify the handler and runtime properties.

You set the package type to Zip if the deployment package is a .zip file archive . For these functions, specify the Amazon S3 location of your .zip file in the Code property. Alternatively, for Node.js and Python functions, you can define your function inline in the ZipFile property of the Code property . In both cases, you must also specify the handler and runtime properties.

You can use code signing if your deployment package is a .zip file archive. To enable code signing for this function, specify the ARN of a code-signing configuration. When a user attempts to deploy a code package with UpdateFunctionCode , Lambda checks that the code package has a valid signature from a trusted publisher. The code-signing configuration includes a set of signing profiles, which define the trusted publishers for this function.

When you update a AWS::Lambda::Function resource, CloudFormation calls the UpdateFunctionConfiguration and UpdateFunctionCode Lambda APIs under the hood. Because these calls happen sequentially, and invocations can happen between these calls, your function may encounter errors in the time between the calls. For example, if you remove an environment variable, and the code that references that environment variable in the same CloudFormation update, you may see invocation errors related to a missing environment variable. To work around this, you can invoke your function against a version or alias by default, rather than the $LATEST version.

Note that you configure provisioned concurrency on a AWS::Lambda::Version or a AWS::Lambda::Alias .

For a complete introduction to Lambda functions, see What is Lambda? in the Lambda developer guide.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.cfnpropertymixins.services.lambda.*;
 import software.amazon.awscdk.*;
 IMergeStrategy mergeStrategy;
 CfnFunctionPropsMixin cfnFunctionPropsMixin = CfnFunctionPropsMixin.Builder.create(CfnFunctionMixinProps.builder()
         .architectures(List.of("architectures"))
         .capacityProviderConfig(CapacityProviderConfigProperty.builder()
                 .lambdaManagedInstancesCapacityProviderConfig(LambdaManagedInstancesCapacityProviderConfigProperty.builder()
                         .capacityProviderArn("capacityProviderArn")
                         .executionEnvironmentMemoryGiBPerVCpu(123)
                         .perExecutionEnvironmentMaxConcurrency(123)
                         .build())
                 .build())
         .code(CodeProperty.builder()
                 .imageUri("imageUri")
                 .s3Bucket("s3Bucket")
                 .s3Key("s3Key")
                 .s3ObjectVersion("s3ObjectVersion")
                 .sourceKmsKeyArn("sourceKmsKeyArn")
                 .zipFile("zipFile")
                 .build())
         .codeSigningConfigArn("codeSigningConfigArn")
         .deadLetterConfig(DeadLetterConfigProperty.builder()
                 .targetArn("targetArn")
                 .build())
         .description("description")
         .durableConfig(DurableConfigProperty.builder()
                 .executionTimeout(123)
                 .retentionPeriodInDays(123)
                 .build())
         .environment(EnvironmentProperty.builder()
                 .variables(Map.of(
                         "variablesKey", "variables"))
                 .build())
         .ephemeralStorage(EphemeralStorageProperty.builder()
                 .size(123)
                 .build())
         .fileSystemConfigs(List.of(FileSystemConfigProperty.builder()
                 .arn("arn")
                 .localMountPath("localMountPath")
                 .build()))
         .functionName("functionName")
         .functionScalingConfig(FunctionScalingConfigProperty.builder()
                 .maxExecutionEnvironments(123)
                 .minExecutionEnvironments(123)
                 .build())
         .handler("handler")
         .imageConfig(ImageConfigProperty.builder()
                 .command(List.of("command"))
                 .entryPoint(List.of("entryPoint"))
                 .workingDirectory("workingDirectory")
                 .build())
         .kmsKeyArn("kmsKeyArn")
         .layers(List.of("layers"))
         .loggingConfig(LoggingConfigProperty.builder()
                 .applicationLogLevel("applicationLogLevel")
                 .logFormat("logFormat")
                 .logGroup("logGroup")
                 .systemLogLevel("systemLogLevel")
                 .build())
         .memorySize(123)
         .packageType("packageType")
         .publishToLatestPublished(false)
         .recursiveLoop("recursiveLoop")
         .reservedConcurrentExecutions(123)
         .role("role")
         .runtime("runtime")
         .runtimeManagementConfig(RuntimeManagementConfigProperty.builder()
                 .runtimeVersionArn("runtimeVersionArn")
                 .updateRuntimeOn("updateRuntimeOn")
                 .build())
         .snapStart(SnapStartProperty.builder()
                 .applyOn("applyOn")
                 .build())
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .tenancyConfig(TenancyConfigProperty.builder()
                 .tenantIsolationMode("tenantIsolationMode")
                 .build())
         .timeout(123)
         .tracingConfig(TracingConfigProperty.builder()
                 .mode("mode")
                 .build())
         .vpcConfig(VpcConfigProperty.builder()
                 .ipv6AllowedForDualStack(false)
                 .securityGroupIds(List.of("securityGroupIds"))
                 .subnetIds(List.of("subnetIds"))
                 .build())
         .build())
 .strategy(mergeStrategy)
 .build();
 

See Also:
  • Field Details

    • CFN_PROPERTY_KEYS

      @Stability(Stable) protected static final List<String> CFN_PROPERTY_KEYS
  • Constructor Details

    • CfnFunctionPropsMixin

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

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

      @Stability(Stable) public CfnFunctionPropsMixin(@NotNull CfnFunctionMixinProps props, @Nullable CfnPropertyMixinOptions options)
      Create a mixin to apply properties to AWS::Lambda::Function.

      Parameters:
      props - L1 properties to apply. This parameter is required.
      options - Mixin options.
    • CfnFunctionPropsMixin

      @Stability(Stable) public CfnFunctionPropsMixin(@NotNull CfnFunctionMixinProps props)
      Create a mixin to apply properties to AWS::Lambda::Function.

      Parameters:
      props - L1 properties to apply. This parameter is required.
  • Method Details

    • applyTo

      @Stability(Stable) public void applyTo(@NotNull software.constructs.IConstruct construct)
      Apply the mixin properties to the construct.

      Specified by:
      applyTo in interface software.constructs.IMixin
      Specified by:
      applyTo in class Mixin
      Parameters:
      construct - This parameter is required.
    • supports

      @Stability(Stable) @NotNull public Boolean supports(@NotNull software.constructs.IConstruct construct)
      Check if this mixin supports the given construct.

      Specified by:
      supports in interface software.constructs.IMixin
      Overrides:
      supports in class Mixin
      Parameters:
      construct - This parameter is required.
    • getProps

      @Stability(Stable) @NotNull protected CfnFunctionMixinProps getProps()
    • getStrategy

      @Stability(Stable) @NotNull protected IMergeStrategy getStrategy()