Skip to content

LambdaClient.create_event_source_mapping

rboto-lambda==0.4.0 · Service index · Types

Model summary (excerpt): Creates a mapping between an event source and an Lambda Event Function. Lambda reads items from the event source and invokes the function. For details about how to configure different event sources, see the following topics. Amazon DynamoDB Streams Amazon Kinesis Amazon SQS Amazon MQ and RabbitMQ Amazon MSK Apache Kafka Amazon DocumentDB The following error handling options are available for...

Install and imports

python -m pip install "rboto[lambda]==0.4.0"
from rboto import LambdaClient
from collections.abc import Sequence
from rboto_lambda.types import (
    AmazonManagedKafkaEventSourceConfig,
    CreateEventSourceMappingOutput,
    DestinationConfig,
    DocumentDBEventSourceConfig,
    EventSourceMappingLoggingConfig,
    EventSourceMappingMetricsConfig,
    EventSourcePosition,
    FilterCriteria,
    FunctionResponseType,
    ProvisionedPollerConfig,
    ScalingConfig,
    SelfManagedEventSource,
    SelfManagedKafkaEventSourceConfig,
    SourceAccessConfiguration,
)

Signature

async def create_event_source_mapping(
    *,
    function_name: str,
    event_source_arn: str | None = None,
    enabled: bool | None = None,
    batch_size: int | None = None,
    filter_criteria: FilterCriteria | None = None,
    kms_key_arn: str | None = None,
    metrics_config: EventSourceMappingMetricsConfig | None = None,
    logging_config: EventSourceMappingLoggingConfig | None = None,
    scaling_config: ScalingConfig | None = None,
    maximum_batching_window_in_seconds: int | None = None,
    parallelization_factor: int | None = None,
    starting_position: EventSourcePosition | None = None,
    starting_position_timestamp: str | None = None,
    destination_config: DestinationConfig | None = None,
    maximum_record_age_in_seconds: int | None = None,
    bisect_batch_on_function_error: bool | None = None,
    maximum_retry_attempts: int | None = None,
    tags: dict[str, str] | None = None,
    tumbling_window_in_seconds: int | None = None,
    topics: Sequence[str] | None = None,
    queues: Sequence[str] | None = None,
    source_access_configurations: Sequence[SourceAccessConfiguration] | None = None,
    self_managed_event_source: SelfManagedEventSource | None = None,
    function_response_types: Sequence[FunctionResponseType] | None = None,
    amazon_managed_kafka_event_source_config: AmazonManagedKafkaEventSourceConfig | None = None,
    self_managed_kafka_event_source_config: SelfManagedKafkaEventSourceConfig | None = None,
    document_db_event_source_config: DocumentDBEventSourceConfig | None = None,
    provisioned_poller_config: ProvisionedPollerConfig | None = None,
) -> CreateEventSourceMappingOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
function_name Yes 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...
event_source_arn No 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...
enabled No When true, the event source mapping is active. When false, Lambda pauses polling and invocation. Default: True
batch_size No 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...
filter_criteria No An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering .
kms_key_arn No The ARN of the Key Management Service (KMS) customer managed key that Lambda uses to encrypt your function's filter criteria . By default, Lambda does not encrypt your filter criteria object. Specify this property to encrypt data using your own customer managed key.
metrics_config No The metrics configuration for your event source. For more information, see Event source mapping metrics .
logging_config No (Amazon MSK, and self-managed Apache Kafka only) The logging configuration for your event source. For more information, see Event source mapping logging .
scaling_config No (Amazon SQS only) The scaling configuration for the event source. For more information, see Configuring maximum concurrency for Amazon SQS event sources .
maximum_batching_window_in_seconds No The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. You can configure MaximumBatchingWindowInSeconds to any value from 0 seconds to 300 seconds in increments of seconds. For Kinesis, DynamoDB, and Amazon SQS event sources, the default batching window is 0 seconds. For Amazon MSK, Self-managed Apache Kafka, Amazon MQ, and DocumentDB event...
parallelization_factor No (Kinesis and DynamoDB Streams only) The number of batches to process from each shard concurrently.
starting_position No The position in a stream from which to start reading. Required for Amazon Kinesis and Amazon DynamoDB Stream event sources. AT_TIMESTAMP is supported only for Amazon Kinesis streams, Amazon DocumentDB, Amazon MSK, and self-managed Apache Kafka. Not supported for Kafka event source mappings when ConsumptionMode is Queue .
starting_position_timestamp No With StartingPosition set to AT_TIMESTAMP , the time from which to start reading. StartingPositionTimestamp cannot be in the future. Not supported for Kafka event source mappings when ConsumptionMode is Queue .
destination_config No (Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) A configuration object that specifies the destination of an event after Lambda processes it.
maximum_record_age_in_seconds No (Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) Discard records older than the specified age. The default value is infinite (-1).
bisect_batch_on_function_error No (Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) If the function returns an error, split the batch in two and retry.
maximum_retry_attempts No (Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) Discard records after the specified number of retries. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires. For Kafka event source mappings with ConsumptionMode set to Queue , the value -1 (infinite retries) is not supported and the default is 0 (no retries)....
tags No A list of tags to apply to the event source mapping.
tumbling_window_in_seconds No (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.
topics No The name of the Kafka topic.
queues No (MQ) The name of the Amazon MQ broker destination queue to consume.
source_access_configurations No An array of authentication protocols or VPC components required to secure your event source.
self_managed_event_source No The self-managed Apache Kafka cluster to receive records from.
function_response_types No (Kinesis, DynamoDB Streams, Amazon MSK, self-managed Apache Kafka, and Amazon SQS) A list of current response type enums applied to the event source mapping.
amazon_managed_kafka_event_source_config No Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.
self_managed_kafka_event_source_config No Specific configuration settings for a self-managed Apache Kafka event source.
document_db_event_source_config No Specific configuration settings for a DocumentDB event source.
provisioned_poller_config No (Amazon SQS, Amazon MSK, and self-managed Apache Kafka only) The provisioned mode configuration for the event source. For more information, see provisioned mode .

Output

CreateEventSourceMappingOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
uuid str | None Always present —
starting_position EventSourcePositionOutput | None Always present EventSourcePositionOutput
starting_position_timestamp str | None Always present —
batch_size int | None Always present —
maximum_batching_window_in_seconds int | None Always present —
parallelization_factor int | None Always present —
event_source_arn str | None Always present —
filter_criteria FilterCriteriaOutput | None Always present FilterCriteriaOutput
filter_criteria_error FilterCriteriaErrorOutput | None Always present FilterCriteriaErrorOutput
kms_key_arn str | None Always present —
metrics_config EventSourceMappingMetricsConfigOutput | None Always present EventSourceMappingMetricsConfigOutput
logging_config EventSourceMappingLoggingConfigOutput | None Always present EventSourceMappingLoggingConfigOutput
scaling_config ScalingConfigOutput | None Always present ScalingConfigOutput
function_arn str | None Always present —
last_modified str | None Always present —
last_processing_result str | None Always present —
state str | None Always present —
state_transition_reason str | None Always present —
destination_config DestinationConfigOutput | None Always present DestinationConfigOutput
topics list[str] | None Always present —
queues list[str] | None Always present —
source_access_configurations list[SourceAccessConfigurationOutput] | None Always present SourceAccessConfigurationOutput
self_managed_event_source SelfManagedEventSourceOutput | None Always present SelfManagedEventSourceOutput
maximum_record_age_in_seconds int | None Always present —
bisect_batch_on_function_error bool | None Always present —
maximum_retry_attempts int | None Always present —
tumbling_window_in_seconds int | None Always present —
function_response_types list[FunctionResponseTypeOutput] | None Always present FunctionResponseTypeOutput
amazon_managed_kafka_event_source_config AmazonManagedKafkaEventSourceConfigOutput | None Always present AmazonManagedKafkaEventSourceConfigOutput
self_managed_kafka_event_source_config SelfManagedKafkaEventSourceConfigOutput | None Always present SelfManagedKafkaEventSourceConfigOutput
document_db_event_source_config DocumentDbEventSourceConfig | None Always present DocumentDbEventSourceConfig
event_source_mapping_arn str | None Always present —
provisioned_poller_config ProvisionedPollerConfigOutput | None Always present ProvisionedPollerConfigOutput

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

AmazonManagedKafkaEventSourceConfig, CreateEventSourceMappingOutput, DestinationConfig, DocumentDBEventSourceConfig, EventSourceMappingLoggingConfig, EventSourceMappingMetricsConfig, EventSourcePosition, FilterCriteria, FunctionResponseType, ProvisionedPollerConfig, ScalingConfig, SelfManagedEventSource, SelfManagedKafkaEventSourceConfig, SourceAccessConfiguration

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_lambda.exceptions:

InvalidParameterValueError, ResourceConflictError, ResourceNotFoundError, ServiceError, TooManyRequestsError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model