AWS Certified Solutions Architect – Associate (SAA-C03) — Question 292
A company uses an Amazon EC2 instance to run a script to poll for and process messages in an Amazon Simple Queue Service (Amazon SQS) queue. The company wants to reduce operational costs while maintaining its ability to process a growing number of messages that are added to the queue.
What should a solutions architect recommend to meet these requirements?
Answer options
- A. Increase the size of the EC2 instance to process messages faster.
- B. Use Amazon EventBridge to turn off the EC2 instance when the instance is underutilized.
- C. Migrate the script on the EC2 instance to an AWS Lambda function with the appropriate runtime.
- D. Use AWS Systems Manager Run Command to run the script on demand.
Correct answer: C
Explanation
Migrating the script to AWS Lambda is the most cost-effective and scalable solution because Lambda scales automatically in response to the volume of SQS messages and charges only for the exact execution time. Upgrading the EC2 instance size increases costs, while stopping the instance or using Run Command does not provide seamless, automated scaling for SQS queue polling. Therefore, a serverless architecture with AWS Lambda minimizes operational overhead and optimizes costs.