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, kms_key_arn=None, maximum_batching_window_in_seconds=None, maximum_record_age_in_seconds=None, maximum_retry_attempts=None, metrics_config=None, parallelization_factor=None, provisioned_poller_config=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, tags=None, topics=None, tumbling_window_in_seconds=None)
Bases:
object
Properties for defining a
CfnEventSourceMapping
.- Parameters:
function_name (
str
) – The name or ARN 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, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka event sources only) A configuration object that specifies the destination of an event after Lambda processes it.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 or the ARN of the VPC connection (for cross-account event source mappings ). - 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
]]) – (Kinesis, DynamoDB Streams, and SQS) A list of current response type enums applied to the event source mapping. Valid Values:ReportBatchItemFailures
kms_key_arn (
Optional
[str
]) – The ARN of the AWS Key Management Service ( AWS KMS ) customer managed key that Lambda uses to encrypt your function’s filter criteria .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.metrics_config (
Union
[IResolvable
,MetricsConfigProperty
,Dict
[str
,Any
],None
]) – The metrics configuration for your event source. For more information, see Event source mapping metrics .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.provisioned_poller_config (
Union
[IResolvable
,ProvisionedPollerConfigProperty
,Dict
[str
,Any
],None
]) – (Amazon MSK and self-managed Apache Kafka only) The provisioned mode configuration for the event source. For more information, see provisioned mode .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.StartingPositionTimestamp
cannot be in the future.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – A list of tags to add to the event source mapping. .. epigraph:: You must have thelambda:TagResource
,lambda:UntagResource
, andlambda:ListTags
permissions for your IAM principal to manage the AWS CloudFormation stack. If you don’t have these permissions, there might be unexpected behavior with stack-level tags propagating to the resource during resource creation and update.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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import 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"], kms_key_arn="kmsKeyArn", maximum_batching_window_in_seconds=123, maximum_record_age_in_seconds=123, maximum_retry_attempts=123, metrics_config=lambda.CfnEventSourceMapping.MetricsConfigProperty( metrics=["metrics"] ), parallelization_factor=123, provisioned_poller_config=lambda.CfnEventSourceMapping.ProvisionedPollerConfigProperty( maximum_pollers=123, minimum_pollers=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, tags=[CfnTag( key="key", value="value" )], 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, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka event sources only) A configuration object that specifies the destination of an event after Lambda processes it.
- 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 or the ARN of the VPC connection (for cross-account event source mappings ).
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 or ARN 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
(Kinesis, DynamoDB Streams, and SQS) A list of current response type enums applied to the event source mapping.
Valid Values:
ReportBatchItemFailures
- kms_key_arn
//docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html#filtering-basics>`_ .
- See:
- Type:
The ARN of the AWS Key Management Service ( AWS KMS ) customer managed key that Lambda uses to encrypt your function’s `filter criteria <https
- 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.
- metrics_config
The metrics configuration for your event source.
For more information, see Event source mapping metrics .
- parallelization_factor
(Kinesis and DynamoDB Streams only) The number of batches to process concurrently from each shard.
The default value is 1.
- provisioned_poller_config
(Amazon MSK and self-managed Apache Kafka only) The provisioned mode configuration for the event source.
For more information, see provisioned mode .
- 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.StartingPositionTimestamp
cannot be in the future.
- tags
A list of tags to add to the event source mapping.
You must have the
lambda:TagResource
,lambda:UntagResource
, andlambda:ListTags
permissions for your IAM principal to manage the AWS CloudFormation stack. If you don’t have these permissions, there might be unexpected behavior with stack-level tags propagating to the resource during resource creation and update.
- 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.