Skip to content
v2.274.0

DockerImageFunctionProps Struct ​

Properties to configure a new DockerImageFunction construct.

Example ​

ts
new lambda.DockerImageFunction(this, 'AssetFunction', {
  code: lambda.DockerImageCode.fromImageAsset(path.join(__dirname, 'docker-arm64-handler')),
  architecture: lambda.Architecture.ARM_64,
});

Properties ​

adotInstrumentationAdotInstrumentationConfigadot_instrumentationAdotInstrumentationConfigadotInstrumentationAdotInstrumentationConfigAdotInstrumentationAdotInstrumentationConfigAdotInstrumentationAdotInstrumentationConfig#
Specify the configuration of AWS Distro for OpenTelemetry (ADOT) instrumentation.

Default: No ADOT instrumentation

allowAllIpv6Outboundbooleanallow_all_ipv6_outboundboolallowAllIpv6OutboundBooleanAllowAllIpv6OutboundboolAllowAllIpv6Outbound*bool= false#
Whether to allow the Lambda to send all ipv6 network traffic.
notes

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.

allowAllOutboundbooleanallow_all_outboundboolallowAllOutboundBooleanAllowAllOutboundboolAllowAllOutbound*bool= true#
Whether to allow the Lambda to send all network traffic (except ipv6).
notes

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.

allowPublicSubnetbooleanallow_public_subnetboolallowPublicSubnetBooleanAllowPublicSubnetboolAllowPublicSubnet*bool= false#
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.

applicationLogLevelstringapplication_log_levelstrapplicationLogLevelStringApplicationLogLevelstringApplicationLogLevel*string= "INFO"deprecated#
Use `applicationLogLevelV2` as a property instead.
applicationLogLevelV2ApplicationLogLevelapplication_log_level_v2ApplicationLogLevelapplicationLogLevelV2ApplicationLogLevelApplicationLogLevelV2ApplicationLogLevelApplicationLogLevelV2ApplicationLogLevel= ApplicationLogLevel.INFO#
Sets the application log level for the function.
architectureArchitecturearchitectureArchitecturearchitectureArchitectureArchitectureArchitectureArchitectureArchitecture= Architecture.X86_64#
The system architectures compatible with this lambda function.
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.

codeSigningConfigICodeSigningConfigRefcode_signing_configICodeSigningConfigRefcodeSigningConfigICodeSigningConfigRefCodeSigningConfigICodeSigningConfigRefCodeSigningConfigICodeSigningConfigRef#
Code signing config associated with this function.

Default: Not Sign the Code

currentVersionOptionsVersionOptionscurrent_version_optionsVersionOptionscurrentVersionOptionsVersionOptionsCurrentVersionOptionsVersionOptionsCurrentVersionOptionsVersionOptions#
Options for the `lambda.Version` resource automatically created by the `fn.currentVersion` method.

Default: default options as described in VersionOptions

deadLetterQueueIQueuedead_letter_queueIQueuedeadLetterQueueIQueueDeadLetterQueueIQueueDeadLetterQueueIQueue#
The SQS queue to use if DLQ is enabled.

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

If SNS topic is desired, specify deadLetterTopic property instead.

deadLetterQueueEnabledbooleandead_letter_queue_enabledbooldeadLetterQueueEnabledBooleanDeadLetterQueueEnabledboolDeadLetterQueueEnabled*bool#
Enabled DLQ.

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

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

deadLetterTopicITopicdead_letter_topicITopicdeadLetterTopicITopicDeadLetterTopicITopicDeadLetterTopicITopic#
The SNS topic to use as a DLQ.

Default: no SNS topic

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.

descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string#
A description of the function.

Default: No description.

durableConfigDurableConfigdurable_configDurableConfigdurableConfigDurableConfigDurableConfigDurableConfigDurableConfigDurableConfig#
The durable configuration for the function.

Default: No durable configuration

If durability is added to an existing function, a resource replacement will be triggered. See the 'durableConfig' section in the module README for more details.

environment{ [key: string]: string }environmenttyping.Mapping[str, str]environmentMap<String, String>EnvironmentIDictionary<string, string>Environment*map[string]*string#
Key-value pairs that Lambda caches and makes available for your Lambda functions.

Default: No environment variables.

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

environmentEncryptionIKeyRefenvironment_encryptionIKeyRefenvironmentEncryptionIKeyRefEnvironmentEncryptionIKeyRefEnvironmentEncryptionIKeyRef#
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).

