Integration & Messaging Flashcards

1
Q

What are some of the main attributes of the SQS standard queue?

A

Unlimited throughput, unlimited number of messages on a queue. Default retention of 4 days maximum of 14. Low latency, max message size of 256Kb. Can have duplicate messages (at least once delivery). Can have out of order messages (best effort ordering).

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

What are two common use cases of a SQS queue policy?

A

Cross account access - using a EC2 instance in one account to poll the queue in a different account. Publish events from S3 to a SQS queue.

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

How do you allow an EC2 instance to poll an SQS queue in a different account?

A

Use a SQS queue policy with an allow effect, a principal of the other AWS account, an action of recieveMessage and a resource of the queue in question.

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

How do you configure access to allow events from S3 to be pushed into an SQS queue?

A

Use a SQS queue policy with an allow effect, a principal of any AWS account, a condition to restrict the source ARN to be that of the S3 bucket, and a source account to be equal to the account of the S3 bucket.

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

What is SQS message visibility timeout?

A

After a message is polled by a consumer it becomes invisible to other consumers.

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

Can the SQS message visibility timeout be extended by a consumer?

A

Yes, if the consumer knows it needs a bit more time to process the message it can make a ChangeMessageVisibility API call to the Queue

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

What is the SQS dead letter queue?

A

A queue for messages that have been received too many times, possibly because the message is malformed or an error has occurred. Useful for debugging. The type of dead letter queue matches that of the original queue (standard vs FIFO).

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

What is the “Redrive to source” feature of the dead letter queue?

A

Ability to send messages on the dead letter queue back into the original queue, for example after a bug has been fixed.

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

What is the SQS delay queue?

A

Delay a message from being consumed for up to 15mins using the delivery delay attribute.

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

What is SQS long polling?

A

Poll for messages for an extended period, to reduce the number of API calls the consumer needs to make to increase efficiency and decrease latency, better than short polling for most apps.

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

What is the SQS extended client?

A

A simple java based library to allow for larger messages. This is more of a concept, as this can be implemented in other languages. Message gets sent into a S3 bucket first, a small pointer message gets put onto the queue, consumer then gets data from the bucket.

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

How would you use a SQS queue to send large messages?

A

Use the extended client (java library or similar) . This will put the message into a S3 bucket first then sends a small message onto the queue with a reference to the S3 object.

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

What is a FIFO queue?

A

First in first out queue for ordering of messages. Has limited throughput, exactly one send capability (prevent duplicates). Messages processed in order by consumer.

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

What is FIFO de-duplication interval?

A

The amount of time that a duplicate message should be ignored before it should be accepted onto the queue.

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

What is the purpose of the message group id in a FIFO queue?

A

Ordering of messages is maintained within a message group. Lets you have multiple consumers, each one consuming a specific message group.

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

What is Amazon SNS?

A

Simple Notification Service, Pub-Sub - lets you send a message to a topic and multiple consumers can subscribe to the topic to receive messages.

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

What are some examples of SNS subscribers?

A

Directly send emails or mobile messages. Call HTTP endpoints. An SQS queue. Lambda. Kinesis data firehose.

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

What is the SNS & SQS “Fan Out” pattern?

A

Messages are put onto a SNS topic, and then consumed by multiple SQS queues. Fully decoupled, no data loss, each SQS queue can manage the message itself. Future proofing for additional SQS queues.

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

Can you have a FIFO SNS queue?

A

Yes, messages sent to a FIFO SNS topic will be delivered to the subscribers in order.

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

What is SNS message filtering?

A

JSON policy to filter messages for subscribers of a topic

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

What is Amazon Kinesis?

A

A set of services to assist with collecting, processing and analysing data streams

22
Q

Describe at a high-level how Kinesis data streams work?

A

Producers (e.g. applications, clients, systems using the SDK, Kinesis agents) push records made up of a partition key and the data into a stream. The key helps determine what shard it goes into. You can have one or many shards. Consumers then consume the stream. Example consumers include apps using the SDK, Lambda, Kinesis data firehose, Kinesis data analytics.

23
Q

How long can data be retained in a Kinesis data stream?

A

Between 1 and 365 days

24
Q

Can you reprocess (replay) data from a Kinesis data stream?

A

Yes

25
Q

Is data pushed into a Kinesis data stream immutable?

A

Yes

26
Q

What are the two capacity modes in Kinesis data steam?

A

Provisioned mode - you specify the number of shards, can scale manually or via API. Each shard gets 1MB inbound, 2BM outbound. On demand mode - don’t need to provision and manage capacity. Defaults to 4MB. Scales automatically.

27
Q

How would you deal with the ProvisionedThroughputExceeded exception while putting data onto a Kinesis data stream?

A

Use a highly distributed partition key (to ensure load is distributed well over the shards). Use retries with exponential back-off. Increase the number of shards.

