# DynamoEventSourceProps

Extends: DynamoEventSourceProps
Extends: StreamEventSourceProps
Used as props by: DynamoEventSource

- Source: [`aws-lambda-event-sources/lib/dynamodb.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-lambda-event-sources/lib/dynamodb.ts#L8)

## Example

```ts
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

- `batchSize`: number = 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` and `SelfManagedKafkaEventSource`

- `bisectBatchOnError`: boolean = false — If the function returns an error, split the batch in two and retry.

- `enabled`: boolean = true — If the stream event source mapping should be enabled.

- `filterEncryption`: [IKey](/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) = none — Add Customer managed KMS key to encrypt Filter Criteria.

- `filters`: { [key: string]: any }[] = None — Add filter criteria option.

- `maxBatchingWindow`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — The maximum amount of time to gather records before invoking the function.

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

  Maximum of Duration.minutes(5).

- `maxRecordAge`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = -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`: [MetricsConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.MetricsConfig.html) — Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source.

  **Default:** Enhanced monitoring is disabled

- `onFailure`: [IEventSourceDlq](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IEventSourceDlq.html) — An Amazon S3, Amazon SQS queue or Amazon SNS topic destination for discarded records.

  **Default:** discarded records are ignored

- `parallelizationFactor`: number = 1 — The number of batches to process from each shard concurrently.

  Valid Range:
  * Minimum value of 1
  * Maximum value of 10

- `provisionedPollerConfig`: [ProvisionedPollerConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda_event_sources.ProvisionedPollerConfig.html) — Configuration for provisioned pollers that read from the event source.

  **Default:** no provisioned pollers

  When specified, allows control over the minimum and maximum number of pollers
  that can be provisioned to process events from the source.

- `reportBatchItemFailures`: boolean = false — Allow functions to return partially successful responses for a batch of records.

- `retryAttempts`: number — Maximum number of retry attempts.

  **Default:** -1 (infinite retries)

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

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

- `startingPosition`: [StartingPosition](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.StartingPosition.html) (required) — Where to begin consuming the stream.

- `tumblingWindow`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = None — The size of the tumbling windows to group records sent to DynamoDB or Kinesis Valid Range: 0 - 15 minutes.
