EventSourceMappingProps

class aws_cdk.aws_lambda.EventSourceMappingProps(*, event_source_arn, batch_size=None, bisect_batch_on_error=None, enabled=None, max_batching_window=None, max_record_age=None, on_failure=None, parallelization_factor=None, retry_attempts=None, starting_position=None, target)

Bases: aws_cdk.aws_lambda.EventSourceMappingOptions

__init__(*, event_source_arn, batch_size=None, bisect_batch_on_error=None, enabled=None, max_batching_window=None, max_record_age=None, on_failure=None, parallelization_factor=None, retry_attempts=None, starting_position=None, target)

Properties for declaring a new event source mapping.

Parameters
  • event_source_arn (str) – The Amazon Resource Name (ARN) of the event source. Any record added to this stream can invoke the Lambda function.

  • batch_size (Union[int, float, None]) – 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. Default: - Amazon Kinesis and Amazon DynamoDB is 100 records. Both the default and maximum for Amazon SQS are 10 messages.

  • bisect_batch_on_error (Optional[bool]) – If the function returns an error, split the batch in two and retry. Default: false

  • enabled (Optional[bool]) – Set to false to disable the event source upon creation. Default: true

  • max_batching_window (Optional[Duration]) – The maximum amount of time to gather records before invoking the function. Maximum of Duration.minutes(5) Default: Duration.seconds(0)

  • max_record_age (Optional[Duration]) – 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 Default: Duration.days(7)

  • on_failure (Optional[IEventSourceDlq]) – An Amazon SQS queue or Amazon SNS topic destination for discarded records. Default: discarded records are ignored

  • parallelization_factor (Union[int, float, None]) – The number of batches to process from each shard concurrently. Valid Range: - Minimum value of 1 - Maximum value of 10 Default: 1

  • retry_attempts (Union[int, float, None]) – The maximum number of times to retry when the function returns an error. Valid Range: - Minimum value of 0 - Maximum value of 10000 Default: 10000

  • starting_position (Optional[StartingPosition]) – The position in the DynamoDB or Kinesis stream where AWS Lambda should start reading. Default: - Required for Amazon Kinesis and Amazon DynamoDB Streams sources.

  • target (IFunction) – The target AWS Lambda function.

Return type

None

Attributes

batch_size

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.

default :default:

  • Amazon Kinesis and Amazon DynamoDB is 100 records. Both the default and maximum for Amazon SQS are 10 messages.

Return type

Union[int, float, None]

bisect_batch_on_error

If the function returns an error, split the batch in two and retry.

default :default: false

Return type

Optional[bool]

enabled

Set to false to disable the event source upon creation.

default :default: true

Return type

Optional[bool]

event_source_arn

The Amazon Resource Name (ARN) of the event source.

Any record added to this stream can invoke the Lambda function.

Return type

str

max_batching_window

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

Maximum of Duration.minutes(5)

default :default: Duration.seconds(0)

Return type

Optional[Duration]

max_record_age

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

default :default: Duration.days(7)

Return type

Optional[Duration]

on_failure

An Amazon SQS queue or Amazon SNS topic destination for discarded records.

default :default: discarded records are ignored

Return type

Optional[IEventSourceDlq]

parallelization_factor

The number of batches to process from each shard concurrently.

Valid Range:

  • Minimum value of 1

  • Maximum value of 10

default :default: 1

Return type

Union[int, float, None]

retry_attempts

The maximum number of times to retry when the function returns an error.

Valid Range:

  • Minimum value of 0

  • Maximum value of 10000

default :default: 10000

Return type

Union[int, float, None]

starting_position

The position in the DynamoDB or Kinesis stream where AWS Lambda should start reading.

default :default: - Required for Amazon Kinesis and Amazon DynamoDB Streams sources.

see :see: https://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetShardIterator.html#Kinesis-GetShardIterator-request-ShardIteratorType

Return type

Optional[StartingPosition]

target

The target AWS Lambda function.

Return type

IFunction