28
Q

What is the difference between the shared (classic) fan-out consumer and the enhanced fan-out consumer for Kinesis data stream?

A

The shared fan-out consumer shares the bandwidth of the stream across each consumer application of a shard. Data is pulled by the consumer. The enhanced fan-out consumer has a dedicated throughput of 2MB per consumer per shard. Data is pushed to the consumers.

29
Q

Using the Kinesis Client Library (KCL) how many instances can read the same shard?

A

Just one KCL per shard

30
Q

In Kinesis data stream what is shard splitting?

A

Used to divide a “hot shard” - a shard that is being over used. Used to increase the stream capacity. The old shard is closed and its data will expire. Cannot split into more than two in one operation.

31
Q

In Kinesis data stream what is shard merging?

A

Used to group two shards with low traffic “cold shards”. Cannot merge more than two in one operation.

32
Q

How do you scale Kinesis data stream?

A

Increase the number of shards using shard splitting. Or decrease by using shard merging.

33
Q

What is Kinesis fire hose?

A

Takes data from producers (usually Kinesis data streams) and writes this data into destinations in batches. Optionally you can use a Lambda to transform the data.

34
Q

What are the AWS destinations for Kinesis fire hose?

A

Amazon S3 buckets, Amazon Redshift (warehousing database via S3), Amazon Opensearch.

35
Q

What are some examples of non AWS destinations for Kinesis fire hose?

A

MongoDb or various others. Can also send directly to your own application via a http endpoint

36
Q

How does Kinesis fire hose handled failed data (data that could not be written)?

A

It can store failed data in an S3 bucket

37
Q

What are some differences between Kinesis data streams and Kinesis data firehose?

A

Streams = streaming service for ingest at scale, can write custom code for consumer/producer, real-time, managed scaling, data storage (1-365 days), supports replay. Firehose = load streaming data into another destination, fully managed, NEAR real-time, auto scaling, no data storage, no replay.

38
Q

What is Kinesis Data Analytics?

A

Real-time analytics on Kinesis data stream or fire hose using SQL or Apache Flink, fully managed.

39
Q

You have an e-commerce website and you are preparing for Black Friday, your website uses a SQS queue, what should you do to prepare the queue?

A

Nothing, SQS auto scales

40
Q

You can configure an SQS queue to keep messages for a maximum of how many days?

A

14

41
Q

Which SQS FIFO message attribute prevents messages with the same deduplication ID to be delivered during a 5-minutes period?

A

MessageDeduplicationId

42
Q

How do you enable AWS X-Ray?

A

In your code import the AWS X-RAY SDK. Install the X-Ray daemon or enable X-Ray AWS Integration. AWS services that integrate with X-Ray already run the daemon for you.

43
Q

Why might X-Ray not be working on an EC2 instance?

A

The X-Ray daemon might not be running or the EC2 IAM role might not have the right permission

44
Q

What is the difference between X-Ray annotations and metadata?

A

Annotations can be used to index traces and can be used with filters / searching. Metadata is not indexed and cannot be used for searching.

45
Q

What are the three ways in which the X-Ray daemon can run in ECS (including Fargate)?

A

In an ECS cluster backed by EC2 you can have a Daemon container running as a separate task or as a sidecar alongside app containers. In Fargate you can only use the sidecar approach.

46
Q

What is the high level differences between CloudTrail, CloudWatch and X-Ray?

A

CloudTrail is for auditing changes made within an AWS account, the API calls made by users/services/console. CloudWatch is for monitoring of service metrics, app logs, and alarms to send notifications. X-Ray is for automated trace analysis and request tracking across systems

47
Q

You have a couple of EC2 instances in which you would like their Standard CloudWatch Metrics to be collected every 1 minute. What should you do? Enable CloudWatch Custom Metrics. Enable High Resolution. Enable Basic Monitoring. Enable Detailed Monitoring.

A

Enable Detailed Monitoring. Basic monitoring only gives you metrics every 5 mins. Detailed gives you 1 min periods.

48
Q

High Resolution cloud watch metrics can have a minimum resolution of how many seconds? 10s, 1s, 30s, 60s

A

1 second

49
Q

You have an application hosted on a fleet of EC2 instances managed by an Auto Scaling Group that you configured its minimum capacity to 2. Also, you have created a CloudWatch Alarm that is configured to scale in your ASG when CPU Utilization is below 60%. Currently, your application runs on 2 EC2 instances and has low traffic and the CloudWatch Alarm is in the ALARM state. What will happen?

A

The alarm will remain in the ALARM state but never decrease the number of EC2 instances

50
Q

By default, all logs stored in CloudWatch Logs are automatically expiring after 7 days. True or False?

A

False, by default they never expire.

51
Q
A