AWS Certification: SQS Questions

Amazon Simple Queue Service (SQS)

Overview
Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. SQS eliminates the complexity and overhead associated with managing and operating message oriented middleware, and empowers developers to focus on differentiating work. Using SQS, you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be available. Get started with SQS in minutes using the AWS console, Command Line Interface or SDK of your choice, and three simple commands.
1. A company currently has an application hosted on their On-premises environment. The application has a combination of web Instances with worker Instances and Rabbit-MQ for messaging purposes. This infrastructure is now required to be moved to the AWS Cloud. What is the best way to start using messaging on the AWS Cloud?

A. Continue using Rabbit-MQ. Host is on a separate EC2 Instance.

B. Make use of AWS SQS to manage the messages.

C. Make use of DynamoDB to store the messages.

D. Make use of AWS RDS to store the messages.

Answer

B. Make use of AWS SQS to manage the messages.

An ideal option would be to make use of AWS Simple Queue Service to manage the messages between the application components. The AWS SQS Service is a highly scalable and durable service.

For more information on Amazon SQS, please refer to the below URL:

https://aws.amazon.com/sqs/


2. A company has a workflow that sends video files from their on-premises system to AWS for transcoding. They use EC2 worker instances to pull transcoding jobs from SQS. Why is SQS an appropriate service for this scenario?

A. SQS guarantees the order of the messages.

B. SQS synchronously provides transcoding output.

C. SQS checks the health of the worker instances.

D. SQS helps to facilitate horizontal scaling of encoding tasks.

Answer

D. SQS helps to facilitate horizontal scaling of encoding tasks.

Even though SQS guarantees the order of messages for FIFO queues, the main reason for using it is because it helps in horizontal scaling of AWS resources and is used for decoupling systems. SQS can neither be used for transcoding output nor for checking the health of worker instances. The health of worker instances can be checked via ELB or CloudWatch. For more information on SQS, please visit the following URL: https://aws.amazon.com/sqs/faqs/


3. A company is planning to design a Microservices architectured application that will be hosted in AWS. This entire architecture needs to be decoupled whenever possible. Which of the following services can help achieve this?

A. AWS SNS

B. AWS ELB

C. AWS Auto Scaling

D. AWS SQS

Answer

D. AWS SQS

Amazon Simple Queue Service (SQS) is a fully managed message queuing service that makes it easy to decouple and scale microservices, distributed systems, and serverless applications. Building applications from individual components that each perform a discrete function improves scalability and reliability, and is best practice design for modern applications. SQS makes it simple and cost-effective to decouple and coordinate the components of a cloud application. Using SQS, you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be always available. For more information on AWS SQS, please visit the following URL: https://aws.amazon.com/sqs/


4. A database hosted in AWS is currently encountering an extended number of write operations and is not able to handle the load. What can be done to the architecture to ensure that the write operations are not lost under any circumstance?

A. Add more IOPS to the existing EBS Volume used by the database.

B. Consider using DynamoDB instead of AWS RDS.

C. Use SQS Queues to queue the database writes.

D. Use SNS to send notification on missed database writes and then add them manuallyat a later stage.

Answer

C. Use SQS Queues to queue the database writes.

SQS Queues can be used to store the pending database writes, and these writes can then be added to the database. It is the perfect queuing system for such architecture. Note that adding more IOPS may help the situation but will not totally eliminate chances of losing database writes. For more information on AWS SQS, please refer to the URL below: https://aws.amazon.com/sqs/faqs/Note:The scenario in the question is that the database is unable to handle the write operations and the requirement is that with out loosing any data we need to perform data writes on to the database.For this requirement, we can use an SQS queue to store the pending write requests, which will ensure the delivery of these messages.Increasing IOPS can handle the traffic bit more efficiently but it has a limit of .40,000 IOPS where as SQS queues can handle 120,000 messages inflight.


5. An application allows a manufacturing site to upload files. Each uploaded 3 GB file is processed to extract metadata, and this process takes a few seconds per file. The frequency at which the uploads happen is unpredictable. For instance, there may be no updates for hours, followed by several files being uploaded concurrently.

What architecture addresses this workload in the most cost efficient manner?


