interface EventSourceMappingProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Lambda.EventSourceMappingProps |
Java | software.amazon.awscdk.services.lambda.EventSourceMappingProps |
Python | aws_cdk.aws_lambda.EventSourceMappingProps |
TypeScript (source) | @aws-cdk/aws-lambda » EventSourceMappingProps |
Properties for declaring a new event source mapping.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as lambda from '@aws-cdk/aws-lambda';
import * as cdk from '@aws-cdk/core';
declare const eventSourceDlq: lambda.IEventSourceDlq;
declare const function_: lambda.Function;
declare const sourceAccessConfigurationType: lambda.SourceAccessConfigurationType;
const eventSourceMappingProps: lambda.EventSourceMappingProps = {
target: function_,
// the properties below are optional
batchSize: 123,
bisectBatchOnError: false,
enabled: false,
eventSourceArn: 'eventSourceArn',
kafkaBootstrapServers: ['kafkaBootstrapServers'],
kafkaTopic: 'kafkaTopic',
maxBatchingWindow: cdk.Duration.minutes(30),
maxRecordAge: cdk.Duration.minutes(30),
onFailure: eventSourceDlq,
parallelizationFactor: 123,
reportBatchItemFailures: false,
retryAttempts: 123,
sourceAccessConfigurations: [{
type: sourceAccessConfigurationType,
uri: 'uri',
}],
startingPosition: lambda.StartingPosition.TRIM_HORIZON,
tumblingWindow: cdk.Duration.minutes(30),
};
Properties
Name | Type | Description |
---|---|---|
target | IFunction | The target AWS Lambda function. |
batch | number | The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. |
bisect | boolean | If the function returns an error, split the batch in two and retry. |
enabled? | boolean | Set to false to disable the event source upon creation. |
event | string | The Amazon Resource Name (ARN) of the event source. |
kafka | string[] | A list of host and port pairs that are the addresses of the Kafka brokers in a self managed "bootstrap" Kafka cluster that a Kafka client connects to initially to bootstrap itself. |
kafka | string | The name of the Kafka topic. |
max | Duration | The maximum amount of time to gather records before invoking the function. |
max | Duration | The maximum age of a record that Lambda sends to a function for processing. |
on | IEvent | An Amazon SQS queue or Amazon SNS topic destination for discarded records. |
parallelization | number | The number of batches to process from each shard concurrently. |
report | boolean | Allow functions to return partially successful responses for a batch of records. |
retry | number | The maximum number of times to retry when the function returns an error. |
source | Source [] | Specific settings like the authentication protocol or the VPC components to secure access to your event source. |
starting | Starting | The position in the DynamoDB, Kinesis or MSK stream where AWS Lambda should start reading. |
tumbling | Duration | The size of the tumbling windows to group records sent to DynamoDB or Kinesis. |
target
Type:
IFunction
The target AWS Lambda function.
batchSize?
Type:
number
(optional, default: Amazon Kinesis, Amazon DynamoDB, and Amazon MSK is 100 records.
The default for Amazon SQS is 10 messages. For standard SQS queues, the maximum is 10,000. For FIFO SQS queues, the maximum is 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 10000.
bisectBatchOnError?
Type:
boolean
(optional, default: false)
If the function returns an error, split the batch in two and retry.
enabled?
Type:
boolean
(optional, default: true)
Set to false to disable the event source upon creation.
eventSourceArn?
Type:
string
(optional, default: not set if using a self managed Kafka cluster, throws an error otherwise)
The Amazon Resource Name (ARN) of the event source.
Any record added to this stream can invoke the Lambda function.
kafkaBootstrapServers?
Type:
string[]
(optional, default: none)
A list of host and port pairs that are the addresses of the Kafka brokers in a self managed "bootstrap" Kafka cluster that a Kafka client connects to initially to bootstrap itself.
They are in the format abc.example.com:9096
.
kafkaTopic?
Type:
string
(optional, default: no topic)
The name of the Kafka topic.
maxBatchingWindow?
Type:
Duration
(optional, default: Duration.seconds(0))
The maximum amount of time to gather records before invoking the function.
Maximum of Duration.minutes(5)
maxRecordAge?
Type:
Duration
(optional, default: infinite or until the record expires.)
The maximum age of a record that Lambda sends to a function for processing.
Valid Range:
- Minimum value of 60 seconds
- Maximum value of 7 days
onFailure?
Type:
IEvent
(optional, default: discarded records are ignored)
An Amazon SQS queue or Amazon SNS topic destination for discarded records.
parallelizationFactor?
Type:
number
(optional, default: 1)
The number of batches to process from each shard concurrently.
Valid Range:
- Minimum value of 1
- Maximum value of 10
reportBatchItemFailures?
Type:
boolean
(optional, default: false)
Allow functions to return partially successful responses for a batch of records.
retryAttempts?
Type:
number
(optional, default: infinite or until the record expires.)
The maximum number of times to retry when the function returns an error.
Set to undefined
if you want lambda to keep retrying infinitely or until
the record expires.
Valid Range:
- Minimum value of 0
- Maximum value of 10000
sourceAccessConfigurations?
Type:
Source
[]
(optional, default: none)
Specific settings like the authentication protocol or the VPC components to secure access to your event source.
startingPosition?
Type:
Starting
(optional, default: Required for Amazon Kinesis, Amazon DynamoDB, and Amazon MSK Streams sources.)
The position in the DynamoDB, Kinesis or MSK stream where AWS Lambda should start reading.
tumblingWindow?
Type:
Duration
(optional, default: None)
The size of the tumbling windows to group records sent to DynamoDB or Kinesis.
See also: [https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-ddb-windows
Valid Range: 0 - 15 minutes](https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-ddb-windows
Valid Range: 0 - 15 minutes)