serverless-plugin-sqs-from-sns
v1.0.1
Published
A serverless plugin to trigger a lambda from an automatically created SQS queue subscribed to an SNS topic.
Downloads
2
Readme
serverless-plugin-sqs-from-sns
A serverless plugin to trigger a lambda from an automatically created SQS queue subscribed to an SNS topic.
Serverless enables lambda functions to be triggered from SNS or SQS. It is a common pattern to broadcast messages using SNS and to have them delivered to an SQS queue for lambda processing. This plugin automatically creates an SQS queue for each lambda function, and subscribes the SQS queue to the provided SNS topic. The lambda function is then triggered from the SQS queue.
Setup
Install the plugin
yarn add -D https://github.com/wingsycorp/serverless-plugin-sqs-from-sns.git#master
Add to serverless.yml
plugins:
- serverless-plugin-sqs-from-sns
Example configuration:
function:
my-function:
handler: ......
events:
- sqs-from-sns:
topicArn: arn:aws:sns:region:account-id:topicname
Any further properties will be passed through to the resulting sqs config https://serverless.com/framework/docs/providers/aws/events/sqs/ .
function:
my-function:
handler: ......
events:
- sqs-from-sns:
topicArn: arn:aws:sns:region:account-id:topicname
batchSize: 10