@totallymoney/serverless-sns-to-sqs-events

1.1.2 • Public • Published

serverless-sns-to-sqs-events

serverless CircleCI License

To install, run

npm i --save-dev @totallymoney/serverless-sns-to-sqs-events

This is a Serverless framework plugin that simplifies the configuration of SNS to SQS to Lambda.

Instead of:

  1. configure the SNS topic
  2. configure the SNS subscription
  3. configure the SQS queue
  4. configure the SQS queue policy
  5. configure the SQS event subscription for Lambda

you can do all 5 as a snsToSqs event:

plugins:
  - "@totallymoney/serverless-sns-to-sqs-events"

functions:
  hello:
    handler: handler.hello
    events:
      - snsToSqs: # subscribe an existing queue to an existing topic
          sns: "arn:aws:sns:#{AWS::Region}:#{AWS::AccountId}:my-topic"
          rawMessageDelivery: true
          sqs: "arn:aws:sqs:#{AWS::Region}:#{AWS::AccountId}:my-queue"
      - snsToSqs: # reference custom resources in serverless.yml
          sns: !Ref MyTopic
          rawMessageDelivery: true
          sqs: !GetAtt MyQueue.Arn
      - snsToSqs: # configure a new queue and subscribe to new topic
          sns:
            topicName: yc-test-${self:provider.region}
            displayName: yc-test-${self:provider.region}  # required
          rawMessageDelivery: false
          batchSize: 10
          sqs:
            delaySeconds: 60
            visibilityTimeout: 120
            queueName: yc-${self:provider.region} # required
            dlq:
              maxReceiveCount: 3
              visibilityTimeout: 120
              queueName: yc-dlq-${self:provider.region} # required

The full schema spec is available here.

Readme

Keywords

none

Package Sidebar

Install

npm i @totallymoney/serverless-sns-to-sqs-events

Weekly Downloads

30

Version

1.1.2

License

MIT

Unpacked Size

29.6 kB

Total Files

15

Last publish

Collaborators

  • tbanham
  • lcolgan
  • nickblair
  • klaatu01
  • iqabsent
  • ac1989
  • totallymoney_svc