Right now my requirement is, whenever I get data through API, I have to save it into 2-3 different places (for example, into my own DB, into some BI service and also sometimes into a logging DB).
I don't know if it's possible to bind a single resource and single method into multiple lambda functions or so. So, my alternate approach was, as I already know how to trigger multiple lambda functions by subscribing to SNS topic, I thought maybe if I can somehow publish to SNS topic from the API Gateway, the rest will be easy. My current thinking is something below:
But the problem is, I am not able to publish to SNS topic from the API Gateway. I am getting errors like TopicArn or TargetArn Reason: no value for required parameter.
My approach is, create a normal SNS topic. Then, create a special role policy like below:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "StmtXXXXXXXXXXX",
"Effect": "Allow",
"Action": [
"sns:Publish",
"sns:Subscribe",
"sns:Unsubscribe"
],
"Resource": [
"SNS-TOPIC-ARN"
]
}
]
}
Then creating a API with POST/GET method (I tried both) and added SNS topic as AWS Service Proxy and the Role as Execution role.
