aws-cdk-lib.aws_lambda_event_sources.SqsEventSourceProps

interface SqsEventSourceProps

LanguageType name
.NETAmazon.CDK.AWS.Lambda.EventSources.SqsEventSourceProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awslambdaeventsources#SqsEventSourceProps
Javasoftware.amazon.awscdk.services.lambda.eventsources.SqsEventSourceProps
Pythonaws_cdk.aws_lambda_event_sources.SqsEventSourceProps
TypeScript (source)aws-cdk-lib » aws_lambda_event_sources » SqsEventSourceProps

Example

import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources';

const queue = new sqs.Queue(this, 'MyQueue', {
  visibilityTimeout: Duration.seconds(30),      // default,
  receiveMessageWaitTime: Duration.seconds(20), // default
});
declare const fn: lambda.Function;

fn.addEventSource(new SqsEventSource(queue, {
  batchSize: 10, // default
  maxBatchingWindow: Duration.minutes(5),
  reportBatchItemFailures: true, // default to false
}));

Properties

NameTypeDescription
batchSize?numberThe largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.
enabled?booleanIf the SQS event source mapping should be enabled.
filters?{ [string]: any }[]Add filter criteria option.
maxBatchingWindow?DurationThe maximum amount of time to gather records before invoking the function.
maxConcurrency?numberThe maximum concurrency setting limits the number of concurrent instances of the function that an Amazon SQS event source can invoke.
reportBatchItemFailures?booleanAllow functions to return partially successful responses for a batch of records.

batchSize?

Type: number (optional, default: 10)

The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.

Your function receives an event with all the retrieved records.

Valid Range: Minimum value of 1. Maximum value of 10. If maxBatchingWindow is configured, this value can go up to 10,000.


enabled?

Type: boolean (optional, default: true)

If the SQS event source mapping should be enabled.


filters?

Type: { [string]: any }[] (optional, default: None)

Add filter criteria option.


maxBatchingWindow?

Type: Duration (optional, default: no batching window. The lambda function will be invoked immediately with the records that are available.)

The maximum amount of time to gather records before invoking the function.

Valid Range: Minimum value of 0 minutes. Maximum value of 5 minutes.


maxConcurrency?

Type: number (optional, default: No specific limit.)

The maximum concurrency setting limits the number of concurrent instances of the function that an Amazon SQS event source can invoke.

See also: [https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-max-concurrency

Valid Range: Minimum value of 2. Maximum value of 1000.](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-max-concurrency

Valid Range: Minimum value of 2. Maximum value of 1000.)


reportBatchItemFailures?

Type: boolean (optional, default: false)

Allow functions to return partially successful responses for a batch of records.

See also: https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#services-sqs-batchfailurereporting