AWS Certified Solutions Architect – Professional — Question 766
A company hosts an image-processing service in the AWS Cloud. The company uses a custom on-premises application to call the service from its on-premises systems over an AWS Direct Connect connection. The application sends image-processing requests to software that is hosted on Amazon EC2 instances. The image data is embedded within the requests. The EC2 instances are in an Auto Scaling group and run behind a Network Load Balancer (NLB). The Auto Scaling group has a minimum capacity of two instances.
The company is receiving tens of thousands of image-processing requests at the same time each day and is experiencing errors. The processing of the requests is not time critical. For much of the day, the application sends no requests.
The company wants to improve the application's reliability and minimize the number of failed image-processing requests. The company also wants to reduce cost.
Which solution will meet these requirements with the LEAST operational overhead?
Answer options
- A. Add a target tracking scaling policy based on a memory utilization metric that has a target value of 90%. Configure the Auto Scaling group to use additional Spot Instances when scaling events occur.
- B. Change the application to upload the images to Amazon S3. Configure Amazon Simple Queue Service (Amazon SQS) notifications for object uploads. Rewrite the image-processing code that runs on the EC2 instances to receive SQS messages with the object reference so that the messages are processed asynchronously. Remove the NLB.
- C. Create an AWS Lambda function that includes the image-processing logic. Deploy the Lambda function in the VPC that hosts the EC2 instances. Update the target group on the NLB to invoke the Lambda function.
- D. Create an AWS Lambda function that includes the image-processing logic. Change the application to upload the images to Amazon S3. Configure Amazon Simple Notification Service (Amazon SNS) notifications for object uploads with a retry policy to invoke the Lambda function. Remove the NLB.
Correct answer: B
Explanation
Decoupling the architecture using Amazon S3 for storage and Amazon SQS for queueing allows the system to handle massive spikes in traffic asynchronously without failing, which is ideal since the processing is not time-critical. Removing the NLB and scaling the EC2 instances down when the SQS queue is empty significantly reduces operational costs during idle hours. Other options, such as using SNS or direct NLB-to-Lambda integration, do not offer the buffering and load-leveling capabilities of SQS, making them prone to throttling and failures during peak times.