[Infographic] AWS SNS from a serverless perspective

SNS pricing

SNS is a serverless service, which means it comes with pay-as-you-go billing. You pay about 50 cents per 1 million messages. If your messages are bigger than 64 KB, you have to pay for each additional 64 KB chunk as if it was a whole message.


SNS’ parallel delivery is different from SQS, the serverless queuing service of AWS. If you need to buffer events to remove pressure from a downstream service, then SQS is a better solution.

SNS vs. EventBridge

EventBridge has similar use-cases as SNS but operates on a higher level. EventBridge can archive messages and target more services than SNS. SNS’ only targets are email addresses, phone numbers, HTTP endpoints, Lambda functions, and SQS queues. This means if you want to give your data to another AWS service, you need to put some glue logic in-between. At least a Lambda function, and it will cost extra money.

Don’t call Lambda from another Lambda

One rule when building serverless systems is “Don’t call a Lambda directly from another Lambda.” This rule comes from the fact that events from direct calls can get lost when one of the functions crashes, or it could lead to one function waiting until the other function finishes, which means double the costs.

Using SNS from Lambda

There are two ways SNS interacts with AWS Lambda: First, Lambda can send an event to an SNS topic, and second, a Lambda can subscribe to an SNS topic and receive events from it.

Sending Events from Lambda to an SNS Topic

To send a message to an SNS topic from your Lambda function, you need the SNS client from the AWS SDK and the ARN of your SNS topic.

Receiving SNS Events with Lambda

To receive an SNS event with a Lambda, you need to subscribe your Lambda to an SNS topic. This way, the event that invokes the Lambda will be an SNS message.

Piping API Gateway Events to SNS

Using AWS Lambda to glue things together is pretty straightforward but adds complexity and latency and costs extra money. That’s why you should do simple integrations directly between services like API Gateway and SNS.

Dashbird now supports SNS

Now that you learned that AWS SNS is a crucial part of many serverless systems, you should be happy to hear that with its latest update, Dashbird gives you insights into your SNS topics too!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Taavi Rehemägi

Taavi Rehemägi

CEO & Co-Founder at Dashbird.io — serverless visibility and troubleshooting.