CfnEventSourceMappingProps

class aws_cdk.aws_lambda.CfnEventSourceMappingProps(*, function_name, batch_size=None, bisect_batch_on_function_error=None, destination_config=None, enabled=None, event_source_arn=None, filter_criteria=None, function_response_types=None, maximum_batching_window_in_seconds=None, maximum_record_age_in_seconds=None, maximum_retry_attempts=None, parallelization_factor=None, queues=None, self_managed_event_source=None, source_access_configurations=None, starting_position=None, starting_position_timestamp=None, topics=None, tumbling_window_in_seconds=None)

Bases: object

Properties for defining a CfnEventSourceMapping.

Parameters
  • function_name (str) – The name of the Lambda function. Name formats - Function name - MyFunction . - Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction . - Version or Alias ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD . - Partial ARN - 123456789012:function:MyFunction . The length constraint applies only to the full ARN. If you specify only the function name, it’s limited to 64 characters in length.

  • batch_size (Union[int, float, None]) – The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function. Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB). - Amazon Kinesis - Default 100. Max 10,000. - Amazon DynamoDB Streams - Default 100. Max 10,000. - Amazon Simple Queue Service - Default 10. For standard queues the max is 10,000. For FIFO queues the max is 10. - Amazon Managed Streaming for Apache Kafka - Default 100. Max 10,000. - Self-Managed Apache Kafka - Default 100. Max 10,000. - Amazon MQ (ActiveMQ and RabbitMQ) - Default 100. Max 10,000.

  • bisect_batch_on_function_error (Union[bool, IResolvable, None]) – (Streams only) If the function returns an error, split the batch in two and retry. The default value is false.

  • destination_config (Union[IResolvable, DestinationConfigProperty, Dict[str, Any], None]) – (Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.

  • enabled (Union[bool, IResolvable, None]) – When true, the event source mapping is active. When false, Lambda pauses polling and invocation. Default: True

  • event_source_arn (Optional[str]) – The Amazon Resource Name (ARN) of the event source. - Amazon Kinesis - The ARN of the data stream or a stream consumer. - Amazon DynamoDB Streams - The ARN of the stream. - Amazon Simple Queue Service - The ARN of the queue. - Amazon Managed Streaming for Apache Kafka - The ARN of the cluster.

  • filter_criteria (Union[IResolvable, FilterCriteriaProperty, Dict[str, Any], None]) – (Streams and Amazon SQS) An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering .

  • function_response_types (Optional[Sequence[str]]) – (Streams and SQS) A list of current response type enums applied to the event source mapping. Valid Values: ReportBatchItemFailures

  • maximum_batching_window_in_seconds (Union[int, float, None]) – The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. Default ( Kinesis , DynamoDB , Amazon SQS event sources) : 0 Default ( Amazon MSK , Kafka, Amazon MQ event sources) : 500 ms

  • maximum_record_age_in_seconds (Union[int, float, None]) – (Streams only) Discard records older than the specified age. The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records.

  • maximum_retry_attempts (Union[int, float, None]) – (Streams only) Discard records after the specified number of retries. The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.

  • parallelization_factor (Union[int, float, None]) – (Streams only) The number of batches to process concurrently from each shard. The default value is 1.

  • queues (Optional[Sequence[str]]) – (Amazon MQ) The name of the Amazon MQ broker destination queue to consume.

  • self_managed_event_source (Union[IResolvable, SelfManagedEventSourceProperty, Dict[str, Any], None]) – The self-managed Apache Kafka cluster for your event source.

  • source_access_configurations (Union[IResolvable, Sequence[Union[IResolvable, SourceAccessConfigurationProperty, Dict[str, Any]]], None]) – An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.

  • starting_position (Optional[str]) – The position in a stream from which to start reading. Required for Amazon Kinesis and Amazon DynamoDB. - LATEST - Read only new records. - TRIM_HORIZON - Process all available records. - AT_TIMESTAMP - Specify a time from which to start reading records.

  • starting_position_timestamp (Union[int, float, None]) – With StartingPosition set to AT_TIMESTAMP , the time from which to start reading, in Unix time seconds.

  • topics (Optional[Sequence[str]]) – The name of the Kafka topic.

  • tumbling_window_in_seconds (Union[int, float, None]) – (Streams only) The duration in seconds of a processing window. The range is between 1 second up to 900 seconds.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_lambda as lambda_

cfn_event_source_mapping_props = lambda.CfnEventSourceMappingProps(
    function_name="functionName",

    # the properties below are optional
    batch_size=123,
    bisect_batch_on_function_error=False,
    destination_config=lambda.CfnEventSourceMapping.DestinationConfigProperty(
        on_failure=lambda.CfnEventSourceMapping.OnFailureProperty(
            destination="destination"
        )
    ),
    enabled=False,
    event_source_arn="eventSourceArn",
    filter_criteria=lambda.CfnEventSourceMapping.FilterCriteriaProperty(
        filters=[lambda.CfnEventSourceMapping.FilterProperty(
            pattern="pattern"
        )]
    ),
    function_response_types=["functionResponseTypes"],
    maximum_batching_window_in_seconds=123,
    maximum_record_age_in_seconds=123,
    maximum_retry_attempts=123,
    parallelization_factor=123,
    queues=["queues"],
    self_managed_event_source=lambda.CfnEventSourceMapping.SelfManagedEventSourceProperty(
        endpoints=lambda.CfnEventSourceMapping.EndpointsProperty(
            kafka_bootstrap_servers=["kafkaBootstrapServers"]
        )
    ),
    source_access_configurations=[lambda.CfnEventSourceMapping.SourceAccessConfigurationProperty(
        type="type",
        uri="uri"
    )],
    starting_position="startingPosition",
    starting_position_timestamp=123,
    topics=["topics"],
    tumbling_window_in_seconds=123
)

Attributes

batch_size

The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function.

Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).

  • Amazon Kinesis - Default 100. Max 10,000.

  • Amazon DynamoDB Streams - Default 100. Max 10,000.

  • Amazon Simple Queue Service - Default 10. For standard queues the max is 10,000. For FIFO queues the max is 10.

  • Amazon Managed Streaming for Apache Kafka - Default 100. Max 10,000.

  • Self-Managed Apache Kafka - Default 100. Max 10,000.

  • Amazon MQ (ActiveMQ and RabbitMQ) - Default 100. Max 10,000.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-batchsize

