aws-cdk-lib.aws_lambda_event_sources.DynamoEventSource

class DynamoEventSource

LanguageType name
.NETAmazon.CDK.AWS.Lambda.EventSources.DynamoEventSource
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awslambdaeventsources#DynamoEventSource
Javasoftware.amazon.awscdk.services.lambda.eventsources.DynamoEventSource
Pythonaws_cdk.aws_lambda_event_sources.DynamoEventSource
TypeScript (source)aws-cdk-lib » aws_lambda_event_sources » DynamoEventSource

Implements IEventSource

Extends StreamEventSource

Use an Amazon DynamoDB stream as an event source for AWS Lambda.

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,
  filters: [lambda.FilterCriteria.filter({ eventName: lambda.FilterRule.isEqual('INSERT') })],
}));

Initializer

new DynamoEventSource(table: ITable, props: DynamoEventSourceProps)

Parameters

  • table ITable
  • props DynamoEventSourceProps

Properties

NameTypeDescription
eventSourceMappingArnstringThe ARN for this EventSourceMapping.
eventSourceMappingIdstringThe identifier for this EventSourceMapping.

eventSourceMappingArn

Type: string

The ARN for this EventSourceMapping.


eventSourceMappingId

Type: string

The identifier for this EventSourceMapping.

Methods

NameDescription
bind(target)Called by lambda.addEventSource to allow the event source to bind to this function.

bind(target)

public bind(target: IFunction): void

Parameters

  • target IFunction

Called by lambda.addEventSource to allow the event source to bind to this function.