AWS SNS

 AWS SNS




AWS SNS - 
  • Used to broadcast messages
  • Pub-sub model (publisher publishes messages to a topic, subscribers listen to the topic)
  • Instant message delivery (does not queue messages)


Encryption - 
  • In-flight encyption by default using HTTPS API
  • At-rest encyption using KMS keys
  • Client-side encryption


Access Management - 
  • IAM policies to regulate access to the SNS API
  • SNS Access Policies (resource based policies)
  • Used for cross-account access to SNS topic
  • Used for allowing other AWS services to publish to an SNS topic 

Standard Topics
  • Highest throughput 
  • At least once message delivery 
  • Best effort ordering 
  • Subscibers can be -
  • SQS queues
  • HTTP/HTTPS endpoints
  • Lamda function
  • Emails (using SNS)
  • SMS and mobile notification
  • Kinesis Data Firehouse to send the data into S3 or Redshift

Fifo Topics - 
  • Guaranteed  ordering of messages in that topic 
  • Publishing messages to a fifo topic reqiures - 
  • Group ID - messages will be ordered and grouped for each group ID
  • Message De-duplication ID - for de-deuplication of messages 
  • Can only have SQS FIFO queues as subscribers
  • Limited throughput (same as SQS FIFO) because only SQS FIFO queues can read from FIFO topics 
  • The topic name must end with .fifo

SNS + SQS Fanout Pattern - 
  • Fully decoupled, no data loss
  • SQS allows for - data persistence, delayed processing and retries of work
  • Make sure your SQS queues access policy allows for SNS to write






Message Filtering - 
  • JSON policy used to filter messages sent to SNS topics subscriptions
  • Each subscriber will have its own filter policy (if a subscriber doesn't have a filter policy, it recieves every message )
  • Ex. filter messages sent to each queue by the order status 

SNS + Lamda + DLQ - 
  • Lamda retries each failed message 3 times after which it is sent to the DLQ by Lamda 






Comments

Popular posts from this blog

AWS Instance Store

AWS Identity and Access Management

Elastic Block Storage (EBS)