DVA-C02 practice question 2 of 35

A developer migrated a legacy application to an AWS Lambda function. The function uses a third- party service to pull data with a series of API calls…

Full set: 598 questions

Domain Security

A developer migrated a legacy application to an AWS Lambda function. The function uses a third- party service to pull data with a series of API calls at the end of each month. The function than processes the data to generate the monthly reports. The function has Been working with no issues so far. The third-party service recently issued a restriction to allow a feed number to API calls each minute and each day. If the API calls exceed the limit tor each minute or each day, then the service will produce errors. The API also provides the minute limit and daily limit in the response header. This restriction might extend the overall process to multiple days because the process is consuming more API calls than the available limit. What is the MOST operationally efficient way to refactor the server less application to accommodate this change?
Answer options
A: Use an AWS Step Functions State machine to monitor API failures. Use the Wait state to delay calling the Lambda function. Correct answer
B: Use an Amazon Simple Queue Service (Amazon SQS) queue to hold the API calls. Configure the Lambda function to poll the queue within the API threshold limits.
C: Use an Amazon CloudWatch Logs metric to count the number of API calls. Configure an Amazon CloudWatch alarm flat slops the currently running instance of the Lambda function when the metric exceeds the API threshold limits.
D: Use Amazon Kinesis Data Firehose to batch me API calls and deliver them to an Amazon S3 bucket win an event notification to invoke the Lambda function.
Correct Answer:
A. Use an AWS Step Functions State machine to monitor API failures. Use the Wait state to delay calling the Lambda function.
Explanation

AWS Step Functions is the ideal service for orchestrating long-running, stateful, and resilient serverless workflows. The scenario describes a process that may now take multiple days, exceeding the 15-minute AWS Lambda execution limit. A Step Functions state machine can manage the overall process state for up to a year. It can invoke the Lambda function to make API calls, use its built-in Catch mechanism to handle specific throttling errors returned by the third-party service, and then transition to a Wait state to pause execution. This creates a robust loop that respects the API rate limits (both per-minute and daily) without losing progress, making it the most operationally efficient solution.

Why Incorrect

B: Amazon SQS is for decoupling components, not for orchestrating a multi-day stateful workflow. Managing the overall process state and daily limits would require complex custom logic. C: This is a destructive and reactive approach. Abruptly stopping a Lambda function via a CloudWatch alarm would cause the loss of any in-progress work and state. D: Amazon Kinesis Data Firehose is a service for ingesting and delivering streaming data. It is not designed for making outbound API calls or managing workflow orchestration.

References

1. AWS Step Functions Developer Guide, "What is AWS Step Functions?": This document introduces Step Functions as a serverless orchestration service for coordinating components of distributed applications, including AWS Lambda functions, which is the core requirement of the question.

2. AWS Step Functions Developer Guide, "Error handling in Step Functions": This section details the use of Retry and Catch fields within a state definition. This directly supports the solution of catching API throttling errors and taking corrective action, such as waiting.

3. AWS Step Functions Developer Guide, "Wait state": This page describes the Wait state, which "delays the state machine from continuing for a specified time." This is the mechanism used to pause the workflow to comply with the third-party service's rate limits.

4. AWS Lambda Developer Guide, "Lambda quotas": Under the "Lambda function configuration, deployment, and execution quotas" table, the Timeout is listed with a maximum value of 900 seconds (15 minutes). This confirms that a single Lambda function cannot handle a process that runs for multiple days, necessitating an orchestrator like Step Functions.

Scroll to Top