CLF-C02 Practice Question 9: Serverless Compute
AWS Certified Cloud Practitioner (CLF-C02) · Test 1 · question 9 of 10
Whenever an image is uploaded to an Amazon S3 bucket, a short piece of code must run to create a thumbnail. Uploads are sporadic. The team does not want to provision, patch, or scale any servers, and wants to pay only while the code is running. Which service fits best?
Show answer and explanation
Answer:
AWS Lambda runs code without provisioning or managing servers. It scales automatically from a handful of requests to thousands, is invoked directly by an Amazon S3 event notification when an object is created, and is billed by the number of requests and the compute duration consumed, so sporadic uploads cost almost nothing.
Option A leaves the team responsible for the instances, the operating system, and the scaling configuration, and idle instances are billed even when no images arrive. Option B has the same problem: with the EC2 launch type you own and pay for the container instances (AWS Fargate would remove the servers, but it is not the option offered). Option D, AWS Batch, is built for scheduling large numbers of long-running batch computing jobs, which is a poor fit for a short, event-driven function.
Reference: What is AWS Lambda?