Configure maxReceivesPerSecond for SNS topic, how?


I’m using an SNS topis in my application and now I want to configure the maxReceivesPerSecond setting for the topic. How can I do that in the serverles.yml?

I tried this, but without luck:

    handler: handler.batchwrites
      - sns:
          topicName: batchwrites-${opt:stage, self:provider.stage}
          displayName: Batch Write requests - ${opt:stage, self:provider.stage}
          maxReceivesPerSecond: 1

Any suggestions are appreciated.


You may have to define it as a Resource within your serverless.yaml (Serverless Framework - AWS Lambda Guide - AWS Infrastructure Resources). Then you can use the CloudFormation syntax, to attach the attributes you want applied when the SNS topic is created by cloud formation. Your function, will then need to make reference to the SNS topic via full ARN rather than just the name. I cant recall the syntax for this offhand but there is a way to use the “Ref” intrinsic function within your serverless.yml.

1 Like