SQS, SNS, Kinesis Flashcards
- Oldest offering (over 10 years old)
- Fully managed service, used to decouple applications
- Attributes:
- Unlimited throughput, unlimited number of messages in queue
- Default retention of messages: 4 days, maximum of 14 days
- Low latency (<10 ms on publish and receive)
- Limitation of 256KB per message sent
- Can have duplicate messages (at least once delivery, occasionally)
- Can have out of order messages (best effort ordering)
Amazon SQS – Standard Queue
Produced to SQS using the ______?
SDK (SendMessage API)
The message is ___________ in SQS until a consumer deletes it
persisted
SQS – Producing Messages - Message retention
default 4 days, up to 14 days
What is the SQS standard
unlimited throughput
SQS Consumers run on ____?
EC2 instances
On-premise servers
AWS Lambda
How many messages can a SQS Consumer receive at a time?
10
SQS Consumer - Delete the messages using the __________ API
DeleteMessage
- Consumers receive and process messages in parallel
- At least once delivery
- Best-effort message ordering
- Consumers delete messages after processing them
- We can scale consumers horizontally to improve throughput of processing
SQS – Multiple EC2 Instances Consumers
Amazon SQS - Encryption
- In-flight encryption using HTTPS API
- At-rest encryption using KMS keys
- Client-side encryption if the client wants to perform encryption/decryption i
Amazon SQS - Access Controls
IAM policies to regulate access to the SQS API
2 uses for SQS Access Policies?
- Useful for cross-account access to SQS queues
- Useful for allowing other services (SNS, S3…) to write to an SQS queue
After a message is polled by a consumer, it becomes _______ to other consumers
invisible
By default, the “message visibility timeout” is __________?
30 seconds
If a message is not processed within the visibility timeout, it will be processed ___________?
TWICE
A consumer could call the ____________ API to get more time
ChangeMessageVisibility
What happens if a visibility timeout is high (hours)?
consumer crashes, re-processing will take time
What happens if visibility timeout is too low (seconds)?
we may get duplicates
If someone wants to decrease the latency and increase efficiency and decrease there API calls to a SQS Queue .. what should they do?
Long Polling
- Limited throughput: 300 msg/s without batching, 3000 msg/s with
- Exactly-once send capability (by removing duplicates)
- Messages are processed in order by the consumer
Amazon SQS – FIFO Queue
What if you want to send one message to many receivers?
Amazon SNS
- The “event producer” only sends message to one SNS topic
- As many “event receivers” (subscriptions) as we want to listen to the SNS topic notifications
- Each subscriber to the topic will get all the messages (note: new feature to filter messages)
- Up to 12,500,000 subscriptions per topic
- 100,000 topics limit
Amazon SNS
What are the 2 types of publishing for AWS SNS?
Topic Publish (using the SDK)
Direct Publish (for mobile apps SDK)
Amazon SNS –
* Create a topic
* Create a subscription (or many)
* Publish to the topic
Topic Publish (using the SDK)
Amazon SNS –
* Create a platform application
* Create a platform endpoint
* Publish to the platform endpoint
* Works with Google GCM, Apple APNS, Amazon ADM…
Direct Publish (for mobile apps SDK)