Skip to content
v2.273.0

StreamEventSourceProps Struct ​

The set of properties for streaming event sources shared by Dynamo and Kinesis.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_kms as kms } from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';
import { aws_lambda_event_sources as lambda_event_sources } from 'aws-cdk-lib';

declare const eventSourceDlq: lambda.IEventSourceDlq;
declare const filters: any;
declare const key: kms.Key;
const streamEventSourceProps: lambda_event_sources.StreamEventSourceProps = {
  startingPosition: lambda.StartingPosition.TRIM_HORIZON,

  // the properties below are optional
  batchSize: 123,
  bisectBatchOnError: false,
  enabled: false,
  filterEncryption: key,
  filters: [{
    filtersKey: filters,
  }],
  maxBatchingWindow: cdk.Duration.minutes(30),
  maxRecordAge: cdk.Duration.minutes(30),
  metricsConfig: {
    metrics: [lambda.MetricType.EVENT_COUNT],
  },
  onFailure: eventSourceDlq,
  parallelizationFactor: 123,
  provisionedPollerConfig: {
    maximumPollers: 123,
    minimumPollers: 123,
    pollerGroupName: 'pollerGroupName',
  },
  reportBatchItemFailures: false,
  retryAttempts: 123,
  tumblingWindow: cdk.Duration.minutes(30),
};

Properties ​

batchSizenumberbatch_sizeint | floatbatchSizeNumberBatchSizedoubleBatchSize*float64= 100#
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.
notes

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 and SelfManagedKafkaEventSource
bisectBatchOnErrorbooleanbisect_batch_on_errorboolbisectBatchOnErrorBooleanBisectBatchOnErrorboolBisectBatchOnError*bool= false#
If the function returns an error, split the batch in two and retry.
enabledbooleanenabledboolenabledBooleanEnabledboolEnabled*bool= true#
If the stream event source mapping should be enabled.
filterEncryptionIKeyfilter_encryptionIKeyfilterEncryptionIKeyFilterEncryptionIKeyFilterEncryptionIKey= none#
Add Customer managed KMS key to encrypt Filter Criteria.
filters{ [key: string]: any }[]filterstyping.List[typing.Mapping[str, Any]]filtersList<Map<String, Object>>FiltersIDictionary<string, object>[]Filters*[]*map[string]interface{}= None#
Add filter criteria option.
maxBatchingWindowDurationmax_batching_windowDurationmaxBatchingWindowDurationMaxBatchingWindowDurationMaxBatchingWindowDuration= Duration.seconds(0) for Kinesis,…#
The maximum amount of time to gather records before invoking the function.

Maximum of Duration.minutes(5).

default

Default: Duration.seconds(0) for Kinesis, DynamoDB, and SQS event sources, Duration.millis(500) for MSK, self-managed Kafka, and Amazon MQ.

maxRecordAgeDurationmax_record_ageDurationmaxRecordAgeDurationMaxRecordAgeDurationMaxRecordAgeDuration= -1#
The maximum age of a record that Lambda sends to a function for processing.
notes

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.

metricsConfigMetricsConfigmetrics_configMetricsConfigmetricsConfigMetricsConfigMetricsConfigMetricsConfigMetricsConfigMetricsConfig= Enhanced monitoring is disabled#
Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source.
onFailureIEventSourceDlqon_failureIEventSourceDlqonFailureIEventSourceDlqOnFailureIEventSourceDlqOnFailureIEventSourceDlq= discarded records are ignored#
An Amazon S3, Amazon SQS queue or Amazon SNS topic destination for discarded records.
parallelizationFactornumberparallelization_factorint | floatparallelizationFactorNumberParallelizationFactordoubleParallelizationFactor*float64= 1#
The number of batches to process from each shard concurrently.

Valid Range:

  • Minimum value of 1
  • Maximum value of 10
provisionedPollerConfigProvisionedPollerConfigprovisioned_poller_configProvisionedPollerConfigprovisionedPollerConfigProvisionedPollerConfigProvisionedPollerConfigProvisionedPollerConfigProvisionedPollerConfigProvisionedPollerConfig= no provisioned pollers#
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.

reportBatchItemFailuresbooleanreport_batch_item_failuresboolreportBatchItemFailuresBooleanReportBatchItemFailuresboolReportBatchItemFailures*bool= false#
Allow functions to return partially successful responses for a batch of records.
retryAttemptsnumberretry_attemptsint | floatretryAttemptsNumberRetryAttemptsdoubleRetryAttempts*float64= -1 (infinite retries)#
Maximum number of retry attempts.

Set to -1 for infinite retries (until the record expires in the event source).

Valid Range: -1 (infinite) or 0 to 10000

startingPositionStartingPositionstarting_positionStartingPositionstartingPositionStartingPositionStartingPositionStartingPositionStartingPositionStartingPositionrequired#
Where to begin consuming the stream.
tumblingWindowDurationtumbling_windowDurationtumblingWindowDurationTumblingWindowDurationTumblingWindowDuration= None#
The size of the tumbling windows to group records sent to DynamoDB or Kinesis Valid Range: 0 - 15 minutes.

Used as props by ​