Question

Difficulty: EasyAWS Compute Services

A developer wants to run a background script that automatically resizes photos whenever they are uploaded to an Amazon S3 bucket. The script executes in less than ten seconds and does not run continuously. The developer wants to avoid provisioning or managing any virtual machines. Which AWS compute service should be used to meet these requirements?

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

Answer

AWS Lambda
AWS Lambda is a serverless compute service that runs code in response to events, such as an object upload to an Amazon S3 bucket. It automatically runs and scales the code, billing only for the exact compute time consumed (milliseconds), and requires no virtual machine provisioning or operating system maintenance.

Step-by-Step Solution

1
Analyze the requirements from the scenario.
The solution must support short-lived (under 10 seconds), event-driven execution (triggered by S3 uploads) without the need to manage or provision virtual machines.
This establishes the constraints and filters out services that require manual virtual machine provisioning or management.
2
Match the requirements to the correct AWS compute service model.
AWS Lambda allows uploading code that runs only when triggered by events, scaling automatically without server management. Other services like Amazon EC2 and Amazon Lightsail require running virtual servers, and AWS Fargate is meant for running entire containerized applications rather than single scripts.
Evaluating all options identifies the most cost-effective and operationally simple compute service.

Key Concept

AWS Lambda is a serverless compute service designed to run code in response to triggers and events without provisioning or managing servers.
Rate this question