CfnEventSourceMappingProps
- class aws_cdk.aws_lambda.CfnEventSourceMappingProps(*, function_name, amazon_managed_kafka_event_source_config=None, batch_size=None, bisect_batch_on_function_error=None, destination_config=None, document_db_event_source_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, scaling_config=None, self_managed_event_source=None, self_managed_kafka_event_source_config=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.amazon_managed_kafka_event_source_config (
Union
[IResolvable
,AmazonManagedKafkaEventSourceConfigProperty
,Dict
[str
,Any
],None
]) – Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.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. - DocumentDB – Default 100. Max 10,000.bisect_batch_on_function_error (
Union
[bool
,IResolvable
,None
]) – (Kinesis and DynamoDB 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
]) – (Kinesis and DynamoDB Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.document_db_event_source_config (
Union
[IResolvable
,DocumentDBEventSourceConfigProperty
,Dict
[str
,Any
],None
]) – Specific configuration settings for a DocumentDB event source.enabled (
Union
[bool
,IResolvable
,None
]) – When true, the event source mapping is active. When false, Lambda pauses polling and invocation. Default: Trueevent_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. - Amazon MQ – The ARN of the broker. - Amazon DocumentDB – The ARN of the DocumentDB change stream.filter_criteria (
Union
[IResolvable
,FilterCriteriaProperty
,Dict
[str
,Any
],None
]) – 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 , Amazon DocumentDB event sources) : 500 ms Related setting: For Amazon SQS event sources, when you setBatchSize
to a value greater than 10, you must setMaximumBatchingWindowInSeconds
to at least 1.maximum_record_age_in_seconds (
Union
[int
,float
,None
]) – (Kinesis and DynamoDB 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. .. epigraph:: The minimum valid value for maximum record age is 60s. Although values less than 60 and greater than -1 fall within the parameter’s absolute range, they are not allowedmaximum_retry_attempts (
Union
[int
,float
,None
]) – (Kinesis and DynamoDB 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
]) – (Kinesis and DynamoDB 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.scaling_config (
Union
[IResolvable
,ScalingConfigProperty
,Dict
[str
,Any
],None
]) – (Amazon SQS only) The scaling configuration for the event source. For more information, see Configuring maximum concurrency for Amazon SQS event sources .self_managed_event_source (
Union
[IResolvable
,SelfManagedEventSourceProperty
,Dict
[str
,Any
],None
]) – The self-managed Apache Kafka cluster for your event source.self_managed_kafka_event_source_config (
Union
[IResolvable
,SelfManagedKafkaEventSourceConfigProperty
,Dict
[str
,Any
],None
]) – Specific configuration settings for a self-managed Apache Kafka 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
]) – WithStartingPosition
set toAT_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
]) – (Kinesis and DynamoDB Streams only) The duration in seconds of a processing window for DynamoDB and Kinesis Streams event sources. A value of 0 seconds indicates no tumbling window.
- Link:
- 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 amazon_managed_kafka_event_source_config=lambda.CfnEventSourceMapping.AmazonManagedKafkaEventSourceConfigProperty( consumer_group_id="consumerGroupId" ), batch_size=123, bisect_batch_on_function_error=False, destination_config=lambda.CfnEventSourceMapping.DestinationConfigProperty( on_failure=lambda.CfnEventSourceMapping.OnFailureProperty( destination="destination" ) ), document_db_event_source_config=lambda.CfnEventSourceMapping.DocumentDBEventSourceConfigProperty( collection_name="collectionName", database_name="databaseName", full_document="fullDocument" ), 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"], scaling_config=lambda.CfnEventSourceMapping.ScalingConfigProperty( maximum_concurrency=123 ), self_managed_event_source=lambda.CfnEventSourceMapping.SelfManagedEventSourceProperty( endpoints=lambda.CfnEventSourceMapping.EndpointsProperty( kafka_bootstrap_servers=["kafkaBootstrapServers"] ) ), self_managed_kafka_event_source_config=lambda.CfnEventSourceMapping.SelfManagedKafkaEventSourceConfigProperty( consumer_group_id="consumerGroupId" ), 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
- amazon_managed_kafka_event_source_config
Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.
- 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.
DocumentDB – Default 100. Max 10,000.
- bisect_batch_on_function_error
(Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry.
The default value is false.
- destination_config
(Kinesis and DynamoDB Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.
- document_db_event_source_config
Specific configuration settings for a DocumentDB event source.
- enabled
When true, the event source mapping is active. When false, Lambda pauses polling and invocation.
Default: True
- 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.
Amazon MQ – The ARN of the broker.
Amazon DocumentDB – The ARN of the DocumentDB change stream.
- filter_criteria
An object that defines the filter criteria that determine whether Lambda should process an event.
For more information, see Lambda event filtering .
- 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.
- function_response_types
(Streams and SQS) A list of current response type enums applied to the event source mapping.
Valid Values:
ReportBatchItemFailures
- 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 , Amazon DocumentDB event sources) : 500 ms
Related setting: For Amazon SQS event sources, when you set
BatchSize
to a value greater than 10, you must setMaximumBatchingWindowInSeconds
to at least 1.
- maximum_record_age_in_seconds
(Kinesis and DynamoDB 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. .. epigraph:
The minimum valid value for maximum record age is 60s. Although values less than 60 and greater than -1 fall within the parameter's absolute range, they are not allowed
- maximum_retry_attempts
(Kinesis and DynamoDB 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
(Kinesis and DynamoDB Streams only) The number of batches to process concurrently from each shard.
The default value is 1.
- queues
(Amazon MQ) The name of the Amazon MQ broker destination queue to consume.
- scaling_config
(Amazon SQS only) The scaling configuration for the event source.
For more information, see Configuring maximum concurrency for Amazon SQS event sources .
- self_managed_event_source
The self-managed Apache Kafka cluster for your event source.
- self_managed_kafka_event_source_config
Specific configuration settings for a self-managed Apache Kafka event source.
- source_access_configurations
An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.
- 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.
- starting_position_timestamp
With
StartingPosition
set toAT_TIMESTAMP
, the time from which to start reading, in Unix time seconds.
- topics
The name of the Kafka topic.
- tumbling_window_in_seconds
(Kinesis and DynamoDB Streams only) The duration in seconds of a processing window for DynamoDB and Kinesis Streams event sources.
A value of 0 seconds indicates no tumbling window.