A Python script runs on an EC2 instance every 10 minutes to ingest and process files from an S3 bucket; each file takes about 5 minutes to process and is processed only once. CloudWatch metrics show the EC2 instance is idle around 40% of the time. The company wants the workload to be highly available, scalable, and to reduce ongoing management overhead. Which solution meets these requirements most cost-effectively?
Choose an answer
Tap an option to check your answer.
Correct answer: Migrate the processing script to an AWS Lambda function and use S3 event notifications to invoke the Lambda to process objects as they are uploaded..
Why this is the answer
Migrating to AWS Lambda with S3 event notifications is the most cost-effective and efficient solution. Lambda is a serverless compute service, meaning you only pay for the compute time consumed, eliminating costs associated with idle EC2 instances (40% idle time). S3 event notifications directly trigger the Lambda function upon file uploads, providing immediate processing and high availability without managing servers. This approach inherently scales to handle varying loads, as Lambda automatically provisions resources. The SQS and Auto Scaling Group option introduces more management overhead with SQS queue polling and EC2 instance management. Packaging as a container on an EC2 instance still incurs costs for idle EC2 resources and requires manual scaling. Running on Amazon ECS with Fargate and Lambda for triggering is a viable serverless container option but is generally more complex and potentially more expensive than a pure Lambda solution for this specific use case, which doesn't inherently require containerization.
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