I have a Lambda which needs to be triggered by DynamoDB Streams. I am using the serverless framework to deploy it.
The DynamoDB tables already exist, due to a large number of tables, copying and pasting the ARN of streams is not an option.
I found that we can fetch streams ARN using this plugin serverless-dynamo-stream-plugin. But this plugin does not support parameters like
destination{
onFailure: "my queue arn"
}
Is there any way to fetch streams ARN and add other properties on it?
I found the answer to this, you can call AWS Dynamodb List streams with the table name
link to doc: API streams ListStream
List Stream method gives ARNs and then we can configure those ARNs in serverless config.
Since I wanted this to happen every time on serverless deploy
, I wrote a plugin that does that. I am now able to fetch and attach ARN. Other properties are attached using existing serverless parameters.
In case you do not want to implement your own script, here is an npm extension I made for my project
link to plugin: serverless-dynamodb-stream-arn-plugin