Decoupling and Messaging Flashcards

1
Q

Loose Coupling

A
  • almost always better
  • you never want one EC2 instance talking to another instance -> you want some kind of managed service acting as the go between
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

SQS

A

Simple queue service

  • fully managed
  • poll-based messaging
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Simple Notification Service

A
  • to deliver notifications to an endpoint

- to deliver text messages or emails

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

API Gateway

A
  • a fully managed service that makes it easy for developers to create, publish, maintain, monitor and secure APIs at any scale
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

SQS Producer

A
  • writes the message to the queue
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

SQS Consumer

A
  • pickups up the message when they are ready
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

SQS Setting - Delivery Delay

A
  • default: 0
  • up to 15 min
  • queue holds the message
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

SQS Setting - Message Size

A
  • up to 256 KB of text in any format
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

SQS & SNS Setting - Encryption

A
  • default: messages are encrypted in transit

- optional: can add encryption at rest

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

SQS Setting - Message Retention*

A
  • default: 4 days
  • minimum: 1 minute
  • maximum: 14 days
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

SQS Setting - Long Polling*

A

API connects and waits (not selected by default)

- always choose long polling on the exam

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

SQS Setting - Short Polling*

A

API connects and gets a message and disconnects

  • lots of overhead
  • costly
  • don’t choose on exam
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

SQS Setting - Queue Depth*

A
  • this can be a trigger for autoscaling as the messages back up
  • Cloud Watch tells EC2 instance to spin up to address the queue
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

SQS Visibility Timeout*

A
  • default timeout: 30 seconds
  • once the consuming service attempts to download a message from the queue, it is locked for X seconds so no one else can see it
  • If the backend fails to process the message and tell the queue it’s good, the message will re-appear in the queue
    Otherwise, if the backend sends back and all good message, then it is deleted from the queue
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Dead Letter Queues

A
  • when a backend processes a message but the processing fails, it goes into the queue and gets stuck in a loop, instead, send it to a dead letter queue if they’ve reached the maximum # of re-tries
  • same limits as regular SQS queue - max: 14 days
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the only way to take a message from a queue and temporarily set it aside?

A

Dead Letter Queue

17
Q

Why do you need to set an alarm on a Dead Letter Queue?

A

so you can catch it before something goes off the rails

18
Q

How to create a Dead Letter Queue

A

1) Need to create the dead letter queue before you create your main queue
2) then create the main queue and specify the dead letter queue and set the maximum receives = maximum retries

19
Q

Can SNS use dead letter queues?*

A

Yes, both SQS and SNS can use them

20
Q

Standard SQS Queues

A
    • SQS offers best effort ordering
  • occasionally you might get a message twice
  • nearly unlimited transactions per second
  • cheaper
21
Q

FIFO Queues

A
  • proper ordering
  • there will be no duplicates
  • 300 messages per second (slower)
  • more costly
  • queue name must end in .fifo
  • requires: a message group ID and a message deduplication ID
22
Q

Fifo Message Group ID

A
  • ensures messages are processed one by one

- all messages in the group are downloaded together

23
Q

SNS Push Based messaging

A
  • you have to be ready at any point in time to receive a message
  • proactively delivers messages to the endpoints subscribed to it
24
Q

SNS Setting - Subscribers*

A
  • Kinesis Data Firehose
  • SQS
  • Lambda
  • Email
  • HTTP(s)
  • SMS
  • platform application endpoint
25
Q

SNS Setting - Message Size

A

256 KB in any format

26
Q

What is the only thing that can subscribe to an SNS FIFO?

A

SQS Queues, used for a fan out to multiple SQS queues

27
Q

SNS Setting - Access Policy

A
  • a resource policy can be added to a topic, similar to S3
28
Q

SNS on exam

A
  • not featured as heavily as SQS

- mostly for alerts and push-based

29
Q

SNS Fan out

A

When you subscribe multiple SQS queues to an SNS notification

30
Q

Why do you need an access policy on an SQS queue?

A

To allow SNS to send it notifications

31
Q

For questions about alerts, alarms, or pushing

A

pick SNS

32
Q

What is CloudWatch’s preferred mechanism for alerting?

A

SNS

33
Q

What does API Gateway help with?*

A
  • helps you not bake credentials into code
  • allows you to put a safe “front door” on your application
  • allows outside world to talk to your resources in a way that is safe, controlled, monitored, and helps prevent abuse
  • can restrict who, what, when and how it can be accessed
  • can protect your endpoints by attaching a WAF
  • can implement DDOS protection and rate-limit
  • easy to use and build out calls that call other AWS services
34
Q

API Gateway stages*

A

different versions of the API, customizable