Which solution should the developer use to meet these requirements?
Create an Amazon Elastic File System (Amazon EFS) file system. Mount the EFS file system in Lambda. Store the result files and log file in the mount point. Append the log entries to the log file.
Create an Amazon Elastic Block Store (Amazon EBS) Multi-Attach enabled volume. Attach the EBS volume to all Lambda functions. Update the Lambda function code to download the log file, append the log entries, and upload the modified log file to Amazon EBS.
Create a reference to the /tmp local directory. Store the result files and log file by using the directory reference. Append the log entry to the log file.
Create a reference to the /opt storage directory. Store the result files and log file by using the directory reference. Append the log entry to the log file.
Explanations:
Amazon EFS provides a scalable, shared file storage solution that can be mounted to Lambda functions. It allows multiple Lambda functions to access and append to the same log and result files. EFS is ideal for this use case where multiple services need to share files and append logs.
Amazon EBS is a block-level storage service and doesn’t support simultaneous access from multiple Lambda functions or services. Multi-Attach only supports EC2 instances, so this approach is not suitable for Lambda functions.
The /tmp directory in Lambda is temporary and isolated to each invocation. It does not support sharing files between multiple Lambda functions or services, nor does it support appending logs in a persistent manner.
The /opt directory in Lambda is used for custom Lambda layers but is not suitable for persistent, shared file storage. It cannot be used to share files or append logs between Lambda functions or external services.