Question

Difficulty: EasyAWS Compute Services

A developer needs to run a short Python script for 10 seconds every night to clean up temporary database records. The developer does not want to provision or manage any virtual servers. Which AWS compute service should be used to run this script?

  1. AWS LambdaAnswer
  2. B
    Amazon EC2
  3. C
    Amazon Lightsail
  4. D
    Amazon ECS

Answer

AWS Lambda
The correct option is AWS Lambda because it is a serverless compute service that runs code only when triggered (such as by a cron schedule) and automatically handles the underlying compute infrastructure, freeing the developer from server management.

Step-by-Step Solution

1
Identify the primary workload requirement and management constraints.
The script runs briefly (10 seconds) once per day, and the developer wants to avoid server management.
This establishes that a serverless, event-driven compute option is the most suitable and cost-effective choice.
2
Evaluate the available compute options against these constraints.
AWS Lambda allows running code without provisioning or managing servers, and charges only for the compute time used, fulfilling all constraints.
Other options like Amazon EC2 or Amazon Lightsail require configuring and running virtual machines, which violates the requirement to avoid managing servers.

Key Concept

AWS Lambda allows users to run code as serverless functions, eliminating the need to provision or manage servers while automatically scaling and only charging for active compute time.
Rate this question