CfnFunctionProps Struct
Properties for defining a CfnFunction.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lambda as lambda } from 'aws-cdk-lib';
const cfnFunctionProps: lambda.CfnFunctionProps = {
code: {
imageUri: 'imageUri',
s3Bucket: 's3Bucket',
s3Key: 's3Key',
s3ObjectStorageMode: 's3ObjectStorageMode',
s3ObjectVersion: 's3ObjectVersion',
sourceKmsKeyArn: 'sourceKmsKeyArn',
zipFile: 'zipFile',
},
role: 'role',
// the properties below are optional
architectures: ['architectures'],
capacityProviderConfig: {
lambdaManagedInstancesCapacityProviderConfig: {
capacityProviderArn: 'capacityProviderArn',
// the properties below are optional
executionEnvironmentMemoryGiBPerVCpu: 123,
perExecutionEnvironmentMaxConcurrency: 123,
},
},
codeSigningConfigArn: 'codeSigningConfigArn',
deadLetterConfig: {
targetArn: 'targetArn',
},
description: 'description',
durableConfig: {
executionTimeout: 123,
// the properties below are optional
kmsKeyArn: 'kmsKeyArn',
retentionPeriodInDays: 123,
},
environment: {
variables: {
variablesKey: 'variables',
},
},
ephemeralStorage: {
size: 123,
},
fileSystemConfigs: [{
arn: 'arn',
localMountPath: 'localMountPath',
// the properties below are optional
s3FilesConfig: {
directS3Read: 'directS3Read',
},
}],
functionName: 'functionName',
functionScalingConfig: {
maxExecutionEnvironments: 123,
minExecutionEnvironments: 123,
},
handler: 'handler',
imageConfig: {
command: ['command'],
entryPoint: ['entryPoint'],
workingDirectory: 'workingDirectory',
},
kmsKeyArn: 'kmsKeyArn',
layers: ['layers'],
loggingConfig: {
applicationLogLevel: 'applicationLogLevel',
logFormat: 'logFormat',
logGroup: 'logGroup',
systemLogLevel: 'systemLogLevel',
},
memorySize: 123,
packageType: 'packageType',
publishToLatestPublished: false,
recursiveLoop: 'recursiveLoop',
reservedConcurrentExecutions: 123,
runtime: 'runtime',
runtimeManagementConfig: {
updateRuntimeOn: 'updateRuntimeOn',
// the properties below are optional
runtimeVersionArn: 'runtimeVersionArn',
},
snapStart: {
applyOn: 'applyOn',
},
tags: [{
key: 'key',
value: 'value',
}],
tenancyConfig: {
tenantIsolationMode: 'tenantIsolationMode',
},
timeout: 123,
tracingConfig: {
mode: 'mode',
},
vpcConfig: {
ipv6AllowedForDualStack: false,
securityGroupIds: ['securityGroupIds'],
subnetIds: ['subnetIds'],
},
};
Properties
architecturesstring[]architecturestyping.List[str]architecturesList<String>Architecturesstring[]Architectures*[]*string#Enter a string array with one of the valid values (arm64 or x86_64). The default value is x86_64 .
capacityProviderConfigIResolvable | CfnFunction.CapacityProviderConfigPropertycapacity_provider_configtyping.Union[IResolvable, CapacityProviderConfigProperty]capacityProviderConfigIResolvableCapacityProviderConfigIResolvableCapacityProviderConfiginterface{}#codeIResolvable | CfnFunction.CodePropertycodetyping.Union[IResolvable, CodeProperty]codeIResolvableCodeIResolvableCodeinterface{}required#notes
- For .zip deployment packages, you can specify the Amazon S3 location of the .zip file in the
S3Bucket,S3Key, andS3ObjectVersionproperties. - For .zip deployment packages, you can alternatively define the function code inline in the
ZipFileproperty. This method works only for Node.js and Python functions. - For container images, specify the URI of your container image in the Amazon ECR registry in the
ImageUriproperty.
codeSigningConfigArnstring | ICodeSigningConfigRefcode_signing_config_arntyping.Union[str, ICodeSigningConfigRef]codeSigningConfigArnStringCodeSigningConfigArnstringCodeSigningConfigArninterface{}#A code-signing configuration includes a set of signing profiles, which define the trusted publishers for this function.
deadLetterConfigIResolvable | CfnFunction.DeadLetterConfigPropertydead_letter_configtyping.Union[IResolvable, DeadLetterConfigProperty]deadLetterConfigIResolvableDeadLetterConfigIResolvableDeadLetterConfiginterface{}#For more information, see Dead-letter queues .
durableConfigIResolvable | CfnFunction.DurableConfigPropertydurable_configtyping.Union[IResolvable, DurableConfigProperty]durableConfigIResolvableDurableConfigIResolvableDurableConfiginterface{}#environmentIResolvable | CfnFunction.EnvironmentPropertyenvironmenttyping.Union[IResolvable, EnvironmentProperty]environmentIResolvableEnvironmentIResolvableEnvironmentinterface{}#ephemeralStorageIResolvable | CfnFunction.EphemeralStoragePropertyephemeral_storagetyping.Union[IResolvable, EphemeralStorageProperty]ephemeralStorageIResolvableEphemeralStorageIResolvableEphemeralStorageinterface{}#The default value is 512, but it can be any whole number between 512 and 10,240 MB.
fileSystemConfigsIResolvable | IResolvable | CfnFunction.FileSystemConfigProperty[]file_system_configstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, FileSystemConfigProperty]]]fileSystemConfigsIResolvableFileSystemConfigsIResolvableFileSystemConfigsinterface{}#notes
To connect a function to a file system, a mount target must be available in every Availability Zone that your function connects to. If your template contains an AWS::EFS::MountTarget resource, you must also specify a DependsOn attribute to ensure that the mount target is created or updated before the function.
For more information about using the DependsOn attribute, see DependsOn Attribute .
notes
If you don't specify a name, CloudFormation generates one.
If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
functionScalingConfigIResolvable | CfnFunction.FunctionScalingConfigPropertyfunction_scaling_configtyping.Union[IResolvable, FunctionScalingConfigProperty]functionScalingConfigIResolvableFunctionScalingConfigIResolvableFunctionScalingConfiginterface{}#notes
Handler is required if the deployment package is a .zip file archive. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see Lambda programming model .
imageConfigIResolvable | CfnFunction.ImageConfigPropertyimage_configtyping.Union[IResolvable, ImageConfigProperty]imageConfigIResolvableImageConfigIResolvableImageConfiginterface{}#For more information, see Container image settings .
kmsKeyArnstring | IKeyRefkms_key_arntyping.Union[str, IKeyRef]kmsKeyArnStringKmsKeyArnstringKmsKeyArninterface{}#notes
- The function's environment variables .
- The function's Lambda SnapStart snapshots.
- When used with
SourceKMSKeyArn, the unzipped version of the .zip deployment package that's used for function invocations. For more information, see Specifying a customer managed key for Lambda . - The optimized version of the container image that's used for function invocations. Note that this is not the same key that's used to protect your container image in the Amazon Elastic Container Registry (Amazon ECR). For more information, see Function lifecycle .
If you don't provide a customer managed key, Lambda uses an AWS owned key or an AWS managed key .
layersstring | ILayerVersionRef[]layerstyping.List[typing.Union[str, ILayerVersionRef]]layersList<String>Layersstring[]Layers*[]interface{}#loggingConfigIResolvable | CfnFunction.LoggingConfigPropertylogging_configtyping.Union[IResolvable, LoggingConfigProperty]loggingConfigIResolvableLoggingConfigIResolvableLoggingConfiginterface{}#Set to Image for container image and set Zip for .zip file archive.
publishToLatestPublishedboolean | IResolvablepublish_to_latest_publishedtyping.Union[bool, IResolvable]publishToLatestPublishedBooleanPublishToLatestPublishedboolPublishToLatestPublishedinterface{}#notes
When this value is set to Allow and Lambda detects your function being invoked as part of a recursive loop, it doesn't take any action.
When this value is set to Terminate and Lambda detects your function being invoked as part of a recursive loop, it stops your function being invoked and notifies you.
reservedConcurrentExecutionsnumberreserved_concurrent_executionsint | floatreservedConcurrentExecutionsNumberReservedConcurrentExecutionsdoubleReservedConcurrentExecutions*float64#notes
The following list includes deprecated runtimes. Lambda blocks creating new functions and updating existing functions shortly after each runtime is deprecated. For more information, see Runtime use after deprecation .
For a list of all currently supported runtimes, see Supported runtimes .
runtimeManagementConfigIResolvable | CfnFunction.RuntimeManagementConfigPropertyruntime_management_configtyping.Union[IResolvable, RuntimeManagementConfigProperty]runtimeManagementConfigIResolvableRuntimeManagementConfigIResolvableRuntimeManagementConfiginterface{}#For more information, see Runtime updates .
snapStartIResolvable | CfnFunction.SnapStartPropertysnap_starttyping.Union[IResolvable, SnapStartProperty]snapStartIResolvableSnapStartIResolvableSnapStartinterface{}#notes
You must have the
lambda:TagResource,lambda:UntagResource, andlambda:ListTagspermissions for your IAM principal to manage the CloudFormation stack. If you don't have these permissions, there might be unexpected behavior with stack-level tags propagating to the resource during resource creation and update.
tenancyConfigIResolvable | CfnFunction.TenancyConfigPropertytenancy_configtyping.Union[IResolvable, TenancyConfigProperty]tenancyConfigIResolvableTenancyConfigIResolvableTenancyConfiginterface{}#Determines whether the Lambda function runs on a shared or dedicated infrastructure per unique tenant.
The default is 3 seconds. The maximum allowed value is 900 seconds. For more information, see Lambda execution environment .
tracingConfigIResolvable | CfnFunction.TracingConfigPropertytracing_configtyping.Union[IResolvable, TracingConfigProperty]tracingConfigIResolvableTracingConfigIResolvableTracingConfiginterface{}#vpcConfigIResolvable | CfnFunction.VpcConfigPropertyvpc_configtyping.Union[IResolvable, VpcConfigProperty]vpcConfigIResolvableVpcConfigIResolvableVpcConfiginterface{}#notes
When you connect a function to a VPC, it can access resources and the internet only through that VPC. For more information, see Configuring a Lambda function to access resources in a VPC .