Skip to main content

event_source_mappings

Creates, updates, deletes, gets or lists an event_source_mappings resource.

Overview

Nameevent_source_mappings
TypeResource
Idaws.lambda.event_source_mappings

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
amazon_managed_kafka_event_source_configobjectSpecific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.
batch_sizeintegerThe 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_errorboolean(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_configobjectA configuration object that specifies the destination of an event after Lambda processes it. For more information, see Adding a destination.
document_db_event_source_configobjectSpecific configuration settings for a DocumentDB event source.
event_source_arnstringThe Amazon Resource Name (ARN) of the event source. (pattern: <code>arn:(aws[a-zA-Z0-9-]):([a-zA-Z0-9-])+:((eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d{1})?:(\d{12})?:(.)</code>)
event_source_mapping_arnstringThe Amazon Resource Name (ARN) of the event source mapping. (pattern: <code>arn:(aws[a-zA-Z-]*)?:lambda:(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d{1}:\d{12}:event-source-mapping:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}</code>)
filter_criteriaobjectAn object that contains the filters for an event source.
filter_criteria_errorobjectAn object that contains details about an error related to filter criteria encryption.
function_arnstringThe ARN of the Lambda function. (pattern: <code>arn:(aws[a-zA-Z-]*)?:lambda:(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d{1}:\d{12}:function:[a-zA-Z0-9-]+(:($LATEST|[a-zA-Z0-9-]+))?</code>)
function_response_typesarray(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_arnstringThe ARN of the Key Management Service (KMS) customer managed key that Lambda uses to encrypt your function's filter criteria. (pattern: <code>(arn:(aws[a-zA-Z-])?:[a-z0-9-.]+:.)|()</code>)
last_modifiedstring (date-time)The date that the event source mapping was last updated or that its state changed.
last_processing_resultstringThe result of the event source mapping's last processing attempt.
logging_configobject(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_secondsintegerThe 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_secondsinteger(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. 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_attemptsinteger(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_configobjectThe metrics configuration for your event source. Use this configuration object to define which metrics you want your event source mapping to produce.
parallelization_factorinteger(Kinesis and DynamoDB Streams only) The number of batches to process concurrently from each shard. The default value is 1.
provisioned_poller_configobjectThe provisioned mode configuration for the event source. Use Provisioned Mode to customize the minimum and maximum number of event pollers for your event source.
queuesarray(Amazon MQ) The name of the Amazon MQ broker destination queue to consume.
scaling_configobject(Amazon SQS only) The scaling configuration for the event source. To remove the configuration, pass an empty value.
self_managed_event_sourceobjectThe self-managed Apache Kafka cluster for your event source.
self_managed_kafka_event_source_configobjectSpecific configuration settings for a self-managed Apache Kafka event source.
source_access_configurationsarrayAn array of the authentication protocol, VPC components, or virtual host to secure and define your event source.
starting_positionstringThe 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. (TRIM_HORIZON, LATEST, AT_TIMESTAMP)
starting_position_timestampstring (date-time)With StartingPosition set to AT_TIMESTAMP, the time from which to start reading. StartingPositionTimestamp cannot be in the future.
statestringThe state of the event source mapping. It can be one of the following: Creating, Enabling, Enabled, Disabling, Disabled, Updating, or Deleting.
state_transition_reasonstringIndicates whether a user or Lambda made the last change to the event source mapping.
topicsarrayThe name of the Kafka topic.
tumbling_window_in_secondsinteger(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.
uuidstringThe identifier of the event source mapping.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_event_source_mappingselectuuid, regionReturns details about an event source mapping. You can get the identifier of a mapping from the output of ListEventSourceMappings.
list_event_source_mappingsselectregionEventSourceArn, FunctionName, Marker, MaxItemsLists event source mappings. Specify an EventSourceArn to show only event source mappings for a single event source.
create_event_source_mappinginsertregion, FunctionNameCreates a mapping between an event source and an Lambda 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 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. Amazon DynamoDB Streams Amazon Kinesis Amazon SQS Amazon MQ and RabbitMQ Amazon MSK Apache Kafka Amazon DocumentDB
update_event_source_mappingupdateuuid, regionUpdates 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. 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 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. Amazon DynamoDB Streams Amazon Kinesis Amazon SQS Amazon MQ and RabbitMQ Amazon MSK Apache Kafka Amazon DocumentDB
delete_event_source_mappingdeleteuuid, regionDeletes an event source mapping. You can get the identifier of a mapping from the output of ListEventSourceMappings. When you delete an event source mapping, it enters a Deleting state and might not be completely deleted for several seconds.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)
uuidstringThe identifier of the event source mapping.
EventSourceArnstringThe 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.
FunctionNamestringThe 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.
MarkerstringA pagination token returned by a previous call.
MaxItemsintegerThe maximum number of event source mappings to return. Note that ListEventSourceMappings returns a maximum of 100 items in each response, even if you set the number higher.

SELECT examples

Returns details about an event source mapping. You can get the identifier of a mapping from the output of ListEventSourceMappings.

SELECT
amazon_managed_kafka_event_source_config,
batch_size,
bisect_batch_on_function_error,
destination_config,
document_db_event_source_config,
event_source_arn,
event_source_mapping_arn,
filter_criteria,
filter_criteria_error,
function_arn,
function_response_types,
kms_key_arn,
last_modified,
last_processing_result,
logging_config,
maximum_batching_window_in_seconds,
maximum_record_age_in_seconds,
maximum_retry_attempts,
metrics_config,
parallelization_factor,
provisioned_poller_config,
queues,
scaling_config,
self_managed_event_source,
self_managed_kafka_event_source_config,
source_access_configurations,
starting_position,
starting_position_timestamp,
state,
state_transition_reason,
topics,
tumbling_window_in_seconds,
uuid
FROM aws.lambda.event_source_mappings
WHERE uuid = '{{ uuid }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a mapping between an event source and an Lambda 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 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. Amazon DynamoDB Streams Amazon Kinesis Amazon SQS Amazon MQ and RabbitMQ Amazon MSK Apache Kafka Amazon DocumentDB

INSERT INTO aws.lambda.event_source_mappings (
EventSourceArn,
FunctionName,
Enabled,
BatchSize,
FilterCriteria,
KMSKeyArn,
MetricsConfig,
LoggingConfig,
ScalingConfig,
MaximumBatchingWindowInSeconds,
ParallelizationFactor,
StartingPosition,
StartingPositionTimestamp,
DestinationConfig,
MaximumRecordAgeInSeconds,
BisectBatchOnFunctionError,
MaximumRetryAttempts,
Tags,
TumblingWindowInSeconds,
Topics,
Queues,
SourceAccessConfigurations,
SelfManagedEventSource,
FunctionResponseTypes,
AmazonManagedKafkaEventSourceConfig,
SelfManagedKafkaEventSourceConfig,
DocumentDBEventSourceConfig,
ProvisionedPollerConfig,
region
)
SELECT
'{{ EventSourceArn }}',
'{{ FunctionName }}' /* required */,
{{ Enabled }},
{{ BatchSize }},
'{{ FilterCriteria }}',
'{{ KMSKeyArn }}',
'{{ MetricsConfig }}',
'{{ LoggingConfig }}',
'{{ ScalingConfig }}',
{{ MaximumBatchingWindowInSeconds }},
{{ ParallelizationFactor }},
'{{ StartingPosition }}',
'{{ StartingPositionTimestamp }}',
'{{ DestinationConfig }}',
{{ MaximumRecordAgeInSeconds }},
{{ BisectBatchOnFunctionError }},
{{ MaximumRetryAttempts }},
'{{ Tags }}',
{{ TumblingWindowInSeconds }},
'{{ Topics }}',
'{{ Queues }}',
'{{ SourceAccessConfigurations }}',
'{{ SelfManagedEventSource }}',
'{{ FunctionResponseTypes }}',
'{{ AmazonManagedKafkaEventSourceConfig }}',
'{{ SelfManagedKafkaEventSourceConfig }}',
'{{ DocumentDBEventSourceConfig }}',
'{{ ProvisionedPollerConfig }}',
'{{ region }}'
RETURNING
amazon_managed_kafka_event_source_config,
batch_size,
bisect_batch_on_function_error,
destination_config,
document_db_event_source_config,
event_source_arn,
event_source_mapping_arn,
filter_criteria,
filter_criteria_error,
function_arn,
function_response_types,
kms_key_arn,
last_modified,
last_processing_result,
logging_config,
maximum_batching_window_in_seconds,
maximum_record_age_in_seconds,
maximum_retry_attempts,
metrics_config,
parallelization_factor,
provisioned_poller_config,
queues,
scaling_config,
self_managed_event_source,
self_managed_kafka_event_source_config,
source_access_configurations,
starting_position,
starting_position_timestamp,
state,
state_transition_reason,
topics,
tumbling_window_in_seconds,
uuid
;

UPDATE examples

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. 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 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. Amazon DynamoDB Streams Amazon Kinesis Amazon SQS Amazon MQ and RabbitMQ Amazon MSK Apache Kafka Amazon DocumentDB

UPDATE aws.lambda.event_source_mappings
SET
FunctionName = '{{ FunctionName }}',
Enabled = {{ Enabled }},
BatchSize = {{ BatchSize }},
FilterCriteria = '{{ FilterCriteria }}',
KMSKeyArn = '{{ KMSKeyArn }}',
MetricsConfig = '{{ MetricsConfig }}',
LoggingConfig = '{{ LoggingConfig }}',
ScalingConfig = '{{ ScalingConfig }}',
MaximumBatchingWindowInSeconds = {{ MaximumBatchingWindowInSeconds }},
ParallelizationFactor = {{ ParallelizationFactor }},
DestinationConfig = '{{ DestinationConfig }}',
MaximumRecordAgeInSeconds = {{ MaximumRecordAgeInSeconds }},
BisectBatchOnFunctionError = {{ BisectBatchOnFunctionError }},
MaximumRetryAttempts = {{ MaximumRetryAttempts }},
TumblingWindowInSeconds = {{ TumblingWindowInSeconds }},
SourceAccessConfigurations = '{{ SourceAccessConfigurations }}',
FunctionResponseTypes = '{{ FunctionResponseTypes }}',
AmazonManagedKafkaEventSourceConfig = '{{ AmazonManagedKafkaEventSourceConfig }}',
SelfManagedKafkaEventSourceConfig = '{{ SelfManagedKafkaEventSourceConfig }}',
DocumentDBEventSourceConfig = '{{ DocumentDBEventSourceConfig }}',
ProvisionedPollerConfig = '{{ ProvisionedPollerConfig }}'
WHERE
uuid = '{{ uuid }}' --required
AND region = '{{ region }}' --required
RETURNING
amazon_managed_kafka_event_source_config,
batch_size,
bisect_batch_on_function_error,
destination_config,
document_db_event_source_config,
event_source_arn,
event_source_mapping_arn,
filter_criteria,
filter_criteria_error,
function_arn,
function_response_types,
kms_key_arn,
last_modified,
last_processing_result,
logging_config,
maximum_batching_window_in_seconds,
maximum_record_age_in_seconds,
maximum_retry_attempts,
metrics_config,
parallelization_factor,
provisioned_poller_config,
queues,
scaling_config,
self_managed_event_source,
self_managed_kafka_event_source_config,
source_access_configurations,
starting_position,
starting_position_timestamp,
state,
state_transition_reason,
topics,
tumbling_window_in_seconds,
uuid;

DELETE examples

Deletes an event source mapping. You can get the identifier of a mapping from the output of ListEventSourceMappings. When you delete an event source mapping, it enters a Deleting state and might not be completely deleted for several seconds.

DELETE FROM aws.lambda.event_source_mappings
WHERE uuid = '{{ uuid }}' --required
AND region = '{{ region }}' --required
;