Skip to content

Lambda  >  Operations  >  update_event_source_mapping

update_event_source_mapping

Operation

update_event_source_mapping async

update_event_source_mapping(input: UpdateEventSourceMappingInput, plugins: list[Plugin] | None = None) -> UpdateEventSourceMappingOutput

Updates an event source mapping. You can change the function that Lambda invokes, or pause invocation and resume later from the same location.

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:

Name Type Description Default
input UpdateEventSourceMappingInput

An instance of UpdateEventSourceMappingInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
UpdateEventSourceMappingOutput

An instance of UpdateEventSourceMappingOutput.

Input

UpdateEventSourceMappingInput dataclass

Dataclass for UpdateEventSourceMappingInput structure.

Attributes

amazon_managed_kafka_event_source_config class-attribute instance-attribute
amazon_managed_kafka_event_source_config: AmazonManagedKafkaEventSourceConfig | None = None

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

batch_size class-attribute instance-attribute
batch_size: int | None = 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 class-attribute instance-attribute
bisect_batch_on_function_error: bool | None = None

(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) If the function returns an error, split the batch in two and retry.

destination_config class-attribute instance-attribute
destination_config: DestinationConfig | None = 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.

document_db_event_source_config class-attribute instance-attribute
document_db_event_source_config: DocumentDBEventSourceConfig | None = None

Specific configuration settings for a DocumentDB event source.

enabled class-attribute instance-attribute
enabled: bool | None = None

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

Default: True

filter_criteria class-attribute instance-attribute
filter_criteria: FilterCriteria | None = None

An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering.

function_name class-attribute instance-attribute
function_name: str | None = None

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 class-attribute instance-attribute
function_response_types: list[FunctionResponseType] | None = 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.

kms_key_arn class-attribute instance-attribute
kms_key_arn: str | None = 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.

logging_config class-attribute instance-attribute
logging_config: EventSourceMappingLoggingConfig | None = None

(Amazon MSK, and self-managed Apache Kafka only) The logging configuration for your event source. Use this configuration object to define the level of logs for your event source mapping.

maximum_batching_window_in_seconds class-attribute instance-attribute
maximum_batching_window_in_seconds: int | None = 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.

maximum_record_age_in_seconds class-attribute instance-attribute
maximum_record_age_in_seconds: int | None = None

(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) Discard records older than the specified age. The default value is infinite (-1).

maximum_retry_attempts class-attribute instance-attribute
maximum_retry_attempts: int | None = 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.

metrics_config class-attribute instance-attribute
metrics_config: EventSourceMappingMetricsConfig | None = None

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

parallelization_factor class-attribute instance-attribute
parallelization_factor: int | None = None

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

provisioned_poller_config class-attribute instance-attribute
provisioned_poller_config: ProvisionedPollerConfig | None = 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.

scaling_config class-attribute instance-attribute
scaling_config: ScalingConfig | None = 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_kafka_event_source_config class-attribute instance-attribute
self_managed_kafka_event_source_config: SelfManagedKafkaEventSourceConfig | None = None

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

source_access_configurations class-attribute instance-attribute
source_access_configurations: list[SourceAccessConfiguration] | None = None

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

tumbling_window_in_seconds class-attribute instance-attribute
tumbling_window_in_seconds: int | None = 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.

uuid class-attribute instance-attribute
uuid: str | None = None

The identifier of the event source mapping.

Output

UpdateEventSourceMappingOutput dataclass

A mapping between an Amazon Web Services resource and a Lambda function. For details, see CreateEventSourceMapping.

Attributes

amazon_managed_kafka_event_source_config class-attribute instance-attribute
amazon_managed_kafka_event_source_config: AmazonManagedKafkaEventSourceConfig | None = None

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

batch_size class-attribute instance-attribute
batch_size: int | None = 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).

Default value: Varies by service. For Amazon SQS, the default is 10. For all other services, the default is 100.

Related setting: When you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

bisect_batch_on_function_error class-attribute instance-attribute
bisect_batch_on_function_error: bool | None = None