Return type

Union[int, float, None]

bisect_batch_on_function_error

(Streams only) If the function returns an error, split the batch in two and retry.

The default value is false.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-bisectbatchonfunctionerror

Return type

Union[bool, IResolvable, None]

destination_config

(Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-destinationconfig

Return type

Union[IResolvable, DestinationConfigProperty, None]

enabled

When true, the event source mapping is active. When false, Lambda pauses polling and invocation.

Default: True

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-enabled

Return type

Union[bool, IResolvable, None]

event_source_arn

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

  • Amazon Kinesis - The ARN of the data stream or a stream consumer.

  • Amazon DynamoDB Streams - The ARN of the stream.

  • Amazon Simple Queue Service - The ARN of the queue.

  • Amazon Managed Streaming for Apache Kafka - The ARN of the cluster.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-eventsourcearn

Return type

Optional[str]

filter_criteria

(Streams and Amazon SQS) An object that defines the filter criteria that determine whether Lambda should process an event.

For more information, see Lambda event filtering .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-filtercriteria

Return type

Union[IResolvable, FilterCriteriaProperty, None]

function_name

The name of the Lambda function.

Name formats - Function name - MyFunction .

  • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .

  • Version or Alias ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD .

  • Partial ARN - 123456789012:function:MyFunction .

The length constraint applies only to the full ARN. If you specify only the function name, it’s limited to 64 characters in length.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-functionname

Return type

str

function_response_types

(Streams and SQS) A list of current response type enums applied to the event source mapping.

Valid Values: ReportBatchItemFailures

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-functionresponsetypes

Return type

Optional[List[str]]

maximum_batching_window_in_seconds

The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function.

Default ( Kinesis , DynamoDB , Amazon SQS event sources) : 0

Default ( Amazon MSK , Kafka, Amazon MQ event sources) : 500 ms

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-maximumbatchingwindowinseconds

Return type

Union[int, float, None]

maximum_record_age_in_seconds

(Streams only) Discard records older than the specified age.

The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-maximumrecordageinseconds

Return type

Union[int, float, None]

maximum_retry_attempts

(Streams only) Discard records after the specified number of retries.

The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-maximumretryattempts

Return type

Union[int, float, None]

parallelization_factor

(Streams only) The number of batches to process concurrently from each shard.

The default value is 1.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-parallelizationfactor

Return type

Union[int, float, None]

queues

(Amazon MQ) The name of the Amazon MQ broker destination queue to consume.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-queues

Return type

Optional[List[str]]

self_managed_event_source

The self-managed Apache Kafka cluster for your event source.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-selfmanagedeventsource

Return type

Union[IResolvable, SelfManagedEventSourceProperty, None]

source_access_configurations

An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-sourceaccessconfigurations

Return type

Union[IResolvable, List[Union[IResolvable, SourceAccessConfigurationProperty]], None]

starting_position

The position in a stream from which to start reading. Required for Amazon Kinesis and Amazon DynamoDB.

  • LATEST - Read only new records.

  • TRIM_HORIZON - Process all available records.

  • AT_TIMESTAMP - Specify a time from which to start reading records.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-startingposition

Return type

Optional[str]

starting_position_timestamp

With StartingPosition set to AT_TIMESTAMP , the time from which to start reading, in Unix time seconds.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-startingpositiontimestamp

Return type

Union[int, float, None]

topics

The name of the Kafka topic.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-topics

Return type

Optional[List[str]]

tumbling_window_in_seconds

(Streams only) The duration in seconds of a processing window.

The range is between 1 second up to 900 seconds.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-tumblingwindowinseconds

Return type

Union[int, float, None]