ephemeralStorageSizeSizeephemeral_storage_sizeSizeephemeralStorageSizeSizeEphemeralStorageSizeSizeEphemeralStorageSizeSize#
The size of the function’s /tmp directory in MiB.

Default: 512 MiB

eventsIEventSource[]eventstyping.List[IEventSource]eventsList<IEventSource>EventsIEventSource[]Events*[]IEventSource#
Event sources for this function.

Default: No event sources.

You can also add event sources using addEventSource.

filesystemFileSystemfilesystemFileSystemfilesystemFileSystemFilesystemFileSystemFilesystemFileSystem#
The filesystem configuration for the lambda function.

Default: will not mount any filesystem

functionNamestringfunction_namestrfunctionNameStringFunctionNamestringFunctionName*string#
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.

initialPolicyPolicyStatement[]initial_policytyping.List[PolicyStatement]initialPolicyList<PolicyStatement>InitialPolicyPolicyStatement[]InitialPolicy*[]PolicyStatement#
Initial policy statements to add to the created Lambda Role.

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

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

insightsVersionLambdaInsightsVersioninsights_versionLambdaInsightsVersioninsightsVersionLambdaInsightsVersionInsightsVersionLambdaInsightsVersionInsightsVersionLambdaInsightsVersion#
Specify the version of CloudWatch Lambda insights to use for monitoring.

Default: No Lambda Insights

ipv6AllowedForDualStackbooleanipv6_allowed_for_dual_stackboolipv6AllowedForDualStackBooleanIpv6AllowedForDualStackboolIpv6AllowedForDualStack*bool= false#
Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets.

Only used if 'vpc' is supplied.

layersILayerVersion[]layerstyping.List[ILayerVersion]layersList<ILayerVersion>LayersILayerVersion[]Layers*[]ILayerVersion#
A list of layers to add to the function's execution environment.

Default: No layers.

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.

logFormatstringlog_formatstrlogFormatStringLogFormatstringLogFormat*string= "Text"deprecated#
Use `loggingFormat` as a property instead.
loggingFormatLoggingFormatlogging_formatLoggingFormatloggingFormatLoggingFormatLoggingFormatLoggingFormatLoggingFormatLoggingFormat= LoggingFormat.TEXT#
Sets the loggingFormat for the function.
logGroupILogGroupReflog_groupILogGroupReflogGroupILogGroupRefLogGroupILogGroupRefLogGroupILogGroupRef#
The log group the function sends logs to.

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

notes

By default, Lambda functions send logs to an automatically created default log group named /aws/lambda/&lt;function name>. 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.

logRemovalPolicyRemovalPolicylog_removal_policyRemovalPolicylogRemovalPolicyRemovalPolicyLogRemovalPolicyRemovalPolicyLogRemovalPolicyRemovalPolicy= RemovalPolicy.Retaindeprecated#
use `logGroup` instead

Normally you want to retain the log group so you can diagnose issues from logs even after a deployment that no longer includes the log group. In that case, use the normal date-based retention policy to age out your logs.

logRetentionRetentionDayslog_retentionRetentionDayslogRetentionRetentionDaysLogRetentionRetentionDaysLogRetentionRetentionDays= logs.RetentionDays.INFINITEdeprecated#
use `logGroup` instead
notes

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:

ts
import * as logs from 'aws-cdk-lib/aws-logs';

declare const myLogGroup: logs.LogGroup;
myLogGroup.logGroupName;
logRetentionRetryOptionsLogRetentionRetryOptionslog_retention_retry_optionsLogRetentionRetryOptionslogRetentionRetryOptionsLogRetentionRetryOptionsLogRetentionRetryOptionsLogRetentionRetryOptionsLogRetentionRetryOptionsLogRetentionRetryOptions#
When log retention is specified, a custom resource attempts to create the CloudWatch log group.

Default: Default AWS SDK retry options.

notes

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.

logRetentionRoleIRolelog_retention_roleIRolelogRetentionRoleIRoleLogRetentionRoleIRoleLogRetentionRoleIRole#
The IAM role for the Lambda function associated with the custom resource that sets the retention policy.

Default: A new role is created.

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.

maxEventAgeDurationmax_event_ageDurationmaxEventAgeDurationMaxEventAgeDurationMaxEventAgeDuration= Duration.hours(6)#
The maximum age of a request that Lambda sends to a function for processing.