A. Usea Kinesis Data Delivery Stream to store the file. Use Lambda for processing.

B. Use an SQS queue to store the file, to be accessed by a fleet of EC2 Instances.

C. Store the file in an EBS volume, which can then be accessed by another EC2 Instance for processing.

D. Store the file in an S3 bucket. Use Amazon S3 event notification to invoke aLambda function for file processing.

Answer

B. Use an SQS queue to store the file, to be accessed by a fleet of EC2 Instances.

You can first create a Lambda function with the code to process the file.

You can then use an Event Notification from the S3 bucket to invoke the Lambda function whenever a file is uploaded.


6. An application needs to have a messaging system in AWS. It is of the utmost importance that the order of messages is preserved and duplicate messages are not sent. Which of the following services can help fulfill this requirement?

A. AWS SQS FIFO

B. AWS SNS

C. AWS Config

D. AWS ELB

Answer

A. AWS SQS FIFO

One can use SQS FIFO queues for this purpose. AWS Documentation mentions the following on SQS FIFO Queues:Amazon SQS is a reliable and highly-scalable managed message queue service for storing messages in transit between application components. FIFO queues complement the existing Amazon SQS standard queues, which offer high throughput, best-effort ordering, and at-least-once delivery. FIFO queues have essentially the same features as standard queues, but provide the added benefits of supporting ordering and exactly-once processing. FIFO queues provide additional features that help prevent unintentional duplicates from being sent by message producers or from being received by message consumers. Additionally, message groups allow multiple separate ordered message streams within the same queue. For more information on SQS FIFO Queues, please visit the following URL: https://aws.amazon.com/about-aws/whats-new/2016/11/amazon-sqs-introduces-fifo-queues-with-exactly-once-processing-and-lower-prices-for-standard-queues/Note:As per AWS, SQS FIFO queues will ensure the delivery of the message only once and it will be delivered in a sequential order. (i.e. First in First Out) where as SNS cannot guarantee the delivery of the message only once.As per AWS SNS FAQ,Q: How many times will a subscriber receive each message?Although most of the time each message will be delivered to your application exactly once, the distributed nature of Amazon SNS and transient network conditions could result in occasional, duplicate messages at the subscriber end.Developers should design their applications such that processing a message more than once does not create any errors or inconsistencies.FIFO FQs states thatUsing SQS FIFO queues will satisfy both the requirements stated in the question.i.e. Duplication of message will not occur and the order of messages will be preserved.


7. There is a requirement for 500 messages to be sent and processed in order. Which service can be used in this regard?

A. AWS SQS FIFO

B. AWS SNS

C. AWS Config

D. AWS ELB

Answer

A. AWS SQS FIFO

One can use SQS FIFO queues for this purpose. The AWS Documentation mentions the following on SQS FIFO Queues:

Amazon SQS is a reliable and highly-scalable managed message queue service for storing messages in transit between application components. FIFO queues complement the existing Amazon SQS standard queues, which offer high throughput, best-effort ordering, and at-least-once delivery. FIFO queues have essentially the same features as standard queues, but provide the added benefits of supporting ordering and exactly-once processing. FIFO queues provide additional features that help prevent unintentional duplicates from being sent by message producers or from being received by message consumers. Additionally, message groups allow multiple separate ordered message streams within the same queue.

For more information on SQS FIFO Queues, please visit the following URL:

https://aws.amazon.com/about-aws/whats-new/2016/11/amazon-sqs-introduces-fifo-queues-with-exactly-once-processing-and-lower-prices-for-standard-queues/

Note:

Yes, SNS is used to send out the messages.

SNS is a web service that coordinates and manages the delivery or sending of messages to subscribing endpoints or clients. In Amazon SNS, there are two types of clients—publishers and subscribers—also referred to as producers and consumers. Publishers communicate asynchronously with subscribers by producing and sending a message to a topic, which is a logical access point and communication channel. Subscribers (i.e., web servers, email addresses, Amazon SQS queues, AWS Lambda functions) consume or receive the message or notification over one of the supported protocols (i.e., Amazon SQS, HTTP/S, email, SMS, Lambda) when they are subscribed to the topic. There is no such thing like maintain the messages order in SNS.

