SNS fifo topic Support for Serverless

Hi,

I’m trying to create a SNS Fifo Queue via Serverless however I’m running into this error:

Serverless Error

Topic names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 256 characters long.

My understanding is that SNS recently started supporting fifo which requires a .fifo suffix
It appears that this goes against some validation in serverless SNS naming.

Wondering if I’m creating my fifo topic incorrectly or if this isn’t support yet?

Hello @rosenjd4 - as far as I’m concerned it’s currently not supported at schema level in framework - you might want to report that as an issue or feature request :+1:

I am relatively new here but looks like CloudFormation does support fifo topics:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html

So, if that is supported, is it possible to deploy fifo topics by specifying them as resources using CloudFormation syntax? If I am reading this right, that should “just work”:

I am looking to deploy a SNS fifo topic stack so I will try this. Am I misreading the capabilities?

1 Like

Hi Ziggyrama,
did you find out how to configure serverless(.ts/.yml) to create a sns fifo resource?

I ended up abandoning fifo topics for my deployments but that being said, since CloudFormation supports them, you can probably just set the FifoTopic attribute in the topic resource definition and that should work. So, something like this:

resources:
  Resources:
    MyTopic:
      Type: AWS::SNS::Topic
      Properties:
        TopicName: my-topic
        FifoTopic: true
2 Likes

Yes, that works:

Resources:
  MyFifoTopic:
    Type: AWS::SNS::Topic
    Properties:
      TopicName: ${self:provider.environment.MY_FIFO_TOPIC}
      FifoTopic: true

But if you need this topic as a Lambda trigger event, be aware that lambda supported only standard SNS topics and not yet FIFO so, as a lambda event you would probably need SNS Funout to use SQS Fifo subscribed to SNS FIFO topic like this solution: Introducing Amazon SNS FIFO – First-In-First-Out Pub/Sub Messaging | AWS News Blog.