Skip to content

create_event_source_mapping

create_event_source_mapping(
    function_name: NamespacedFunctionName,
    *,
    config_overrides: Optional[LambdaClientConfig] = None,
    event_source_arn: Optional[Arn] = None,
    enabled: Optional[Enabled] = None,
    batch_size: Optional[BatchSize] = None,
    filter_criteria: Optional[FilterCriteria] = None,
    kms_key_arn: Optional[KMSKeyArn] = None,
    metrics_config: Optional[EventSourceMappingMetricsConfig] = None,
    logging_config: Optional[EventSourceMappingLoggingConfig] = None,
    scaling_config: Optional[ScalingConfig] = None,
    maximum_batching_window_in_seconds: Optional[MaximumBatchingWindowInSeconds] = None,
    parallelization_factor: Optional[ParallelizationFactor] = None,
    starting_position: Optional[EventSourcePosition] = None,
    starting_position_timestamp: Optional[Date] = None,
    destination_config: Optional[DestinationConfig] = None,
    maximum_record_age_in_seconds: Optional[MaximumRecordAgeInSeconds] = None,
    bisect_batch_on_function_error: Optional[BisectBatchOnFunctionError] = None,
    maximum_retry_attempts: Optional[MaximumRetryAttemptsEventSourceMapping] = None,
    tags: Optional[Tags] = None,
    tumbling_window_in_seconds: Optional[TumblingWindowInSeconds] = None,
    topics: Optional[Topics] = None,
    queues: Optional[Queues] = None,
    source_access_configurations: Optional[SourceAccessConfigurations] = None,
    self_managed_event_source: Optional[SelfManagedEventSource] = None,
    function_response_types: Optional[FunctionResponseTypeList] = None,
    amazon_managed_kafka_event_source_config: Optional[
        AmazonManagedKafkaEventSourceConfig
    ] = None,
    self_managed_kafka_event_source_config: Optional[
        SelfManagedKafkaEventSourceConfig
    ] = None,
    document_db_event_source_config: Optional[DocumentDBEventSourceConfig] = None,
    provisioned_poller_config: Optional[ProvisionedPollerConfig] = None,
) -> EventSourceMappingConfiguration

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.

The following error handling options are available for stream sources (DynamoDB, Kinesis, Amazon MSK, and self-managed Apache Kafka):

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

  • MaximumRecordAgeInSeconds – Discard records older than the specified age. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires

  • MaximumRetryAttempts – 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.

  • OnFailure – Send discarded records to an Amazon SQS queue, Amazon SNS topic, Kafka topic, or Amazon S3 bucket. For more information, see Adding a destination.

The following option is available only for DynamoDB and Kinesis event sources:

  • ParallelizationFactor – Process multiple batches from each shard concurrently.

For information about which configuration parameters apply to each event source, see the following topics.