In the question, it mentioned that “There is a requirement for 500 messages to be sent and processed in order”. By SNS all messages will send at the same time to all the subscribers.

Please refer following the link to get more information.

https://docs.aws.amazon.com/sns/latest/dg/welcome.html


8. You are working on creating a mobile application for your company. This application is being built to work with DynamoDB as the back end and JavaScript as the front end. During application usage, you notice that there are spikes in the application, especially in the DynamoDB area. Which one of the below options provides the most cost-effective and scalable architecture for this application?

A. Autoscale DynamoDB to meet the requirements.

B. Increase write capacity of DynamoDB tables to meet the peak loads.

C. Create a service that pulls SQS messages and writes these to DynamoDB to handle suddenspikes in DynamoDB.

D. Launch DynamoDB in Multi-AZ configuration with a global index to balance writes.

Answer

C. Create a service that pulls SQS messages and writes these to DynamoDB to handle suddenspikes in DynamoDB

When looking for scalability, SQS is the best option. DynamoDB is scalable, but since a cost-effective solution is required, SQS messaging can assist in managing the above situation. Amazon Simple Queue Service (SQS) is a fully-managed message queuing service for reliably communicating among distributed software components and microservices – at any scale. Building applications from individual components that each perform a discrete function improves scalability and reliability, and is best practice design for modern applications. SQS makes it simple and cost-effective to decouple and coordinate the components of a cloud application. Using SQS, you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be always available. For more information on SQS, please refer to the below URL: https://aws.amazon.com/sqs/


9. You want to build a decoupled, highly available and fault tolerant architecture for your application in AWS. You decide to use EC2, the Classic Load Balancer, Auto Scaling and Route 53. Which one of the following additional services should you involve in this architecture?

A. AWS SNS

B. AWS SQS

C. AWS API Gateway

D. AWS Config

Answer

B. AWS SQS

The Simple Queue Service can be used to build a decoupled architecture. AWS Documentation further mentions the following: Amazon Simple Queue Service (SQS) is a fully managed message queuing service that makes it easy to decouple and scale microservices, distributed systems, and serverless applications. Building applications from individual components that each perform a discrete function improves scalability and reliability, and is best practice design for modern applications. For more information on the Simple Queue Service, please visit the following URL: https://aws.amazon.com/sqs/


10. Your application provides data transformation services. Files containing data to be transformed are first uploaded to Amazon S3 and then transformed by a fleet of Spot EC2 Instances. Files submitted by your premium customers must be transformed with the highest priority. How would you implement such a system?

A. Use a DynamoDB table with an attribute defining the priority level. Transformation instances will scan the table for tasks, sorting the results bypriority level.

B. Use Route 53 latency-based routing to send high priority tasks to the closesttransformation instances.

C. Use two SQS queues, one for high priority messages, the other for defaultpriority. Transformation instances first poll the high priority queue; if there is nomessage, they poll the default priority queue.

D. Use a single SQS queue. Each message contains the priority level. Transformation instances poll high-priority messages first.

Answer

C. Use two SQS queues, one for high priority messages, the other for defaultpriority. Transformation instances first poll the high priority queue; if there is nomessage, they poll the default priority queue.

The best way is to use 2 SQS queues. Each queue can be polled separately. The high priority queue can be polled first. For more information on AWS SQS, please refer to the link below: https://aws.amazon.com/sqs/


11. Your company has an application that takes care of uploading, processing and publishing videos posted by users. The current architecture for this application includes the following:

a) A set of EC2 Instances to transfer user uploaded videos to S3 buckets

b) A set of EC2 worker processes to process and publish the videos

c) An Auto Scaling Group for the EC2 worker processes

Which of the following can be added to the architecture to make it more reliable?


A. Amazon SQS

B. Amazon SNS

C. Amazon CloudFront

D. Amazon SES

Answer

A. Amazon SQS

Amazon Simple Queue Service (Amazon SQS) offers a reliable, highly scalable hosted queue for storing messages as they travel between applications or microservices. It moves data between distributed application components and helps you decouple these components. For more information on AWS SQS, please visit the following URL: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/Welcome.html