Skip to content
v2.274.0

SqsEventSourceProps Struct ​

Example ​

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

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

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

Properties ​

batchSizenumberbatch_sizeint | floatbatchSizeNumberBatchSizedoubleBatchSize*float64= 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.

enabledbooleanenabledboolenabledBooleanEnabledboolEnabled*bool= true#
If the SQS event source mapping should be enabled.
filterEncryptionIKeyfilter_encryptionIKeyfilterEncryptionIKeyFilterEncryptionIKeyFilterEncryptionIKey= none#
Add Customer managed KMS key to encrypt Filter Criteria.
filters{ [key: string]: any }[]filterstyping.List[typing.Mapping[str, Any]]filtersList<Map<String, Object>>FiltersIDictionary<string, object>[]Filters*[]*map[string]interface{}= None#
Add filter criteria option.
maxBatchingWindowDurationmax_batching_windowDurationmaxBatchingWindowDurationMaxBatchingWindowDurationMaxBatchingWindowDuration#
The maximum amount of time to gather records before invoking the function.

Default: no batching window. The lambda function will be invoked immediately with the records that are available.

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

maxConcurrencynumbermax_concurrencyint | floatmaxConcurrencyNumberMaxConcurrencydoubleMaxConcurrency*float64#
The maximum concurrency setting limits the number of concurrent instances of the function that an Amazon SQS event source can invoke.

Default: No specific limit.

metricsConfigMetricsConfigmetrics_configMetricsConfigmetricsConfigMetricsConfigMetricsConfigMetricsConfigMetricsConfigMetricsConfig#
Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source.

Default: Enhanced monitoring is disabled

provisionedPollerConfigProvisionedPollerConfigprovisioned_poller_configProvisionedPollerConfigprovisionedPollerConfigProvisionedPollerConfigProvisionedPollerConfigProvisionedPollerConfigProvisionedPollerConfigProvisionedPollerConfig#
Configuration for provisioned pollers that read from the event source.

Default: no provisioned pollers

When specified, allows control over the minimum and maximum number of pollers that can be provisioned to process events from the queue.

reportBatchItemFailuresbooleanreport_batch_item_failuresboolreportBatchItemFailuresBooleanReportBatchItemFailuresboolReportBatchItemFailures*bool= false#
Allow functions to return partially successful responses for a batch of records.