SNS can be used with other AWS services such as SQS, EC2 and S3.
For example, notifications can be used to orchestrate an order processing system running on EC2, where notifications sent over HTTP can trigger real-time processing in related components such as an inventory system or a shipping service. By integrating Amazon SNS with Amazon SQS, all notifications delivered are also persisted in an SQS queue where they are processed by an auditing application at a future time.
SNS Support for AWS Lambda
You can invoke your AWS Lambda functions by publishing messages to SNS topics that have AWS Lambda functions subscribed to them. Because Amazon SNS supports message fan-out, publishing a single message can invoke different AWS Lambda functions or invoke Lambda functions in addition to delivering notifications to supported SNS destinations such as mobile push, HTTP endpoints, SQS, email and SMS.
You need to first create an AWS Lambda function and then subscribe that AWS Lambda function to a topic using the Amazon SNS console or the Amazon SNS APIs. Once that is complete, any messages that you publish to the Amazon SNS topics which have Lambda functions subscribed to them will be delivered to the appropriate Lambda functions in addition to any other destinations subscribed to that topic.
Aside from charges incurred in using AWS services, there are no additional fees for delivering a message to an AWS Lambda function. AWS Lambda function costs are based on the number of requests for your functions and the time your code executes. The AWS Lambda Free-Tier includes 1M requests per month and 400,000 GB-seconds of compute time per month.
AWS currently do not allow an AWS account owner to subscribe an AWS Lambda function that belongs to another account. You can subscribe your own AWS Lambda functions to your own SNS topics or subscribe your AWS Lambda functions to an SNS topic that was created by another account so long as the topic policy for that SNS topic allows it.
Data transfer costs are applicable to message deliveries to AWS Lambda functions. AWS Lambda currently supports 100 concurrent requests per AWS account. If your Amazon SNS message deliveries to AWS Lambda contribute to crossing these concurrency limits, your Amazon SNS message deliveries will be throttled.
To track the success or failure status of message deliveries, you need to activate the Delivery Status feature of Amazon SNS.
SNS CloudTrail Support
SNS supports AWS CloudTrail, which can record AWS API calls for your account and delivers log files. With CloudTrail includes information as the identity of the API caller, the time of the API call, the source IP address of the API caller, the request parameters, and the response elements returned by SNS.
SNS currently supports CloudTrail auditing for authenticated calls only. CloudTrail Audit logs for unauthenticated ConfirmSubscription and Unsubscribe calls are not available at this time.
SNS vs. SQS
SQS and SNS are both messaging services within AWS. SNS allows applications to send time-critical messages to multiple subscribers through a “push” mechanism.
SQS is a message queue service used by distributed applications to exchange messages through a polling model, and can be used to decouple sending and receiving components. SQS provides flexibility for distributed components of applications to send and receive messages without requiring each component to be concurrently available.
SNS – Management Console Support
Using the Management Console, you can easily create topics, add subscribers, send notifications, and edit topic policies – all from your browser. In addition, the Management Console makes it easy to publish messages to your endpoint of choice (HTTP, SQS, Lambda, Mobile Push, or SMS) and edit topic policies to control publisher and subscriber access.