Skip to content

DynamoLambdaSubscriber

Reference doc for the `sst.aws.DynamoLambdaSubscriber` component.

The DynamoLambdaSubscriber component is internally used by the Dynamo component to add stream subscriptions to Amazon DynamoDB.

You’ll find this component returned by the subscribe method of the Dynamo component.


Constructor

new DynamoLambdaSubscriber(name, args, opts?)

Parameters

Properties

nodes

Type Object

The underlying resources this component creates.

nodes.eventSourceMapping

Type EventSourceMapping

The Lambda event source mapping.

nodes.function

Type Output<Function>

The Lambda function that’ll be notified.

Args

dynamo

Type Input<Object>

The DynamoDB table to use.

dynamo.streamArn

Type Input<string>

The ARN of the stream.

filters?

Type Input<Input<Record<string, any>>[]>

Filter the records processed by the subscriber function.

You can pass in up to 5 different filter policies. These will logically ORed together. Meaning that if any single policy matches, the record will be processed.

For example, if your DynamoDB table’s stream contains the follow record.

{
eventID: "1",
eventVersion: "1.0",
dynamodb: {
ApproximateCreationDateTime: "1678831218.0",
Keys: {
CustomerName: {
"S": "AnyCompany Industries"
},
NewImage: {
AccountManager: {
S: "Pat Candella"
},
PaymentTerms: {
S: "60 days"
},
CustomerName: {
S: "AnyCompany Industries"
}
},
SequenceNumber: "111",
SizeBytes: 26,
StreamViewType: "NEW_IMAGE"
}
}
}

To process only those records where the CustomerName is AnyCompany Industries.

{
filters: [
{
dynamodb: {
Keys: {
CustomerName: {
S: ["AnyCompany Industries"]
}
}
}
}
]
}

subscriber

Type Input<string | FunctionArgs>

The subscriber function.

transform?

Type Object

Transform how this subscription creates its underlying resources.

transform.eventSourceMapping?

Type EventSourceMappingArgs | (args: EventSourceMappingArgs => void)

Transform the Lambda Event Source Mapping resource.