Amazon EC2
This is incorrect. Amazon EC2 is a service that provides virtual servers, requiring instance selection, launch, and operating system management.
This does not meet the requirement of running code without any server management.
Which AWS service runs code in response to events without any server provisioning or management, and charges only for the execution time and number of requests consumed?
A question asking to identify the serverless service that runs code in response to events.
Amazon EC2
This is incorrect. Amazon EC2 is a service that provides virtual servers, requiring instance selection, launch, and operating system management.
This does not meet the requirement of running code without any server management.
AWS Fargate
This is incorrect. AWS Fargate is a serverless compute engine that runs containers without server management.
However, charges are based on the vCPU and memory allocated to the container for the duration it runs, not per request. The description in this question — running code per event and charging per execution time and request count — applies to AWS Lambda.
AWS Lambda
This is correct. AWS Lambda is a serverless compute service. No server provisioning or management is required; code runs in response to events such as API calls and file uploads. Charges are based on execution time and request count, with no charge during idle time.
AWS Elastic Beanstalk
This is incorrect. AWS Elastic Beanstalk is a service that automatically provisions the execution environment, such as Amazon EC2, when code is uploaded.
However, the underlying infrastructure is always-on EC2, which is billed for its running time. The requirement of running only during events and charging per request applies to AWS Lambda, not Elastic Beanstalk.
'No server management,' 'event-driven,' and 'pay only for execution' all point to AWS Lambda (serverless). Servers are managed with Amazon EC2; serverless container execution uses AWS Fargate.