close
AWS Fundamentals Logo
AWS Fundamentals

AWS Lambda

23 CDK constructs available in aws-cdk-lib/aws-lambda

import * as lambda from 'aws-cdk-lib/aws-lambda';

L2 Constructs11

Higher-level abstractions with sensible defaults and convenience methods.

Alias

L2

A new alias to a particular version of a Lambda function.

CapacityProvider

L2

A Lambda capacity provider that manages compute resources for Lambda functions.

CodeSigningConfig

L2

Defines a Code Signing Config.

DockerImageFunction

L2

Create a lambda function where the handler is a docker image.

EventInvokeConfig

L2

Configure options for asynchronous invocation on a version or an alias. By default, Lambda retries an asynchronous invocation twice if the function returns an error. It retains events in a queue for up to six hours. When an event fails all processing attempts or stays in the asynchronous invocation queue for too long, Lambda discards it.

EventSourceMapping

L2

Defines a Lambda EventSourceMapping resource. Usually, you won't need to define the mapping yourself. This will usually be done by event sources. For example, to add an SQS event source to a function: ```ts import * as sqs from 'aws-cdk-lib/aws-sqs'; import * as eventsources from 'aws-cdk-lib/aws-lambda-event-sources'; declare const handler: lambda.Function; declare const queue: sqs.Queue; handler.addEventSource(new eventsources.SqsEventSource(queue)); ``` The `SqsEventSource` class will automatically create the mapping, and will also modify the Lambda's execution role so it can consume messages from the queue.

Function

L2

This construct does not yet reproduce all features from the underlying resource library.

FunctionUrl

L2

Defines a Lambda function url.

LayerVersion

L2

Defines a new Lambda Layer version.

SingletonFunction

L2

A Lambda that will only ever be added to a stack once. This construct is a way to guarantee that the lambda function will be guaranteed to be part of the stack, once and only once, irrespective of how many times the construct is declared to be part of the stack. This is guaranteed as long as the `uuid` property and the optional `lambdaPurpose` property stay the same whenever they're declared into the stack.

Version

L2

Tag the current state of a Function with a Version number. Avoid using this resource directly. If you need a Version object, use `function.currentVersion` instead. That will add a Version object to your template, and make sure the Version is invalidated whenever the Function object changes. If you use the `Version` resource directly, you are responsible for making sure it is invalidated (by changing its logical ID) whenever necessary. Version resources can then be used in `Alias` resources to refer to a particular deployment of a Lambda. If you want to ensure that you're associating the right version with the right deployment, specify the `codeSha256` property while creating the `Version.

L1 Constructs12

Direct CloudFormation resource mappings. One-to-one with CloudFormation resource types.

Get the AWS Lambda Cheat Sheet

Everything you need to know about AWS Lambda on one page. HD quality, print-friendly.

Download Free Infographic

Quick Facts

L2 Constructs11
L1 Constructs12
Moduleaws-cdk-lib/aws-lambda