(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) If the function returns an error, split the batch in two and retry. The default value is false.

destination_config class-attribute instance-attribute
destination_config: DestinationConfig | None = 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.

document_db_event_source_config class-attribute instance-attribute
document_db_event_source_config: DocumentDBEventSourceConfig | None = None

Specific configuration settings for a DocumentDB event source.

event_source_arn class-attribute instance-attribute
event_source_arn: str | None = None

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

event_source_mapping_arn class-attribute instance-attribute
event_source_mapping_arn: str | None = None

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

filter_criteria class-attribute instance-attribute
filter_criteria: FilterCriteria | None = None

An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering.

If filter criteria is encrypted, this field shows up as null in the response of ListEventSourceMapping API calls. You can view this field in plaintext in the response of GetEventSourceMapping and DeleteEventSourceMapping calls if you have kms:Decrypt permissions for the correct KMS key.

filter_criteria_error class-attribute instance-attribute
filter_criteria_error: FilterCriteriaError | None = None

An object that contains details about an error related to filter criteria encryption.

function_arn class-attribute instance-attribute
function_arn: str | None = None

The ARN of the Lambda function.

function_response_types class-attribute instance-attribute
function_response_types: list[FunctionResponseType] | None = 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.

kms_key_arn class-attribute instance-attribute
kms_key_arn: str | None = None

The ARN of the Key Management Service (KMS) customer managed key that Lambda uses to encrypt your function's filter criteria.

last_modified class-attribute instance-attribute
last_modified: datetime | None = None

The date that the event source mapping was last updated or that its state changed.

last_processing_result class-attribute instance-attribute
last_processing_result: str | None = None

The result of the event source mapping's last processing attempt.

logging_config class-attribute instance-attribute
logging_config: EventSourceMappingLoggingConfig | None = None

(Amazon MSK, and self-managed Apache Kafka only) The logging configuration for your event source. For more information, see Event source mapping logging.

maximum_batching_window_in_seconds class-attribute instance-attribute
maximum_batching_window_in_seconds: int | None = 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 streams 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 streams and Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

maximum_record_age_in_seconds class-attribute instance-attribute
maximum_record_age_in_seconds: int | None = None

(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) 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.

Note

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 class-attribute instance-attribute
maximum_retry_attempts: int | None = None

(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) 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 class-attribute instance-attribute
metrics_config: EventSourceMappingMetricsConfig | None = None

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

parallelization_factor class-attribute instance-attribute
parallelization_factor: int | None = None

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

provisioned_poller_config class-attribute instance-attribute
provisioned_poller_config: ProvisionedPollerConfig | None = 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.

queues class-attribute instance-attribute
queues: list[str] | None = None

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

scaling_config class-attribute instance-attribute
scaling_config: ScalingConfig | None = 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 class-attribute instance-attribute
self_managed_event_source: SelfManagedEventSource | None = None

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

self_managed_kafka_event_source_config class-attribute instance-attribute
self_managed_kafka_event_source_config: SelfManagedKafkaEventSourceConfig | None = None

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

source_access_configurations class-attribute instance-attribute
source_access_configurations: list[SourceAccessConfiguration] | None = None

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

starting_position class-attribute instance-attribute
starting_position: EventSourcePosition | None = 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 class-attribute instance-attribute
starting_position_timestamp: datetime | None = None

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

state class-attribute instance-attribute
state: str | None = None

The state of the event source mapping. It can be one of the following: Creating, Enabling, Enabled, Disabling, Disabled, Updating, or Deleting.

state_transition_reason class-attribute instance-attribute
state_transition_reason: str | None = None

Indicates whether a user or Lambda made the last change to the event source mapping.

topics class-attribute instance-attribute
topics: list[str] | None = None

The name of the Kafka topic.

tumbling_window_in_seconds class-attribute instance-attribute
tumbling_window_in_seconds: int | None = 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.

uuid class-attribute instance-attribute
uuid: str | None = None

The identifier of the event source mapping.