Question

Difficulty: MediumServerless Development with AWS Lambda

A developer is building a serverless data processing application. A Lambda function is triggered by an Amazon S3 object upload event. The function must download the uploaded file (which can be up to 4 GB4\text{ GB} in size), process the contents, and send the results to a third-party payment gateway endpoint on the public internet. The function also needs to log transaction details to an Amazon RDS PostgreSQL database instance located inside a private subnet of a custom VPC. To optimize performance and security, which of the following actions should the developer take when configuring and developing the Lambda function? (Select TWO.)

  1. Increase the ephemeral storage (/tmp) configuration of the Lambda function to at least 4 GB4\text{ GB} to accommodate the downloaded files.Answer
  2. Deploy the Lambda function in the private subnets of the VPC and route outbound internet traffic through a NAT Gateway.Answer
  3. C
    Store the database credentials as hardcoded strings inside the Lambda function handler code to minimize connection establishment overhead.
  4. D
    Deploy the Lambda function in the private subnets of the VPC without a NAT Gateway to ensure secure communication with both the private database and the public payment gateway.
  5. E
    Rely on the default ephemeral storage size, assuming that AWS Lambda automatically deletes files in /tmp immediately after each invocation completes to free up space.

Answer

Increase the ephemeral storage (/tmp) configuration of the Lambda function to at least 4 GB4\text{ GB} to accommodate the downloaded files, and deploy the Lambda function in the private subnets of the VPC and route outbound internet traffic through a NAT Gateway.
To process the 4 GB4\text{ GB} file, the developer must increase the Lambda ephemeral storage (/tmp) configuration from its default of 512 MB512\text{ MB} to at least 4 GB4\text{ GB}. Furthermore, because the function needs to connect to an RDS database inside a private VPC subnet and call a public payment gateway, the function must be attached to the VPC private subnets with a NAT Gateway configured in a public subnet to route outbound internet traffic.

Step-by-Step Solution

1
Analyze storage requirements for the downloaded S3 files.
The file size can reach 4 GB4\text{ GB}. The default Lambda ephemeral storage (/tmp) is only 512 MB512\text{ MB}. Therefore, the configuration must be explicitly scaled up (up to 10 GB10\text{ GB} is supported).
Ensures the Lambda function does not run out of local disk space during download and processing.
2
Analyze network connectivity requirements.
The function must access both a private RDS PostgreSQL instance (requiring VPC placement in private subnets) and a public payment gateway (requiring internet access). Routing private subnet traffic through a NAT Gateway satisfies both requirements.
Allows secure access to internal VPC resources while maintaining outbound internet connectivity.

Key Concept

AWS Lambda VPC networking configuration and ephemeral storage scaling.
Estimated Time:2m 0s
Rate this question