Export the DynamoDB table Stream Arn as an stack's output
See original GitHub issueIs your feature request related to a problem? Please describe.
Currently, there is no easy way to add a stream event, for example, to trigger a Lambda function, because the Stream Arn is not available in any stack. I’ve created a function using amplify function add
, now, I want to edit the template to add an AWS::Lambda::EventSourceMapping
but it is not possible except if I hardcoded the Stream Arn in the template, but, It will fail if I create a new environment.
Describe the solution you’d like
It will be awesome to have the DynamoDB table Stream Arn as an output, and exported using the process described in aws-amplify/amplify-category-api#440 and we will be able to add an AWS::Lambda::EventSourceMapping
config to a function’s template. Something like
"EventSourceMapping": {
"Type": "AWS::Lambda::EventSourceMapping",
"Properties": {
"EventSourceArn": {
"Fn::ImportValue": {
"Fn::Join": [":",
[
{ "Fn::Sub": "${ParentStackName}" },
"GetAtt",
"MyDynamoDBTable",
"StreamArn"
]
]
}
},
"FunctionName": {
"Fn::GetAtt": ["LambdaFunction", "Arn"]
},
"StartingPosition": "TRIM_HORIZON"
}
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:11 (4 by maintainers)
Top GitHub Comments
Hi. Thanks for feedback above. If it helps anyone, I summarized the recommendations above in this project:
https://github.com/matwerber1/aws-amplify-subscribe-lambda-to-dynamodb-api-table-stream/
Hi, @psporysz, I think it is not a workaround, it is the way to do it. Note you can write it like
It is easy to read