[DEVELOPER] Advanced SQS + SNS Flashcards

(37 cards)

1
Q

Explain how SQS Extended Client works

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

Say you want to send a message through SQS of 1GB. How might you do this?

A

SQS Extended Client

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

Why is SQS Long Polling preferable to Short Polling?

A

increases efficiency and latency of the application by decreasing number of API calls made to SQS

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

What are the configuration limits for wait time for SQS Long Polling?

A

1-20 seconds, (but 20 seconds is preferred)

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

What is the name API-level field for configuring SQS Long Polling?

A

RecieveMessageWaitTimeSeconds

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

What does the SQS API call PurgeQueue do?

A

delete all messages in the queue

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

Suppose you are using an SQS/SNS fan-out pattern for an ordering service, but one of your SQS queues should only receive messages that are of the “placed” state. There are multiple SQS queues and you expect not all of your incoming messages will have a “placed” state. How can you implement this functionality?

A

Use SNS Message Filtering (aka fitler policies)

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

Suppose you want to send one S3 Event to many SQS queues. How can you do this in S3?

A

You cant do it in S3, because for each (event type, prefix) you can only have 1 S3 event rule

Instead Use SNS/SQS Fan-out (configure events to SNS)

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

Suppose you want to configure your messaging system to have ordering, deduplication, and fan-out. How can you accomplish this?

A

SNS FIFO Topic AND SQS FIFO Queue

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

Can Lambda subscribe to an SNS FIFO Topic?

A

NO

only SQS FIFO can subscribe to an SNS FIFO topic

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

What are the two methods for SQS FIFO deduplication?

A
  1. Explicit MessageDeduplicationID
  2. Content-based Deduplication (a SHA-256 of the message body)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Suppose you have an SQS queue in one account and an EC2 instance in another account that needs to poll from that SQS queue. How can you configure this to happen?

A

Apply an SQS Queue Policy on the queue to give ReceiveMessage permissions to the account with the EC2 instance

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

Suppose you want to publish an S3 event notification to an SQS queue. You check the SQS queue but the messages are not showing up there. What might you need to do?

A

Configure an SQS Queue Policy on the queue to give SendMessage permissions to the S3 Bucket

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

Suppose you want to send one S3 Event to many SQS queues. How can you do this?

A

Use SNS/SQS Fan-out (configure events to SNS)

S3 Event -> SNS -(fan out) -> SQS queues

Recall: for each (event type, prefix) you can only have 1 S3 event rule

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

What is the name of the API Call you need to make to change the visibility timeout of an SQS queue?

A

ChangeMessageVisibility

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

What is the name of the API call an SQS queue makes after successfully processing a message?

A

DeleteMessage

17
Q

What is primary purpose of the Partition Key when you execute a Put Record into Kinesis Data Sterams?

A

ensure ordering of similar records

Also records with the same parition key aer mapped to the same shard

18
Q

What is the name of the API call used to retrieve data from a specific shard in Kinesis Data Streams?

A

GetRecords (after first calling GetShardIterator to locate the starting point).

19
Q

In an SNS → SQS Fan-out setup, how do you prevent an SQS queue from receiving messages it doesn’t need?

A

Apply an SNS Filter Policy (or Message Filtering) to the SQS subscription, based on attributes in the SNS message.

20
Q

How does a developer prevent failed messages from being lost when an SQS consumer fails to process a message repeatedly?

A

Configure a Dead-Letter Queue on the SQS queue, specifying a maxReceiveCount (the maximum number of times a message can be received before it’s moved to the DLQ).

21
Q

What does DLQ stand for?

A

Dead Letter Queue

22
Q

What is the key difference between SNS and EventBridge?

A

SNS can only filter/route based on metadata

EventBridge can filter/route based on any field in the structured JSON body

23
Q

What AWS service is used to orchestrate complex, multi-step, stateful workflows involving multiple AWS services?

A

AWS Step Functions

24
Q

What is the language used to define a Step Function workflow (State Machine)?

A

Amazon States Language (or ASL)

25
What are the primary features of Step Functions that simplifies code compared to a Lambda-only workflow?
- State management - Error handling - Retries - Sequencing
26
What does **MQ** stand for | (as in Amazon MQ)
**M**essage **Q**ueue
27
When should a developer choose Amazon MQ over SQS or SNS?
Only when an application **requires industry-standard messaging protocols** like JMS or AMQP (typically for a lift-and-shift of a legacy application).
28
What two popular open-source message brokers does Amazon MQ support?
1. ActiveMQ 2. RabbitMQ
29
What is the purpose of the **Visibility Timeout** in an SQS Standard queue?
The **amount of time that a message is hidden from other consumers after one consumer reads it**. This ensures that only one consumer processes a message at a time.
30
How can a developer debug a problem where messages in a Standard SQS queue are being processed multiple times?
**The Visibility Timeout is too short**. The original consumer failed to delete the message before the timeout expired, making the message visible again to other consumers.
31
How do you prevent an SQS message from being delivered more than once in a FIFO queue?
Use the `MessageDeduplicationId` parameter or **enable Content-Based Deduplication** on the queue.
32
What are the two main API calls a developer uses for an SQS Consumer application?
`ReceiveMessage` (to get the message) and `DeleteMessage` (to confirm successful processing).
33
If you want to use SQS to trigger a Lambda function, which polling setting must you configure, and why?
SQS uses a **Lambda Event Source Mapping** which uses **long polling** internally to minimize cost and latency for new messages.
34
What are the four most common Endpoint Types (Protocols) that can subscribe to an SNS Topic?
1. SQS (for Fan-out/Decoupling), 2. Lambda (for serverless processing), 3. HTTP/S (for webhooks), 4. Email.
35
How can you secure messages sent over an HTTP/S subscription to an external endpoint?
Enable **SSL/TLS** on the endpoint, and use the built-in raw message delivery feature if the message is too large or complex for the default SNS wrapping.
36
How does a developer enable Server-Side Encryption (SSE) for an SNS Topic?
By specifying a KMS Customer Master Key (CMK) when creating or configuring the SNS Topic.
37
A developer is writing a CloudFormation template for an SQS queue. They want the queue to only accept messages published from a specific SNS topic in the same account. Which resource property should be used?
The SQS queue's `QueuePolicy` resource property.