AWS Messaging (SQS, SNS, Kineses) Flashcards
What is the default and max retention of messages in SQS?
4 days is the default, 14 days is the maximum
How big can SQS messages be?
Up to 256KB
True or False: SQS messages are deleted once consumed
False. The polling application must use DeleteMessage API to delete messages
Why would you use SQS?
To decouple applications from one another, to turn synchronous process async
We want to auto-scale our EC2 instances to handle more SQS messaging. What can we do?
We can create a CloudWatch metric on Queue length. We can then create a CloudWatch alarm that our ASG picks up to scale up our Instances
We want to limit who and what resources can write to SQS. What can we use?
SQS Access Policies
What is the SQS Message Visibility Timeout?
When a message is polled by a consumer, the message becomes invisible for a duration of time (e.g. it cannot be polled by other consumers)
An application is processing an SQS message but knows it cannot finish within the Visibility Timeout window, what can it do?
Hit the ChangeMessageVisibility API to get more time
What is SQS Long Polling?
When a consumer requests a message from the queue, if there are none in there, it can wait longer for messages to arrive through Long Polling
How can we make sure SQS messages are in order?
Enable a FIFO Queue
What is the SNS + SQS Fan Out Pattern?
Its where you use an SNS Topic to publish to multiple SQS’s so that individual applications/services have copies of their own messages. SQS also make sure we have no data loss with as retries, delays and data persistence
What must we do to make sure SNS can publish to SQS?
Modify the SQS access policy
We want to control what messages can be sent from our SNS Topics to our subcribers. What can we use?
We can use a JSON message filtering policy
What does the Kinesis Data Stream record consist of?
A sequence number, a partition key and data blob (up to 1 MB)
What is the difference between on-demand and provisioned capacity mode for Kinesis Streams?
On-demand mode allows you to scale automatically the number of shards in the data stream. Provisioned is specifying beforehand the amount of shards you would like