Class CfnFunctionPropsMixin
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable,software.constructs.IMixin
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnFunctionPropsMixin.static interfaceConfiguration for the capacity provider that manages compute resources for Lambda functions.static interfaceThe deployment package for a Lambda function.static interfaceThe dead-letter queue for failed asynchronous invocations.static interfaceConfiguration settings for durable functions , including execution timeout and retention period for execution history.static interfaceA function's environment variable settings.static interfaceThe size of the function's/tmpdirectory in MB.static interfaceDetails about the connection between a Lambda function and an Amazon EFS file system .static interfaceConfiguration that defines the scaling behavior for a Lambda Managed Instances function, including the minimum and maximum number of execution environments that can be provisioned.static interfaceConfiguration values that override the container image Dockerfile settings.static interfaceConfiguration for Lambda-managed instances used by the capacity provider.static interfaceThe function's Amazon CloudWatch Logs configuration settings.static interfaceSets the runtime management configuration for a function's version.static interfaceThe function's AWS Lambda SnapStart setting.static interfaceThe function's SnapStart setting.static interfaceSpecifies the tenant isolation mode configuration for a Lambda function.static interfaceThe function's AWS X-Ray tracing configuration.static interfaceThe VPC security groups and subnets that are attached to a Lambda function.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IMixin
software.constructs.IMixin.Jsii$Default, software.constructs.IMixin.Jsii$Proxy -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate a mixin to apply properties toAWS::Lambda::Function.CfnFunctionPropsMixin(CfnFunctionMixinProps props, CfnPropertyMixinOptions options) Create a mixin to apply properties toAWS::Lambda::Function.protectedCfnFunctionPropsMixin(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnFunctionPropsMixin(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTo(software.constructs.IConstruct construct) Apply the mixin properties to the construct.protected CfnFunctionMixinPropsgetProps()protected IMergeStrategysupports(software.constructs.IConstruct construct) Check if this mixin supports the given construct.Methods 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, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
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 toAWS::Lambda::Function.- Parameters:
props- L1 properties to apply. This parameter is required.options- Mixin options.
-
CfnFunctionPropsMixin
Create a mixin to apply properties toAWS::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. -
supports
@Stability(Stable) @NotNull public Boolean supports(@NotNull software.constructs.IConstruct construct) Check if this mixin supports the given construct. -
getProps
-
getStrategy
-