Minimum: 60 seconds Maximum: 6 hours

memorySizenumbermemory_sizeint | floatmemorySizeNumberMemorySizedoubleMemorySize*float64= 128#
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.

onFailureIDestinationon_failureIDestinationonFailureIDestinationOnFailureIDestinationOnFailureIDestination#
The destination for failed invocations.

Default: no destination

onSuccessIDestinationon_successIDestinationonSuccessIDestinationOnSuccessIDestinationOnSuccessIDestination#
The destination for successful invocations.

Default: no destination

Specify the configuration of Parameters and Secrets Extension.

Default: No Parameters and Secrets Extension

profilingbooleanprofilingboolprofilingBooleanProfilingboolProfiling*bool#
Enable profiling.

Default: No profiling.

profilingGroupIProfilingGroupprofiling_groupIProfilingGroupprofilingGroupIProfilingGroupProfilingGroupIProfilingGroupProfilingGroupIProfilingGroup#
Profiling Group.

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

recursiveLoopRecursiveLooprecursive_loopRecursiveLooprecursiveLoopRecursiveLoopRecursiveLoopRecursiveLoopRecursiveLoopRecursiveLoop= RecursiveLoop.Terminate#
Sets the Recursive Loop Protection for Lambda Function.

It lets Lambda detect and terminate unintended recursive loops.

reservedConcurrentExecutionsnumberreserved_concurrent_executionsint | floatreservedConcurrentExecutionsNumberReservedConcurrentExecutionsdoubleReservedConcurrentExecutions*float64#
The maximum of concurrent executions you want to reserve for the function.

Default: No specific limit - account limit.

retryAttemptsnumberretry_attemptsint | floatretryAttemptsNumberRetryAttemptsdoubleRetryAttempts*float64= 2#
The maximum number of times to retry when the function returns an error.

Minimum: 0 Maximum: 2

roleIRoleroleIRoleroleIRoleRoleIRoleRoleIRole#
Lambda execution role.

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

notes

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".

runtimeManagementModeRuntimeManagementModeruntime_management_modeRuntimeManagementModeruntimeManagementModeRuntimeManagementModeRuntimeManagementModeRuntimeManagementModeRuntimeManagementModeRuntimeManagementMode= Auto#
Sets the runtime management configuration for a function's version.
securityGroupsISecurityGroup[]security_groupstyping.List[ISecurityGroup]securityGroupsList<ISecurityGroup>SecurityGroupsISecurityGroup[]SecurityGroups*[]ISecurityGroup#
The list of security groups to associate with the Lambda's network interfaces.

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.

Only used if 'vpc' is supplied.

snapStartSnapStartConfsnap_startSnapStartConfsnapStartSnapStartConfSnapStartSnapStartConfSnapStartSnapStartConf#
Enable SnapStart for Lambda Function.

Default: No snapstart

SnapStart is currently supported for Java 11, Java 17, Python 3.12, Python 3.13, and .NET 8 runtime, as well as container image (OCI) deployments.

systemLogLevelstringsystem_log_levelstrsystemLogLevelStringSystemLogLevelstringSystemLogLevel*string= "INFO"deprecated#
Use `systemLogLevelV2` as a property instead.
systemLogLevelV2SystemLogLevelsystem_log_level_v2SystemLogLevelsystemLogLevelV2SystemLogLevelSystemLogLevelV2SystemLogLevelSystemLogLevelV2SystemLogLevel= SystemLogLevel.INFO#
Sets the system log level for the function.
tenancyConfigTenancyConfigtenancy_configTenancyConfigtenancyConfigTenancyConfigTenancyConfigTenancyConfigTenancyConfigTenancyConfig#
The tenancy configuration for the function.

Default: Tenant isolation is not enabled

timeoutDurationtimeoutDurationtimeoutDurationTimeoutDurationTimeoutDuration= Duration.seconds(3)#
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.

tracingTracingtracingTracingtracingTracingTracingTracingTracingTracing= Tracing.Disabled#
Enable AWS X-Ray Tracing for Lambda Function.
vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpc#
VPC network to place Lambda network interfaces.

Default: Function is not placed within a VPC.

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

vpcSubnetsSubnetSelectionvpc_subnetsSubnetSelectionvpcSubnetsSubnetSelectionVpcSubnetsSubnetSelectionVpcSubnetsSubnetSelection#
Where to place the network interfaces within the VPC.

Default: the Vpc default strategy if not specified

notes

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).