StreamEventSourceProps
- class aws_cdk.aws_lambda_event_sources.StreamEventSourceProps(*, starting_position, batch_size=None, enabled=None, max_batching_window=None, provisioned_poller_config=None, bisect_batch_on_error=None, filter_encryption=None, filters=None, max_record_age=None, metrics_config=None, on_failure=None, parallelization_factor=None, report_batch_item_failures=None, retry_attempts=None, tumbling_window=None)
Bases:
BaseStreamEventSourceProps
The set of properties for streaming event sources shared by Dynamo and Kinesis.
- Parameters:
starting_position (
StartingPosition
) – Where to begin consuming the stream.batch_size (
Union
[int
,float
,None
]) – The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. Your function receives an event with all the retrieved records. Valid Range: - Minimum value of 1 - Maximum value of: - 1000 forDynamoEventSource
- 10000 forKinesisEventSource
,ManagedKafkaEventSource
andSelfManagedKafkaEventSource
Default: 100enabled (
Optional
[bool
]) – If the stream event source mapping should be enabled. Default: truemax_batching_window (
Optional
[Duration
]) – The maximum amount of time to gather records before invoking the function. Maximum of Duration.minutes(5). Default: - Duration.seconds(0) for Kinesis, DynamoDB, and SQS event sources, Duration.millis(500) for MSK, self-managed Kafka, and Amazon MQ.provisioned_poller_config (
Union
[ProvisionedPollerConfig
,Dict
[str
,Any
],None
]) – Configuration for provisioned pollers that read from the event source. When specified, allows control over the minimum and maximum number of pollers that can be provisioned to process events from the source. Default: - no provisioned pollersbisect_batch_on_error (
Optional
[bool
]) – If the function returns an error, split the batch in two and retry. Default: falsefilter_encryption (
Optional
[IKey
]) – Add Customer managed KMS key to encrypt Filter Criteria. Default: - nonefilters (
Optional
[Sequence
[Mapping
[str
,Any
]]]) – Add filter criteria option. Default: - Nonemax_record_age (
Optional
[Duration
]) – The maximum age of a record that Lambda sends to a function for processing. Valid Range: - Minimum value of 60 seconds - Maximum value of 7 days The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records. Record are valid until it expires in the event source. Default: -1metrics_config (
Union
[MetricsConfig
,Dict
[str
,Any
],None
]) – Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source. Default: - Enhanced monitoring is disabledon_failure (
Optional
[IEventSourceDlq
]) – An Amazon SQS queue or Amazon SNS topic destination for discarded records. Default: - discarded records are ignoredparallelization_factor (
Union
[int
,float
,None
]) – The number of batches to process from each shard concurrently. Valid Range: - Minimum value of 1 - Maximum value of 10 Default: 1report_batch_item_failures (
Optional
[bool
]) – Allow functions to return partially successful responses for a batch of records. Default: falseretry_attempts (
Union
[int
,float
,None
]) – Maximum number of retry attempts Valid Range: * Minimum value of 0 * Maximum value of 10000. 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. Default: -1tumbling_window (
Optional
[Duration
]) – The size of the tumbling windows to group records sent to DynamoDB or Kinesis Valid Range: 0 - 15 minutes. Default: - None
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk as cdk from aws_cdk import aws_kms as kms from aws_cdk import aws_lambda as lambda_ from aws_cdk import aws_lambda_event_sources as lambda_event_sources # event_source_dlq: lambda.IEventSourceDlq # filters: Any # key: kms.Key stream_event_source_props = lambda_event_sources.StreamEventSourceProps( starting_position=lambda_.StartingPosition.TRIM_HORIZON, # the properties below are optional batch_size=123, bisect_batch_on_error=False, enabled=False, filter_encryption=key, filters=[{ "filters_key": filters }], max_batching_window=cdk.Duration.minutes(30), max_record_age=cdk.Duration.minutes(30), metrics_config=lambda.MetricsConfig( metrics=[lambda_.MetricType.EVENT_COUNT] ), on_failure=event_source_dlq, parallelization_factor=123, provisioned_poller_config=lambda_event_sources.ProvisionedPollerConfig( maximum_pollers=123, minimum_pollers=123 ), report_batch_item_failures=False, retry_attempts=123, tumbling_window=cdk.Duration.minutes(30) )
Attributes
- batch_size
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.
Your function receives an event with all the retrieved records.
Valid Range:
Minimum value of 1
Maximum value of:
1000 for
DynamoEventSource
10000 for
KinesisEventSource
,ManagedKafkaEventSource
andSelfManagedKafkaEventSource
- Default:
100
- bisect_batch_on_error
If the function returns an error, split the batch in two and retry.
- Default:
false
- enabled
If the stream event source mapping should be enabled.
- Default:
true
- filter_encryption
Add Customer managed KMS key to encrypt Filter Criteria.
- filters
Add filter criteria option.
- Default:
None
- max_batching_window
The maximum amount of time to gather records before invoking the function.
Maximum of Duration.minutes(5).
- Default:
Duration.seconds(0) for Kinesis, DynamoDB, and SQS event sources, Duration.millis(500) for MSK, self-managed Kafka, and Amazon MQ.
- See:
- max_record_age
The maximum age of a record that Lambda sends to a function for processing.
Valid Range:
Minimum value of 60 seconds
Maximum value of 7 days
The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records. Record are valid until it expires in the event source.
- Default:
-1
- metrics_config
Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source.
- Default:
Enhanced monitoring is disabled
- on_failure
An Amazon SQS queue or Amazon SNS topic destination for discarded records.
- Default:
discarded records are ignored
- parallelization_factor
The number of batches to process from each shard concurrently.
Valid Range:
Minimum value of 1
Maximum value of 10
- Default:
1
- provisioned_poller_config
Configuration for provisioned pollers that read from the event source.
When specified, allows control over the minimum and maximum number of pollers that can be provisioned to process events from the source.
- Default:
no provisioned pollers
- report_batch_item_failures
Allow functions to return partially successful responses for a batch of records.
- retry_attempts
Minimum value of 0 * Maximum value of 10000.
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.
- Default:
-1
- Type:
Maximum number of retry attempts Valid Range
- starting_position
Where to begin consuming the stream.
- tumbling_window
0 - 15 minutes.
- Default:
None
- Type:
The size of the tumbling windows to group records sent to DynamoDB or Kinesis Valid Range