interface DynamoEventSourceProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Lambda.EventSources.DynamoEventSourceProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awslambdaeventsources#DynamoEventSourceProps |
![]() | software.amazon.awscdk.services.lambda.eventsources.DynamoEventSourceProps |
![]() | aws_cdk.aws_lambda_event_sources.DynamoEventSourceProps |
![]() | aws-cdk-lib » aws_lambda_event_sources » DynamoEventSourceProps |
Example
import * as eventsources from 'aws-cdk-lib/aws-lambda-event-sources';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
declare const fn: lambda.Function;
const table = new dynamodb.Table(this, 'Table', {
partitionKey: {
name: 'id',
type: dynamodb.AttributeType.STRING,
},
stream: dynamodb.StreamViewType.NEW_IMAGE,
});
fn.addEventSource(new eventsources.DynamoEventSource(table, {
startingPosition: lambda.StartingPosition.LATEST,
metricsConfig: {
metrics: [lambda.MetricType.EVENT_COUNT],
}
}));
Properties
Name | Type | Description |
---|---|---|
starting | Starting | Where to begin consuming the stream. |
batch | number | The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. |
bisect | boolean | If the function returns an error, split the batch in two and retry. |
enabled? | boolean | If the stream event source mapping should be enabled. |
filter | IKey | Add Customer managed KMS key to encrypt Filter Criteria. |
filters? | { [string]: any }[] | Add filter criteria option. |
max | Duration | The maximum amount of time to gather records before invoking the function. |
max | Duration | The maximum age of a record that Lambda sends to a function for processing. |
metrics | Metrics | Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source. |
on | IEvent | An Amazon S3, Amazon SQS queue or Amazon SNS topic destination for discarded records. |
parallelization | number | The number of batches to process from each shard concurrently. |
provisioned | Provisioned | Configuration for provisioned pollers that read from the event source. |
report | boolean | Allow functions to return partially successful responses for a batch of records. |
retry | number | Maximum number of retry attempts. |
tumbling | Duration | The size of the tumbling windows to group records sent to DynamoDB or Kinesis Valid Range: 0 - 15 minutes. |
startingPosition
Type:
Starting
Where to begin consuming the stream.
batchSize?
Type:
number
(optional, default: 100)
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
- 1000 for
bisectBatchOnError?
Type:
boolean
(optional, default: false)
If the function returns an error, split the batch in two and retry.
enabled?
Type:
boolean
(optional, default: true)
If the stream event source mapping should be enabled.
filterEncryption?
Type:
IKey
(optional, default: none)
Add Customer managed KMS key to encrypt Filter Criteria.
See also: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk
filters?
Type:
{ [string]: any }[]
(optional, default: None)
Add filter criteria option.
maxBatchingWindow?
Type:
Duration
(optional, default: Duration.seconds(0) for Kinesis, DynamoDB, and SQS event sources, Duration.millis(500) for MSK, self-managed Kafka, and Amazon MQ.)
The maximum amount of time to gather records before invoking the function.
Maximum of Duration.minutes(5).
maxRecordAge?
Type:
Duration
(optional, default: -1)
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.
metricsConfig?
Type:
Metrics
(optional, default: Enhanced monitoring is disabled)
Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source.
onFailure?
Type:
IEvent
(optional, default: discarded records are ignored)
An Amazon S3, Amazon SQS queue or Amazon SNS topic destination for discarded records.
parallelizationFactor?
Type:
number
(optional, default: 1)
The number of batches to process from each shard concurrently.
Valid Range:
- Minimum value of 1
- Maximum value of 10
provisionedPollerConfig?
Type:
Provisioned
(optional, default: 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.
reportBatchItemFailures?
Type:
boolean
(optional, default: false)
Allow functions to return partially successful responses for a batch of records.
See also: https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-ddb-batchfailurereporting
retryAttempts?
Type:
number
(optional, default: -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
tumblingWindow?
Type:
Duration
(optional, default: None)
The size of the tumbling windows to group records sent to DynamoDB or Kinesis Valid Range: 0 - 15 minutes.