SQS/SNS/Kinesis Flashcards

1
Q

What are the 2 main ways applications can communicate with each other?

A
  • Synchronously (app to app)
  • Asynchronously / Event Base (app to queue to app)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain SQS

A
  • SQS is used for application integrations
  • It lets decoupled apps and services talk to each other.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Is SQS a push or pull service? Explain.

A
  • SQS is a pull service.
  • You must pull or ‘poll’ for new messages using the SDK.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the 2 main types of SQS messages?

A

Standard and FIFO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain Standard SQS

A
  • nearly unlimited messages/second
  • does NOT guarnatee order of delvery
  • always delivers at least once
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

FIFO

A
  • First In, First Out
  • Limited to 300 messages/sec (3000/sec if batch)
  • Exactly-once send capability (by removing duplicates)
  • Messages are processed in order by the consumer
  • FIFO Names must end in .fifo
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the 2 types of polling? Which one is recommended?

A
  • Short polling & Long Polling.
  • When a consumer requests messages from the
    queue, it can optionally “wait” for messages to
    arrive if there are none in the queue.
  • Short Polling returns immediately even if queue is empty.
  • Long polling is recomended because its less API calls which will reduce latency.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is Visibility Timeout in SQS?

A
  • After a message is polled by a consumer, it becomes invisible to other consumers.
  • By default, the message visibility timeout is 30 sec.
  • After timeout period ends, the message is available in SQS.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What happens if the SQS visibiity timeout is to high or too low?

A
  • If to high (hours), then comsumer may crash and it will take time to reload
  • If too low then we may get duplicates
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What happens if a consumer fails to process a message within the visibility timeout period?

A

Message goes back into the queue.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How many times can a message go back into the queue?

What happens once this limit is reached?

A
  • You set the threshold.
  • Once the threshold is met, the message goes into a Dead Letter Queue (DLQ).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When should you NOT use dead letter queues?

A
  • Don’t use a dead-letter queue with standard queues when you want to be able to keep retrying the transmission of a message indefinitely.
  • Don’t use a dead-letter queue with a FIFO queue if you don’t want to break the exact order of messages or operations. For example, don’t use a dead-letter queue with instructions in an Edit Decision List (EDL) for a video editing suite, where changing the order of edits changes the context of subsequent edits.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are Dead Letter Queues useful for?

A

Dead-letter queues are useful for debugging your application or messaging system because they let you isolate problematic messages to determine why their processing doesn’t succeed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the default, min, and max visibility timeout settings - SQS?

A
  • Default: 30 seconds
  • Minimum: 0 seconds
  • Maximum: 12 hours
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a delay queue?

A
  • The ability to delay a message (so consumers don’t see it immediately) for up to 15 minutes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When are new messages available for consumers to view?

A
  • Immediately, unless a delay is set (aka Delay Queue).
  • Can delay up to 15 minutes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is the maximum size of an SQS message? What are your options if a larger message size is needed?

A
  • The maximum message size in 256kb.
  • You can use the extended client library to send a message size of up to 2GB in size.
  • The large message is actually stored in an S3 bucket and a small message gets put into the queue that acts as a pointer to the actual message.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the SQS API call to delete all messages in a queue?

A

PurgeQueue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is the SQS API call to change the message timeout?

A

ChangeMessageVisibility

20
Q

What is the SQS API call to create a new queue?

A
  • CreateQueue
  • use MessageRetentionPeriod to set the time the message is retained
21
Q

What is the API call to delete a message from an SQS Queue?

A

DeleteQueue

22
Q

What API call would Producers use to send a message through SQS?

A

SendMessage

They can also set a DelaySeconds parameter.

23
Q

What SQS API calls can consumers use to get and remove messages?

A
  • ReceiveMessage
  • DeleteMessage
  • ReceiveMessageWaitTimeSecond: Consumers can also take advantage of long polling
24
Q

What are the three common batch API calls for SQS?

