AWS Certified Solutions Architect - Note (8)
Simple Queue Service (SQS)
SQS - Use Case
SQS Limits - Message Size
SQS Limits - Message Retention
SQS - Standard Queues
SQS - FIFO Queues
SQS - Visibility Timeout
SQS - Short vs Long Polling
- SQS is a queuing service using messages with a queue. Think Sidekiq or RabbitMQ.
- SQS is used for Application Integration, it lets decoupled services and apps to talk to each other.
- To read SQS use need to pull the queue using the AWS SDK. SQS is not pushed-based.
- SQS supports both Standard and First-ln-First-Out (FIFO) queues.
- Standard allows nearly unlimited messages per second, does not guarantee order of delivery, always delivers at least once, you must protect again duplicate messages being processed.
- FIFO maintain the order of messages with a 300 limit.
- There are two kinds of polling Short (Default) and Long Polling.
- Short polling returns messages immediately, even if the message queue being polled is empty.
- Long polling waits until message arrives in the queue, or the long poll timeout expires.
- In majority of cases Long polling is preferred over short polling.
- Visibility time-out is the period of time that messages are invisible in the SQS queue.
- Messages will be deleted from queue after a job has processed. (before visibility timeout expires)
- If Visibility timeout expires than a job will become visible to the queue.
- The default Visibility time-out is 30 seconds. Timeout can be 0 seconds to a maximum of 12 hours.
- SQS can retain messages from 60 seconds to 14 days and by default is 4 days.
- Message size between 1 byte to 256 kb, Extended Client Library for Java can increase to 2GB.
Simple Notification Service (SNS)
SNS - Topics
SNS - Subscriptions
Application As Subscriber
- Simple Notification Service (SNS) is a fully managed pub/sub messaging service.
- SNS is for Application Integration. It allows decoupled services and apps to communicate with each other.
- Topic a logical access point and communication channel.
- A topic is able to deliver to multiple protocols.
- You can encrypt topics via KMS.
- Publishers use the AWS API via AWS CLI or SDK to push messages to a topic. Many AWS services integrate with SNS and act as publishers.
- Subscriptions subscribe to topics. When a topic receives a message it automatically and immediately pushes messages to subscribers.
- All messages published to SNS are stored redundantly across multiple Availability Zones (AZ)
- The following protocols:
- HTTP and HTTPs create webhooks into your web-application.
- Email good for internal email notifications (only supports plain text)
- Email-JSON sends you json via email.
- Amazon SQS place SNS message into SQS queue.
- AWS Lambda triggers a lambda function.
- SMS send a text message.
- Platform application endpoints Mobile Push eg. Apple, Google, Microsoft Baidu notification systems.
ElastiCache - Caching Comparison
- ElastiCache is a managed in-memory caching service.
- ElastiCache can launch either Memcached or Redis.
- Memcached is a simple key / value store preferred for caching HTML fragments and is arguably faster than Redis.
- Redis has richer data types and operations. Great for leaderboard, geospatial data or keeping track of unread notifications.
- A cache is a temporary storage area.
- Most frequently identical queries are stored in the cache.
- Resources only within the same VPC may connect to ElastiCache to ensure low latencies.
Scale Up vs Scale Out
Elastic Beanstalk CheatSheet
comments powered by
- Elastic Beanstalk handles the deployment, from capacity provisioning, load balancing, auto-scaling to application health monitoring.
- When you want to run a web-application but you don’t want to have think about the underlying infrastructure.
- It costs nothing to use Elastic Beanstalk (only the resources it provisions eg. RDS, ELB, EC2)
- Recommended for test or development apps. Not recommended for production use.
- You can choose from the following preconfigured platforms: Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker.
- You can run dockerized environments on Elastic Beanstalk.