class DynamoEventSource
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Lambda.EventSources.DynamoEventSource |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awslambdaeventsources#DynamoEventSource |
Java | software.amazon.awscdk.services.lambda.eventsources.DynamoEventSource |
Python | aws_cdk.aws_lambda_event_sources.DynamoEventSource |
TypeScript (source) | aws-cdk-lib » aws_lambda_event_sources » DynamoEventSource |
Implements
IEvent
Extends
Stream
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,
metricsConfig: {
metrics: [lambda.MetricType.EVENT_COUNT],
}
}));
Initializer
new DynamoEventSource(table: ITable, props: DynamoEventSourceProps)
Parameters
- table
ITable
- props
Dynamo
Event Source Props
Properties
Name | Type | Description |
---|---|---|
event | string | The ARN for this EventSourceMapping. |
event | string | The identifier for this EventSourceMapping. |
eventSourceMappingArn
Type:
string
The ARN for this EventSourceMapping.
eventSourceMappingId
Type:
string
The identifier for this EventSourceMapping.
Methods
Name | Description |
---|---|
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.