A
  • SendMessage
  • DeleteMessage
  • ChangeMessageVisibility
25
Q

What is AWS SNS?

A
  • Simple Notification Service
  • Pub/Sub - one topic can be published and then subscribed to by many subscribers
  • Event driven
  • “Push” service
26
Q

How many subscription are allowed per topic (SNS)?

A

10,000,000

27
Q

What is the maximum number of topics you can have in SNS?

A

10,000

28
Q

Who can subscribe to an SNS topic?

A
  • AWS SQS
  • HTTP / HTTPS (with delievery retries - how many times)
  • Lambda
  • Emails
  • SMS messages
  • Mobile Notifications
29
Q

How can SNS topics be encrypted/secured?

A
  • In-flight using HTTPS API
  • At-rest using KMS keys
  • Client-side encryption if the client want to perform the encryption/decryption itself.
  • IAM Policies
  • SNS Access policies can also be used to allow for cross-account access to SNS topics. This is also useful for allowing other services to write to an SNS topic.
30
Q

How can the same message be pushed into many SQS queues?

A
  • Using SNS, Fan Out pattern
  • Push message once to SNS. This message is then received by all SQS subscribers.
  • Fully decoupled = no data loss
  • By doing it this may, SQS allows for data persistence, delayed processing and retries of work
31
Q

What security measure must be in place in order for SNS to to write to SQS?

A

SQS queue must have an access policy that allows SNS to write

32
Q

Can SNS send messages to an SQS FIFO queue?

A

No. This is an AWS limitation

33
Q

What is AWS Kinesis?

A
  • Solution for collecting, processing and analyzing streaming data in the cloud.
  • Think ‘real-time’, ‘Big Data’, analytics, and ETL processes
  • Amazon Kinesis enables you to ingest, buffer, and process streaming data in real-time
  • Fully managed
  • Scalable
  • A tool to move big data streams from a source to a final destination like S3, redshift etc.
34
Q

What are the properties of Kinesis Streams?

A
  • Streams are divided in ordered Shards/Partitions (1 stream = many shards)
  • Shards are provisioned (paid for)
35
Q

What is Kinesis Firehose?

A
  • The easiest way to reliably load streaming data into data lakes, data stores, and analytics services.
  • Pay for only the data ingested, data immediately disappears once processed.
  • Consumer of choice is from a predefined set of services: S3, RedShift, Elasticsearch or Splunk
36
Q

What is Kinesis Analystics?

A
  • allows you to perform queries in real-time.
  • Needs a kinesis data stream/firehose as the input/output.
37
Q

What is Kinesis Video analystics

A
  • securly ingests and stores video and audio encoded data to consumers such as SageMaker, Rekognition or other services to apply machine learning and video processing.
38
Q

What is KPL (Kinesis Producer Library)

A
  • A Java library to write data to a stream.
  • You can write data to a stream using AWS SDK, but KPL is more efficent.
39
Q

Does SQS scale automatically or does it require you to enable autoscaling?

A

SQS is a fully managed service that scales automatically. You do not need to enable autoscaling.

40
Q

Which SQS FIFO message attribute (API call) allows two messages to be processed in order?

A

MessageGroupId

41
Q

Which SQS FIFO message attribute allows two messages to be de-duplicated ?

A

MessageDeduplicationId

42
Q

If you currently have 10 active group messages (defined by GroupID) in your SQS FIFO queues, how many consumers can consume simultaneously?

A

10

43
Q

On an SNS topic with a delivery-retry policy configured, in which phase would SNS wait for an increasing amount of time between retries?

A

During the backoff phase

44
Q

What is the kinesis data retention policy?

A

Data retention is 1 day (default) to 7 days (max)

45
Q

How much data can a single kinesis shard ingest?

A
  • Up to 1 MB of data per second (reads), or
  • 1,000 records per second for writes.
46
Q

How are records ordered in kinesis?

A

Records are ordered per shard