CfnEventSourceMappingProps Struct
Properties for defining a CfnEventSourceMapping.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lambda as lambda } from 'aws-cdk-lib';
const cfnEventSourceMappingProps: lambda.CfnEventSourceMappingProps = {
functionName: 'functionName',
// the properties below are optional
amazonManagedKafkaEventSourceConfig: {
consumerGroupId: 'consumerGroupId',
schemaRegistryConfig: {
accessConfigs: [{
type: 'type',
uri: 'uri',
}],
eventRecordFormat: 'eventRecordFormat',
schemaRegistryUri: 'schemaRegistryUri',
schemaValidationConfigs: [{
attribute: 'attribute',
}],
},
},
batchSize: 123,
bisectBatchOnFunctionError: false,
destinationConfig: {
onFailure: {
destination: 'destination',
},
},
documentDbEventSourceConfig: {
collectionName: 'collectionName',
databaseName: 'databaseName',
fullDocument: 'fullDocument',
},
enabled: false,
eventSourceArn: 'eventSourceArn',
filterCriteria: {
filters: [{
pattern: 'pattern',
}],
},
functionResponseTypes: ['functionResponseTypes'],
kmsKeyArn: 'kmsKeyArn',
loggingConfig: {
systemLogLevel: 'systemLogLevel',
},
maximumBatchingWindowInSeconds: 123,
maximumRecordAgeInSeconds: 123,
maximumRetryAttempts: 123,
metricsConfig: {
metrics: ['metrics'],
},
parallelizationFactor: 123,
provisionedPollerConfig: {
maximumPollers: 123,
minimumPollers: 123,
pollerGroupName: 'pollerGroupName',
},
queues: ['queues'],
scalingConfig: {
maximumConcurrency: 123,
},
selfManagedEventSource: {
endpoints: {
kafkaBootstrapServers: ['kafkaBootstrapServers'],
},
},
selfManagedKafkaEventSourceConfig: {
consumerGroupId: 'consumerGroupId',
consumptionMode: 'consumptionMode',
schemaRegistryConfig: {
accessConfigs: [{
type: 'type',
uri: 'uri',
}],
eventRecordFormat: 'eventRecordFormat',
schemaRegistryUri: 'schemaRegistryUri',
schemaValidationConfigs: [{
attribute: 'attribute',
}],
},
},
sourceAccessConfigurations: [{
type: 'type',
uri: 'uri',
}],
startingPosition: 'startingPosition',
startingPositionTimestamp: 123,
tags: [{
key: 'key',
value: 'value',
}],
topics: ['topics'],
tumblingWindowInSeconds: 123,
};
Properties
amazonManagedKafkaEventSourceConfigIResolvable | CfnEventSourceMapping.AmazonManagedKafkaEventSourceConfigPropertyamazon_managed_kafka_event_source_configtyping.Union[IResolvable, AmazonManagedKafkaEventSourceConfigProperty]amazonManagedKafkaEventSourceConfigIResolvableAmazonManagedKafkaEventSourceConfigIResolvableAmazonManagedKafkaEventSourceConfiginterface{}#notes
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.
bisectBatchOnFunctionErrorboolean | IResolvablebisect_batch_on_function_errortyping.Union[bool, IResolvable]bisectBatchOnFunctionErrorBooleanBisectBatchOnFunctionErrorboolBisectBatchOnFunctionErrorinterface{}#notes
The default value is false.
When using
BisectBatchOnFunctionError, check theBatchSizeparameter in theOnFailuredestination message's metadata. TheBatchSizecould be greater than 1 since Lambda consolidates failed messages metadata when writing to theOnFailuredestination.
destinationConfigIResolvable | CfnEventSourceMapping.DestinationConfigPropertydestination_configtyping.Union[IResolvable, DestinationConfigProperty]destinationConfigIResolvableDestinationConfigIResolvableDestinationConfiginterface{}#documentDbEventSourceConfigIResolvable | CfnEventSourceMapping.DocumentDBEventSourceConfigPropertydocument_db_event_source_configtyping.Union[IResolvable, DocumentDBEventSourceConfigProperty]documentDbEventSourceConfigIResolvableDocumentDbEventSourceConfigIResolvableDocumentDbEventSourceConfiginterface{}#enabledboolean | IResolvableenabledtyping.Union[bool, IResolvable]enabledBooleanEnabledboolEnabledinterface{}#Default: True
eventSourceArnstring | IStreamRef | IClusterRef | IQueueRefevent_source_arntyping.Union[str, IStreamRef, IClusterRef, IQueueRef]eventSourceArnStringEventSourceArnstringEventSourceArninterface{}#notes
- 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.
filterCriteriaIResolvable | CfnEventSourceMapping.FilterCriteriaPropertyfilter_criteriatyping.Union[IResolvable, FilterCriteriaProperty]filterCriteriaIResolvableFilterCriteriaIResolvableFilterCriteriainterface{}#For more information, see Lambda event filtering .
functionNamestring | IFunctionRef | IVersionReffunction_nametyping.Union[str, IFunctionRef, IVersionRef]functionNameStringFunctionNamestringFunctionNameinterface{}required#notes
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.
functionResponseTypesstring[]function_response_typestyping.List[str]functionResponseTypesList<String>FunctionResponseTypesstring[]FunctionResponseTypes*[]*string#Valid Values: ReportBatchItemFailures
loggingConfigIResolvable | CfnEventSourceMapping.LoggingConfigPropertylogging_configtyping.Union[IResolvable, LoggingConfigProperty]loggingConfigIResolvableLoggingConfigIResolvableLoggingConfiginterface{}#maximumBatchingWindowInSecondsnumbermaximum_batching_window_in_secondsint | floatmaximumBatchingWindowInSecondsNumberMaximumBatchingWindowInSecondsdoubleMaximumBatchingWindowInSeconds*float64#notes
Default ( Kinesis , DynamoDB , Amazon SQS event sources) : 0
Default ( Amazon MSK , Kafka, Amazon MQ , Amazon DocumentDB event sources) : 500 ms
Related setting: For Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.
maximumRecordAgeInSecondsnumbermaximum_record_age_in_secondsint | floatmaximumRecordAgeInSecondsNumberMaximumRecordAgeInSecondsdoubleMaximumRecordAgeInSeconds*float64#notes
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
maximumRetryAttemptsnumbermaximum_retry_attemptsint | floatmaximumRetryAttemptsNumberMaximumRetryAttemptsdoubleMaximumRetryAttempts*float64#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.
metricsConfigIResolvable | CfnEventSourceMapping.MetricsConfigPropertymetrics_configtyping.Union[IResolvable, MetricsConfigProperty]metricsConfigIResolvableMetricsConfigIResolvableMetricsConfiginterface{}#For more information, see Event source mapping metrics .
parallelizationFactornumberparallelization_factorint | floatparallelizationFactorNumberParallelizationFactordoubleParallelizationFactor*float64#The default value is 1.
provisionedPollerConfigIResolvable | CfnEventSourceMapping.ProvisionedPollerConfigPropertyprovisioned_poller_configtyping.Union[IResolvable, ProvisionedPollerConfigProperty]provisionedPollerConfigIResolvableProvisionedPollerConfigIResolvableProvisionedPollerConfiginterface{}#For more information, see provisioned mode .
scalingConfigIResolvable | CfnEventSourceMapping.ScalingConfigPropertyscaling_configtyping.Union[IResolvable, ScalingConfigProperty]scalingConfigIResolvableScalingConfigIResolvableScalingConfiginterface{}#You cannot use ProvisionedPollerConfig while using ScalingConfig . These options are mutually exclusive. To remove the scaling configuration, pass an empty value.
selfManagedEventSourceIResolvable | CfnEventSourceMapping.SelfManagedEventSourcePropertyself_managed_event_sourcetyping.Union[IResolvable, SelfManagedEventSourceProperty]selfManagedEventSourceIResolvableSelfManagedEventSourceIResolvableSelfManagedEventSourceinterface{}#selfManagedKafkaEventSourceConfigIResolvable | CfnEventSourceMapping.SelfManagedKafkaEventSourceConfigPropertyself_managed_kafka_event_source_configtyping.Union[IResolvable, SelfManagedKafkaEventSourceConfigProperty]selfManagedKafkaEventSourceConfigIResolvableSelfManagedKafkaEventSourceConfigIResolvableSelfManagedKafkaEventSourceConfiginterface{}#sourceAccessConfigurationsIResolvable | IResolvable | CfnEventSourceMapping.SourceAccessConfigurationProperty[]source_access_configurationstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, SourceAccessConfigurationProperty]]]sourceAccessConfigurationsIResolvableSourceAccessConfigurationsIResolvableSourceAccessConfigurationsinterface{}#startingPositionstringstarting_positionstrstartingPositionStringStartingPositionstringStartingPosition*string#- LATEST - Read only new records.
- TRIM_HORIZON - Process all available records.
- AT_TIMESTAMP - Specify a time from which to start reading records.
startingPositionTimestampnumberstarting_position_timestampint | floatstartingPositionTimestampNumberStartingPositionTimestampdoubleStartingPositionTimestamp*float64#StartingPositionTimestamp cannot be in the future.
notes
You must have the
lambda:TagResource,lambda:UntagResource, andlambda:ListTagspermissions for your IAM principal to manage the CloudFormation stack. If you don't have these permissions, there might be unexpected behavior with stack-level tags propagating to the resource during resource creation and update.
tumblingWindowInSecondsnumbertumbling_window_in_secondsint | floattumblingWindowInSecondsNumberTumblingWindowInSecondsdoubleTumblingWindowInSeconds*float64#A value of 0 seconds indicates no tumbling window.