A company runs a Java-based job on an Amazon EC2 instance. The job runs every hour, takes 10 seconds to complete, consumes 1 GB of memory, and causes brief CPU spikes while the rest of the time CPU utilization is low. The company wants to reduce costs while meeting these requirements. Which solution will meet these requirements?
Choose an answer
Tap an option to check your answer.
Correct answer: Copy the code into an AWS Lambda function that has 1 GB of memory. Create an Amazon EventBridge scheduled rule to run the code each hour..
Why this is the answer
The correct solution leverages AWS Lambda and Amazon EventBridge for cost-effectiveness and operational simplicity. Lambda is a serverless, event-driven compute service, ideal for short, infrequent tasks like this 10-second hourly job. You pay only for the compute time consumed, which is minimal here. EventBridge can easily schedule the Lambda function to run hourly. Setting the Lambda memory to 1 GB matches the job's requirements. Using AWS App2Container (A2C) with Amazon ECS Fargate would incur higher costs due to Fargate's minimum billing for CPU and memory, even for short bursts. Installing the container in an existing AMI and stopping it is overly complex and still involves managing an EC2 instance. Stopping and restarting an EC2 instance hourly is inefficient, slow due to boot times, and still incurs costs for the stopped instance's EBS volume and potential IP addresses, while also adding operational overhead.
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