UpdateEventSourceMapping
Updates an event source mapping. You can change the function that AWS 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.
Request Syntax
PUT /2015-03-31/event-source-mappings/UUID HTTP/1.1
Content-type: application/json
{
"AmazonManagedKafkaEventSourceConfig": {
"ConsumerGroupId": "string",
"SchemaRegistryConfig": {
"AccessConfigs": [
{
"Type": "string",
"URI": "string"
}
],
"EventRecordFormat": "string",
"SchemaRegistryURI": "string",
"SchemaValidationConfigs": [
{
"Attribute": "string"
}
]
}
},
"BatchSize": number,
"BisectBatchOnFunctionError": boolean,
"DestinationConfig": {
"OnFailure": {
"Destination": "string"
},
"OnSuccess": {
"Destination": "string"
}
},
"DocumentDBEventSourceConfig": {
"CollectionName": "string",
"DatabaseName": "string",
"FullDocument": "string"
},
"Enabled": boolean,
"FilterCriteria": {
"Filters": [
{
"Pattern": "string"
}
]
},
"FunctionName": "string",
"FunctionResponseTypes": [ "string" ],
"KMSKeyArn": "string",
"LoggingConfig": {
"SystemLogLevel": "string"
},
"MaximumBatchingWindowInSeconds": number,
"MaximumRecordAgeInSeconds": number,
"MaximumRetryAttempts": number,
"MetricsConfig": {
"Metrics": [ "string" ]
},
"ParallelizationFactor": number,
"ProvisionedPollerConfig": {
"MaximumPollers": number,
"MinimumPollers": number,
"PollerGroupName": "string"
},
"ScalingConfig": {
"MaximumConcurrency": number
},
"SelfManagedKafkaEventSourceConfig": {
"ConsumerGroupId": "string",
"SchemaRegistryConfig": {
"AccessConfigs": [
{
"Type": "string",
"URI": "string"
}
],
"EventRecordFormat": "string",
"SchemaRegistryURI": "string",
"SchemaValidationConfigs": [
{
"Attribute": "string"
}
]
}
},
"SourceAccessConfigurations": [
{
"Type": "string",
"URI": "string"
}
],
"TumblingWindowInSeconds": number
}
URI Request Parameters
The request uses the following URI parameters.
- UUID
-
The identifier of the event source mapping.
Required: Yes
Request Body
The request accepts the following data in JSON format.
- AmazonManagedKafkaEventSourceConfig
-
Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.
Type: AmazonManagedKafkaEventSourceConfig object
Required: No
- BatchSize
-
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.
Type: Integer
Valid Range: Minimum value of 1. Maximum value of 10000.
Required: No
-
- BisectBatchOnFunctionError
-
(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) If the function returns an error, split the batch in two and retry.
Type: Boolean
Required: No
- DestinationConfig
-
(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) A configuration object that specifies the destination of an event after Lambda processes it.
Type: DestinationConfig object
Required: No
- DocumentDBEventSourceConfig
-
Specific configuration settings for a DocumentDB event source.
Type: DocumentDBEventSourceConfig object
Required: No
- Enabled
-
When true, the event source mapping is active. When false, Lambda pauses polling and invocation.
Default: True
Type: Boolean
Required: No
- FilterCriteria
-
An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering.
Type: FilterCriteria object
Required: No
- FunctionName
-
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.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 256.
Pattern:
(arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_\.]+)(:(\$LATEST(\.PUBLISHED)?|[a-zA-Z0-9-_]+))?Required: No
-
- FunctionResponseTypes
-
(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.
Type: Array of strings
Array Members: Minimum number of 0 items. Maximum number of 1 item.
Valid Values:
ReportBatchItemFailuresRequired: No
- KMSKeyArn
-
The ARN of the AWS Key Management Service (AWS 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.
Type: String
Pattern:
(arn:(aws[a-zA-Z-]*)?:[a-z0-9-.]+:.*)|()Required: No
- LoggingConfig
-
(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.
Type: EventSourceMappingLoggingConfig object
Required: No
- MaximumBatchingWindowInSeconds
-
The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. You can configure
MaximumBatchingWindowInSecondsto 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
MaximumBatchingWindowInSecondsin 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
BatchSizeto a value greater than 10, you must setMaximumBatchingWindowInSecondsto at least 1.Type: Integer
Valid Range: Minimum value of 0. Maximum value of 300.
Required: No
- MaximumRecordAgeInSeconds
-
(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka) Discard records older than the specified age. The default value is infinite (-1).
Type: Integer
Valid Range: Minimum value of -1. Maximum value of 604800.
Required: No
- MaximumRetryAttempts
-
(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.
Type: Integer
Valid Range: Minimum value of -1. Maximum value of 10000.
Required: No
- MetricsConfig
-
The metrics configuration for your event source. For more information, see Event source mapping metrics.
Type: EventSourceMappingMetricsConfig object
Required: No
- ParallelizationFactor
-
(Kinesis and DynamoDB Streams only) The number of batches to process from each shard concurrently.
Type: Integer
Valid Range: Minimum value of 1. Maximum value of 10.
Required: No
- ProvisionedPollerConfig
-
(Amazon SQS, Amazon MSK, and self-managed Apache Kafka only) The provisioned mode configuration for the event source. For more information, see provisioned mode.
Type: ProvisionedPollerConfig object
Required: No
- ScalingConfig
-
(Amazon SQS only) The scaling configuration for the event source. For more information, see Configuring maximum concurrency for Amazon SQS event sources.
Type: ScalingConfig object
Required: No
- SelfManagedKafkaEventSourceConfig
-
Specific configuration settings for a self-managed Apache Kafka event source.
Type: SelfManagedKafkaEventSourceConfig object
Required: No
- SourceAccessConfigurations
-
An array of authentication protocols or VPC components required to secure your event source.
Type: Array of SourceAccessConfiguration objects
Array Members: Minimum number of 0 items. Maximum number of 22 items.
Required: No
- TumblingWindowInSeconds
-
(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.
Type: Integer
Valid Range: Minimum value of 0. Maximum value of 900.
Required: No
Response Syntax
HTTP/1.1 202
Content-type: application/json
{
"AmazonManagedKafkaEventSourceConfig": {
"ConsumerGroupId": "string",
"SchemaRegistryConfig": {
"AccessConfigs": [
{
"Type": "string",
"URI": "string"
}
],
"EventRecordFormat": "string",
"SchemaRegistryURI": "string",
"SchemaValidationConfigs": [
{
"Attribute": "string"
}
]
}
},
"BatchSize": number,
"BisectBatchOnFunctionError": boolean,
"DestinationConfig": {
"OnFailure": {
"Destination": "string"
},
"OnSuccess": {
"Destination": "string"
}
},
"DocumentDBEventSourceConfig": {
"CollectionName": "string",
"DatabaseName": "string",
"FullDocument": "string"
},
"EventSourceArn": "string",
"EventSourceMappingArn": "string",
"FilterCriteria": {
"Filters": [
{
"Pattern": "string"
}
]
},
"FilterCriteriaError": {
"ErrorCode": "string",
"Message": "string"
},
"FunctionArn": "string",
"FunctionResponseTypes": [ "string" ],
"KMSKeyArn": "string",
"LastModified": number,
"LastProcessingResult": "string",
"LoggingConfig": {
"SystemLogLevel": "string"
},
"MaximumBatchingWindowInSeconds": number,
"MaximumRecordAgeInSeconds": number,
"MaximumRetryAttempts": number,
"MetricsConfig": {
"Metrics": [ "string" ]
},
"ParallelizationFactor": number,
"ProvisionedPollerConfig": {
"MaximumPollers": number,
"MinimumPollers": number,
"PollerGroupName": "string"
},
"Queues": [ "string" ],
"ScalingConfig": {
"MaximumConcurrency": number
},
"SelfManagedEventSource": {
"Endpoints": {
"string" : [ "string" ]
}
},
"SelfManagedKafkaEventSourceConfig": {
"ConsumerGroupId": "string",
"SchemaRegistryConfig": {
"AccessConfigs": [
{
"Type": "string",
"URI": "string"
}
],
"EventRecordFormat": "string",
"SchemaRegistryURI": "string",
"SchemaValidationConfigs": [
{
"Attribute": "string"
}
]
}
},
"SourceAccessConfigurations": [
{
"Type": "string",
"URI": "string"
}
],
"StartingPosition": "string",
"StartingPositionTimestamp": number,
"State": "string",
"StateTransitionReason": "string",
"Topics": [ "string" ],
"TumblingWindowInSeconds": number,
"