AWS Async Messaging

Omid Eidivandi (XaaXaaX)
1 min readOct 3, 2021

I’ve already had an article about Serverless Challenges kind of performance and etc…

Here i want to talk about an inconvenient behavior of SNS service.

How it works?

Add alt text

Simply the SNS recieves the messages and distributes them to the subscribers which could be the SQS, Http endpoint, LambdaFunction, SES, SMS or mobile push endpoint. it will send messages as soon as they arrive.

Your SNS:

The SNS can be created using this simple template

MySNSTopic:
Type: AWS::SNS::Topic
Properties:
Subscription:
-
Endpoint:
Fn::GetAtt:
- "SQSProduct"
- "Arn"
Protocol: "sqs"
- Endpoint:
Fn::GetAtt:
- "SQSProductPropagation"
- "Arn"
Protocol: "sqs" TopicName: "SampleTopic"

The topic has two subscribers and it will distribute the messages to them. But if you need another subscriber you will change the template as bellow

MySNSTopic:
Type: AWS::SNS::Topic
Properties:
Subscription:
-
Endpoint:
Fn::GetAtt:
- "SQSProduct"
- "Arn"
Protocol: "sqs"
- Endpoint:
Fn::GetAtt:
- "SQSProductPropagation"
- "Arn"
Protocol: "sqs"
- Endpoint:
Fn::GetAtt:
- "SQSProductEnhancement"
- "Arn"
Protocol: "sqs"
TopicName: "SampleTopicEnhancedProduct"

Every thing goes well till you do this update on production, per AWS documentation the Name modification will cause the topic replacement so you will lost all your messages already in production

--

--

Omid Eidivandi (XaaXaaX)

i'm a technial lead , solution/softwatre architect with more than 20 years of experience in IT industry,, i m a fan of cloud and serverless in practice