AWS Certified Cloud Practitioner (CLF-C02)Cloud Technology and ServicesEasy
A developer is building a serverless application that needs to execute short-lived, event-driven code functions in response to various triggers, such as HTTP requests or changes in data. The developer wants to pay only for the compute time consumed. Which AWS service should they use?
- AAmazon EC2
- BAmazon ECS
- CAWS Fargate
- DAWS Lambda
Show answer & explanationAnswer & explanation
Correct answer: D. AWS Lambda
AWS Lambda is a serverless compute service that runs code in response to events and automatically manages the underlying compute resources, charging only for the compute time consumed.
Why the other options are wrong
- A. Amazon EC2 involves provisioning and managing virtual servers, which is not serverless and incurs costs even when idle.
- B. Amazon ECS is a container orchestration service, requiring management of EC2 instances or Fargate, and is not purely event-driven serverless functions.
- C. AWS Fargate is a serverless compute engine for containers, but Lambda is more granular for short-lived, event-driven functions, and Fargate still involves container image management.
AWS Lambda
A serverless, event-driven compute service that lets you run code without provisioning or managing servers.
- Serverless compute service
- Executes code in response to events
- Pay only for compute time consumed
- No server management required
Memory trick: Lambda functions, event-driven, swift; serverless code, a perfect gift.