A company runs a script on an Amazon EC2 instance that polls and processes messages from an Amazon Simple Queue Service (Amazon SQS) queue. The company wants to reduce operational costs while preserving the ability to process an increasing number of messages. What should a solutions architect recommend?
Choose an answer
Tap an option to check your answer.
Correct answer: Migrate the script on the EC2 instance to an AWS Lambda function with the appropriate runtime..
Why this is the answer
Migrating the script to AWS Lambda is the most cost-effective and scalable solution. Lambda is a serverless compute service where you pay only for the compute time consumed, eliminating costs associated with idle EC2 instances. It automatically scales to handle increasing message loads from SQS without requiring manual intervention, aligning with the goal of processing more messages. Increasing EC2 instance size would increase costs and might still be underutilized. Using EventBridge to turn off an EC2 instance is a partial solution for cost reduction but doesn't offer the same level of automatic scaling or cost efficiency as Lambda. AWS Systems Manager Run Command executes scripts on demand but doesn't provide the automatic scaling and cost optimization benefits of Lambda for a message processing workflow.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed