A development team has configured a telemetry analysis application where an Amazon SQS queue triggers an AWS Lambda function to process device payloads. During load testing, the team observes the following issues:
1. Telemetry payloads are occasionally processed multiple times by different concurrent executions of the Lambda function.
2. The Lambda function periodically fails with a 'No space left on device' error when downloading temporary configuration files for validation.
Which two changes should the developer implement to resolve these issues? (Select TWO.)
- Configure the SQS queue's visibility timeout to be at least six times the timeout of the Lambda function.Answer
- Modify the Lambda function code to delete the downloaded validation files from the /tmp directory before the handler execution completes.Answer
- CDecrease the SQS queue's visibility timeout to match the Lambda function's timeout to guarantee that failed messages are immediately visible for reprocessing.
- DPlace the Lambda function in a public subnet of the VPC and associate a public IP address to allow outbound HTTP connections for downloading files.
- EIncrease the memory allocation of the Lambda function, which automatically increases the ephemeral disk space proportionally up to 10 GB.
Answer
The correct options are configuring the SQS queue's visibility timeout to be at least six times the Lambda function's timeout, and deleting the validation files from the /tmp directory before the handler execution completes.
Configuring the SQS queue's visibility timeout to be at least six times the Lambda function's timeout prevents messages from being visible to other consumers while the active invocation is running, thereby resolving the duplicate processing issue. Additionally, explicitly deleting downloaded files from the /tmp directory before the execution finishes ensures that subsequent invocations reusing the execution context do not run out of space.
Step-by-Step Solution
Key Concept
AWS Lambda ephemeral storage lifecycle management and Amazon SQS integration timeout best practices.