Configure maxReceivesPerSecond for SNS topic, how?

aws

#1

Hi,

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:

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

Any suggestions are appreciated.

Thanks,
Gero


#2

You may have to define it as a Resource within your serverless.yaml (https://serverless.com/framework/docs/providers/aws/guide/resources/). Then you can use the CloudFormation syntax, http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html 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.