Q33 — AWS SAA-C03 Ch.12
Question 33 of 100 | ← Chapter 12
Q833. A company needs to create an AWS Lambda function that will run in a VPC in the company's primary AWS account. The Lambda function needs to access files that the company stores in an Amazon Elastic File System (Amazon EFS) file system. The EFS file system is located in a secondary AWS account. As the company adds files to the file system, the solution must scale to meet the demand.Which solution will meet these requirements MOST cost-effectively?
- A. Create a new EFS file system in the primary account. Use AWS DataSync to copy the contents of the original EFS file system to the new EFS file system.
- B. Create a VPC peering connection between the VPCs that are in the primary account and the secondary account. ✓
- C. Create a second Lambda function in the secondary account that has a mount that is configured for the file system. Use the primary account's Lambda function to invoke the secondary account's Lambda function.
- D. Move the contents of the file system to a Lambda layer. Configure the Lambda layer's permissions to allow the company's secondary account to use the Lambda layer.
Correct Answer: B. Create a VPC peering connection between the VPCs that are in the primary account and the secondary account.
Explanation
To meet the requirements of creating an AWS Lambda function in a VPC in the company's primary account that needs to access files stored in an Amazon Elastic File System (EFS) file system located in a secondary account, the most cost-effective solution is:B. Create a VPC peering connection between the VPCs that are in the primary account and the secondary account.Here's why:Option B suggests creating a VPC peering connection between the VPCs in the primary and secondary accounts. VPC peering allows secure communication between VPCs across different AWS accounts. By establishing a VPC peering connection, the Lambda function in the primary account can directly access the EFS file system in the secondary account.This solution is cost-effective because it doesn't involve additional services or data transfer costs. It utilizes the existing infrastructure and connectivity capabilities provided by VPC peering.Options A, C, and D are not the optimal solutions to meet the requirements.Option A suggests creating a new EFS file system in the primary account and using AWS DataSync to copy the contents of the original EFS file system to the new one. While this solution would provide access to the files in the primary account, it introduces additional costs for data transfer and requires ongoing synchronization between the two EFS file systems.Option C suggests creating a second Lambda function in the secondary account with a mount configured for the file system. While it allows accessing the file system in the secondary account, it adds complexity with cross-account invocation and may result in higher operational overhead.Option D suggests moving the contents of the file system to a Lambda layer. However, Lambda layers are primarily used for sharing code and dependencies across multiple Lambda functions, and they have size limitations. Storing files in a Lambda layer may not be suitable for file system access and doesn't provide an efficient solution.Therefore, the recommended solution is to create a VPC peering connection between the VPCs in the primary and secondary accounts to enable direct access from the Lambda function in the primary account to the EFS file system in the secondary account.