
Answer-first summary for fast verification
Answer: An AWS Lambda function
## Explanation **Correct Answer: B. An AWS Lambda function** **Why AWS Lambda is the best choice:** 1. **Cost Optimization for Variable Workloads**: - Lambda follows a pay-per-use pricing model where you only pay for the compute time you consume (rounded to the nearest millisecond) - No charges when there are no requests (several hours without requests) - No idle costs compared to EC2 instances or container services that run continuously 2. **Asynchronous Processing Capability**: - Lambda can be invoked asynchronously from API Gateway - API Gateway can directly integrate with Lambda functions - Lambda supports event-driven architectures perfectly 3. **Fast Execution Time**: - Lambda functions typically initialize and execute within milliseconds - Can complete processing "within a few seconds" as required - Cold starts are minimal for infrequent requests **Why other options are not optimal:** **A. AWS Glue job**: - Designed for ETL (Extract, Transform, Load) operations, not for API request processing - Not suitable for real-time or near-real-time processing - Higher costs and longer startup times - Not designed for API Gateway integration **C. Containerized service in Amazon EKS**: - Requires running Kubernetes worker nodes continuously - Incurs costs even during idle periods (several hours without requests) - More complex to manage and configure - Higher operational overhead **D. Containerized service in Amazon ECS with Amazon EC2**: - Requires EC2 instances to run continuously - Pay for EC2 instances even when idle - Not cost-effective for highly variable workloads - Higher minimum costs compared to serverless options **Key AWS Concepts Applied:** - **Serverless computing**: Lambda eliminates the need to provision or manage servers - **Event-driven architecture**: Perfect for asynchronous processing triggered by API requests - **Cost optimization**: Pay only for actual compute time, no idle costs - **API Gateway integration**: Native integration with Lambda for seamless request processing This solution provides the lowest cost because it eliminates idle compute costs while meeting the requirements for asynchronous processing within seconds.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A solutions architect is designing a new API using Amazon API Gateway that will receive requests from users. The volume of requests is highly variable; several hours can pass without receiving a single request. The data processing will take place asynchronously, but should be completed within a few seconds after a request is made.
Which compute service should the solutions architect have the API invoke to deliver the requirements at the lowest cost?
A
An AWS Glue job
B
An AWS Lambda function
C
A containerized service hosted in Amazon Elastic Kubernetes Service (Amazon EKS)
D
A containerized service hosted in Amazon ECS with Amazon EC2