Parameters:

  • event_source_arn (Optional[Arn], default: None ) –

    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.

  • function_name (NamespacedFunctionName) –

    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.

  • enabled (Optional[Enabled], default: None ) –

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

    Default: True

  • batch_size (Optional[BatchSize], default: 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.

  • filter_criteria (Optional[FilterCriteria], default: None ) –

    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 (Optional[KMSKeyArn], default: None ) –

    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 (Optional[EventSourceMappingMetricsConfig], default: None ) –

    The metrics configuration for your event source. For more information, see Event source mapping metrics.

  • logging_config (Optional[EventSourceMappingLoggingConfig], default: None ) –

    (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 (Optional[ScalingConfig], default: None ) –

    (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 (Optional[MaximumBatchingWindowInSeconds], default: None ) –

    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 sources, the default batching window is 500 ms. Note that because you can only change MaximumBatchingWindowInSeconds in increments of seconds, you cannot revert back to the 500 ms default batching window after you have changed it. To restore the default batching window, you must create a new event source mapping.

    Related setting: For Kinesis, DynamoDB, and Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

  • parallelization_factor (Optional[ParallelizationFactor], default: None ) –

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

  • starting_position (Optional[EventSourcePosition], default: None ) –

    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.

  • starting_position_timestamp (Optional[Date], default: None ) –

    With StartingPosition set to AT_TIMESTAMP, the time from which to start reading. StartingPositionTimestamp cannot be in the future.

  • destination_config (Optional[DestinationConfig], default: None ) –

    (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 (Optional[MaximumRecordAgeInSeconds], default: None ) –

    (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 (Optional[BisectBatchOnFunctionError], default: None ) –

    (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 (Optional[MaximumRetryAttemptsEventSourceMapping], default: None ) –

    (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.

  • tags (Optional[Tags], default: None ) –

    A list of tags to apply to the event source mapping.

  • tumbling_window_in_seconds (Optional[TumblingWindowInSeconds], default: 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.

  • topics (Optional[Topics], default: None ) –

    The name of the Kafka topic.

  • queues (Optional[Queues], default: None ) –

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

  • source_access_configurations (Optional[SourceAccessConfigurations], default: None ) –

    An array of authentication protocols or VPC components required to secure your event source.

  • self_managed_event_source (Optional[SelfManagedEventSource], default: None ) –

    The self-managed Apache Kafka cluster to receive records from.

  • function_response_types (Optional[FunctionResponseTypeList], default: None ) –

    (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 (Optional[AmazonManagedKafkaEventSourceConfig], default: None ) –

    Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.

  • self_managed_kafka_event_source_config (Optional[SelfManagedKafkaEventSourceConfig], default: None ) –

    Specific configuration settings for a self-managed Apache Kafka event source.

  • document_db_event_source_config (Optional[DocumentDBEventSourceConfig], default: None ) –

    Specific configuration settings for a DocumentDB event source.

  • provisioned_poller_config (Optional[ProvisionedPollerConfig], default: None ) –

    (Amazon SQS, Amazon MSK, and self-managed Apache Kafka only) The provisioned mode configuration for the event source. For more information, see provisioned mode.

Raises:

Examples:

To create a mapping between an event source and an AWS Lambda function The following example creates a mapping between an SQS queue and the my-function Lambda function.

>>> client.create_event_source_mapping(batch_size=5, event_source_arn='arn:aws:sqs:us-west-2:123456789012:my-queue', function_name='my-function')
Source code in docs_src/capo_lambda/_services/_lambda.py
def create_event_source_mapping(
    self,
    function_name: "capo_lambda.types.namespaced_function_name.NamespacedFunctionName",
    *,
    config_overrides: Optional[LambdaClientConfig] = None,
    event_source_arn: Optional["capo_lambda.types.arn.Arn"] = None,
    enabled: Optional["capo_lambda.types.enabled.Enabled"] = None,
    batch_size: Optional["capo_lambda.types.batch_size.BatchSize"] = None,
    filter_criteria: Optional[
        "capo_lambda.types.filter_criteria.FilterCriteria"
    ] = None,
    kms_key_arn: Optional["capo_lambda.types.kms_key_arn.KMSKeyArn"] = None,
    metrics_config: Optional[
        "capo_lambda.types.event_source_mapping_metrics_config.EventSourceMappingMetricsConfig"
    ] = None,
    logging_config: Optional[
        "capo_lambda.types.event_source_mapping_logging_config.EventSourceMappingLoggingConfig"
    ] = None,
    scaling_config: Optional[
        "capo_lambda.types.scaling_config.ScalingConfig"
    ] = None,
    maximum_batching_window_in_seconds: Optional[
        "capo_lambda.types.maximum_batching_window_in_seconds.MaximumBatchingWindowInSeconds"
    ] = None,
    parallelization_factor: Optional[
        "capo_lambda.types.parallelization_factor.ParallelizationFactor"
    ] = None,
    starting_position: Optional[
        "capo_lambda.types.event_source_position.EventSourcePosition"
    ] = None,
    starting_position_timestamp: Optional["capo_lambda.types.date.Date"] = None,
    destination_config: Optional[
        "capo_lambda.types.destination_config.DestinationConfig"
    ] = None,
    maximum_record_age_in_seconds: Optional[
        "capo_lambda.types.maximum_record_age_in_seconds.MaximumRecordAgeInSeconds"
    ] = None,
    bisect_batch_on_function_error: Optional[
        "capo_lambda.types.bisect_batch_on_function_error.BisectBatchOnFunctionError"
    ] = None,
    maximum_retry_attempts: Optional[
        "capo_lambda.types.maximum_retry_attempts_event_source_mapping.MaximumRetryAttemptsEventSourceMapping"
    ] = None,
    tags: Optional["capo_lambda.types.tags.Tags"] = None,
    tumbling_window_in_seconds: Optional[
        "capo_lambda.types.tumbling_window_in_seconds.TumblingWindowInSeconds"
    ] = None,
    topics: Optional["capo_lambda.types.topics.Topics"] = None,
    queues: Optional["capo_lambda.types.queues.Queues"] = None,
    source_access_configurations: Optional[
        "capo_lambda.types.source_access_configurations.SourceAccessConfigurations"
    ] = None,
    self_managed_event_source: Optional[
        "capo_lambda.types.self_managed_event_source.SelfManagedEventSource"
    ] = None,
    function_response_types: Optional[
        "capo_lambda.types.function_response_type_list.FunctionResponseTypeList"
    ] = None,
    amazon_managed_kafka_event_source_config: Optional[
        "capo_lambda.types.amazon_managed_kafka_event_source_config.AmazonManagedKafkaEventSourceConfig"
    ] = None,
    self_managed_kafka_event_source_config: Optional[
        "capo_lambda.types.self_managed_kafka_event_source_config.SelfManagedKafkaEventSourceConfig"
    ] = None,
    document_db_event_source_config: Optional[
        "capo_lambda.types.document_db_event_source_config.DocumentDBEventSourceConfig"
    ] = None,
    provisioned_poller_config: Optional[
        "capo_lambda.types.provisioned_poller_config.ProvisionedPollerConfig"
    ] = None,
) -> "capo_lambda.types.event_source_mapping_configuration.EventSourceMappingConfiguration":
    """<p>Creates a mapping between an event source and an Lambda Event Function. Lambda reads items from the event source and invokes the function.</p> <p>For details about how to configure different event sources, see the following topics. </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-dynamodb-eventsourcemapping"> Amazon DynamoDB Streams</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-eventsourcemapping"> Amazon Kinesis</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-eventsource"> Amazon SQS</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-mq.html#services-mq-eventsourcemapping"> Amazon MQ and RabbitMQ</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html"> Amazon MSK</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/kafka-smaa.html"> Apache Kafka</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-documentdb.html"> Amazon DocumentDB</a> </p> </li> </ul> <p>The following error handling options are available for stream sources (DynamoDB, Kinesis, Amazon MSK, and self-managed Apache Kafka):</p> <ul> <li> <p> <code>BisectBatchOnFunctionError</code> – If the function returns an error, split the batch in two and retry.</p> </li> <li> <p> <code>MaximumRecordAgeInSeconds</code> – Discard records older than the specified age. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires</p> </li> <li> <p> <code>MaximumRetryAttempts</code> – 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.</p> </li> <li> <p> <code>OnFailure</code> – Send discarded records to an Amazon SQS queue, Amazon SNS topic, Kafka topic, or Amazon S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async-retain-records.html#invocation-async-destinations">Adding a destination</a>.</p> </li> </ul> <p>The following option is available only for DynamoDB and Kinesis event sources:</p> <ul> <li> <p> <code>ParallelizationFactor</code> – Process multiple batches from each shard concurrently.</p> </li> </ul> <p>For information about which configuration parameters apply to each event source, see the following topics.</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-ddb-params"> Amazon DynamoDB Streams</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-params"> Amazon Kinesis</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#services-sqs-params"> Amazon SQS</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-mq.html#services-mq-params"> Amazon MQ and RabbitMQ</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#services-msk-parms"> Amazon MSK</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kafka.html#services-kafka-parms"> Apache Kafka</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-documentdb.html#docdb-configuration"> Amazon DocumentDB</a> </p> </li> </ul>

    Args:
        event_source_arn: <p>The Amazon Resource Name (ARN) of the event source.</p> <ul> <li> <p> <b>Amazon Kinesis</b> – The ARN of the data stream or a stream consumer.</p> </li> <li> <p> <b>Amazon DynamoDB Streams</b> – The ARN of the stream.</p> </li> <li> <p> <b>Amazon Simple Queue Service</b> – The ARN of the queue.</p> </li> <li> <p> <b>Amazon Managed Streaming for Apache Kafka</b> – The ARN of the cluster or the ARN of the VPC connection (for <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#msk-multi-vpc">cross-account event source mappings</a>).</p> </li> <li> <p> <b>Amazon MQ</b> – The ARN of the broker.</p> </li> <li> <p> <b>Amazon DocumentDB</b> – The ARN of the DocumentDB change stream.</p> </li> </ul>
        function_name: <p>The name or ARN of the Lambda function.</p> <p class="title"> <b>Name formats</b> </p> <ul> <li> <p> <b>Function name</b> – <code>MyFunction</code>.</p> </li> <li> <p> <b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:MyFunction</code>.</p> </li> <li> <p> <b>Version or Alias ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD</code>.</p> </li> <li> <p> <b>Partial ARN</b> – <code>123456789012:function:MyFunction</code>.</p> </li> </ul> <p>The length constraint applies only to the full ARN. If you specify only the function name, it's limited to 64 characters in length.</p>
        enabled: <p>When true, the event source mapping is active. When false, Lambda pauses polling and invocation.</p> <p>Default: True</p>
        batch_size: <p>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).</p> <ul> <li> <p> <b>Amazon Kinesis</b> – Default 100. Max 10,000.</p> </li> <li> <p> <b>Amazon DynamoDB Streams</b> – Default 100. Max 10,000.</p> </li> <li> <p> <b>Amazon Simple Queue Service</b> – Default 10. For standard queues the max is 10,000. For FIFO queues the max is 10.</p> </li> <li> <p> <b>Amazon Managed Streaming for Apache Kafka</b> – Default 100. Max 10,000.</p> </li> <li> <p> <b>Self-managed Apache Kafka</b> – Default 100. Max 10,000.</p> </li> <li> <p> <b>Amazon MQ (ActiveMQ and RabbitMQ)</b> – Default 100. Max 10,000.</p> </li> <li> <p> <b>DocumentDB</b> – Default 100. Max 10,000.</p> </li> </ul>
        filter_criteria: <p>An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html">Lambda event filtering</a>.</p>
        kms_key_arn: <p> The ARN of the Key Management Service (KMS) customer managed key that Lambda uses to encrypt your function's <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html#filtering-basics">filter criteria</a>. By default, Lambda does not encrypt your filter criteria object. Specify this property to encrypt data using your own customer managed key. </p>
        metrics_config: <p>The metrics configuration for your event source. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html#event-source-mapping-metrics">Event source mapping metrics</a>.</p>
        logging_config: <p>(Amazon MSK, and self-managed Apache Kafka only) The logging configuration for your event source. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/esm-logging.html">Event source mapping logging</a>.</p>
        scaling_config: <p>(Amazon SQS only) The scaling configuration for the event source. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-max-concurrency">Configuring maximum concurrency for Amazon SQS event sources</a>.</p>
        maximum_batching_window_in_seconds: <p>The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. You can configure <code>MaximumBatchingWindowInSeconds</code> to any value from 0 seconds to 300 seconds in increments of seconds.</p> <p>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 sources, the default batching window is 500 ms. Note that because you can only change <code>MaximumBatchingWindowInSeconds</code> in increments of seconds, you cannot revert back to the 500 ms default batching window after you have changed it. To restore the default batching window, you must create a new event source mapping.</p> <p>Related setting: For Kinesis, DynamoDB, and Amazon SQS event sources, when you set <code>BatchSize</code> to a value greater than 10, you must set <code>MaximumBatchingWindowInSeconds</code> to at least 1.</p>
        parallelization_factor: <p>(Kinesis and DynamoDB Streams only) The number of batches to process from each shard concurrently.</p>
        starting_position: <p>The position in a stream from which to start reading. Required for Amazon Kinesis and Amazon DynamoDB Stream event sources. <code>AT_TIMESTAMP</code> is supported only for Amazon Kinesis streams, Amazon DocumentDB, Amazon MSK, and self-managed Apache Kafka.</p>
        starting_position_timestamp: <p>With <code>StartingPosition</code> set to <code>AT_TIMESTAMP</code>, the time from which to start reading. <code>StartingPositionTimestamp</code> cannot be in the future.</p>
        destination_config: <p>(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) A configuration object that specifies the destination of an event after Lambda processes it.</p>
        maximum_record_age_in_seconds: <p>(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) Discard records older than the specified age. The default value is infinite (-1).</p>
        bisect_batch_on_function_error: <p>(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) If the function returns an error, split the batch in two and retry.</p>
        maximum_retry_attempts: <p>(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.</p>
        tags: <p>A list of tags to apply to the event source mapping.</p>
        tumbling_window_in_seconds: <p>(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.</p>
        topics: <p>The name of the Kafka topic.</p>
        queues: <p> (MQ) The name of the Amazon MQ broker destination queue to consume. </p>
        source_access_configurations: <p>An array of authentication protocols or VPC components required to secure your event source.</p>
        self_managed_event_source: <p>The self-managed Apache Kafka cluster to receive records from.</p>
        function_response_types: <p>(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.</p>
        amazon_managed_kafka_event_source_config: <p>Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.</p>
        self_managed_kafka_event_source_config: <p>Specific configuration settings for a self-managed Apache Kafka event source.</p>
        document_db_event_source_config: <p>Specific configuration settings for a DocumentDB event source.</p>
        provisioned_poller_config: <p>(Amazon SQS, Amazon MSK, and self-managed Apache Kafka only) The provisioned mode configuration for the event source. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.html#invocation-eventsourcemapping-provisioned-mode">provisioned mode</a>.</p>

    Raises:
        capo_lambda.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One of the parameters in the request is not valid.</p>
        capo_lambda.errors.resource_conflict_exception.ResourceConflictException: <p>The resource already exists, or another operation is in progress.</p>
        capo_lambda.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request does not exist.</p>
        capo_lambda.errors.service_exception.ServiceException: <p>The Lambda service encountered an internal error.</p>
        capo_lambda.errors.too_many_requests_exception.TooManyRequestsException: <p>The request throughput limit was exceeded. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html#api-requests">Lambda quotas</a>.</p>
        capo_lambda.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a mapping between an event source and an AWS Lambda function
        The following example creates a mapping between an SQS queue and the my-function Lambda function.

        >>> client.create_event_source_mapping(batch_size=5, event_source_arn='arn:aws:sqs:us-west-2:123456789012:my-queue', function_name='my-function')
    """

    def _handler(
        req: "OperationRequest[capo_lambda.types.create_event_source_mapping_request.CreateEventSourceMappingRequest]",
    ) -> OperationResponse[
        "capo_lambda.types.event_source_mapping_configuration.EventSourceMappingConfiguration"
    ]:
        import capo_lambda._operations.aws_gir_api_service.create_event_source_mapping

        output, http_response = (
            capo_lambda._operations.aws_gir_api_service.create_event_source_mapping.create_event_source_mapping(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateEventSourceMapping")
    )
    input_: capo_lambda.types.create_event_source_mapping_request.CreateEventSourceMappingRequest = {
        "function_name": function_name
    }
    if event_source_arn is not None:
        input_["event_source_arn"] = event_source_arn
    if enabled is not None:
        input_["enabled"] = enabled
    if batch_size is not None:
        input_["batch_size"] = batch_size
    if filter_criteria is not None:
        input_["filter_criteria"] = filter_criteria
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn
    if metrics_config is not None:
        input_["metrics_config"] = metrics_config
    if logging_config is not None:
        input_["logging_config"] = logging_config
    if scaling_config is not None:
        input_["scaling_config"] = scaling_config
    if maximum_batching_window_in_seconds is not None:
        input_["maximum_batching_window_in_seconds"] = (
            maximum_batching_window_in_seconds
        )
    if parallelization_factor is not None:
        input_["parallelization_factor"] = parallelization_factor
    if starting_position is not None:
        input_["starting_position"] = starting_position
    if starting_position_timestamp is not None:
        input_["starting_position_timestamp"] = starting_position_timestamp
    if destination_config is not None:
        input_["destination_config"] = destination_config
    if maximum_record_age_in_seconds is not None:
        input_["maximum_record_age_in_seconds"] = maximum_record_age_in_seconds
    if bisect_batch_on_function_error is not None:
        input_["bisect_batch_on_function_error"] = bisect_batch_on_function_error
    if maximum_retry_attempts is not None:
        input_["maximum_retry_attempts"] = maximum_retry_attempts
    if tags is not None:
        input_["tags"] = tags
    if tumbling_window_in_seconds is not None:
        input_["tumbling_window_in_seconds"] = tumbling_window_in_seconds
    if topics is not None:
        input_["topics"] = topics
    if queues is not None:
        input_["queues"] = queues
    if source_access_configurations is not None:
        input_["source_access_configurations"] = source_access_configurations
    if self_managed_event_source is not None:
        input_["self_managed_event_source"] = self_managed_event_source
    if function_response_types is not None:
        input_["function_response_types"] = function_response_types
    if amazon_managed_kafka_event_source_config is not None:
        input_["amazon_managed_kafka_event_source_config"] = (
            amazon_managed_kafka_event_source_config
        )
    if self_managed_kafka_event_source_config is not None:
        input_["self_managed_kafka_event_source_config"] = (
            self_managed_kafka_event_source_config
        )
    if document_db_event_source_config is not None:
        input_["document_db_event_source_config"] = document_db_event_source_config
    if provisioned_poller_config is not None:
        input_["provisioned_poller_config"] = provisioned_poller_config

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output