Hi guys! I have a lambda, that will publish messages to specific SNS topic. Is there a way to create topic during deploy stage? Searched for a way in aws-sdk, and plugins list. No result. Any ideas?
Many thanks in advance.
Hi guys! I have a lambda, that will publish messages to specific SNS topic. Is there a way to create topic during deploy stage? Searched for a way in aws-sdk, and plugins list. No result. Any ideas?
Many thanks in advance.
Yes, here is from serverless.yml
functions:
my-lamdba:
name: 'my-lambda'
description: bla bla bla
handler: functions/my-lambda/handler.handler
events:
- sns:
arn: 'MyTopic' // this will subscribe this lambda to that topic
resources:
Resources:
MyTopic:
Type: AWS::SNS::Topic
Properties:
DisplayName: 'your description'
TopicName: MyFinalTopic
Oh, yes. Many thanks, frang!
Another good option is to send SNS topics to and SQS Queue and then to a Lambda Function.