Soru

Zorluk: KolayVPC Security for Developers

An AWS Lambda function is configured to run inside a private subnet of a custom VPC. The function retrieves transaction data from an internal Amazon RDS database and must then send a confirmation request to an external, public HTTP API. The database connection is successful, but the external API call times out. Which network configuration change will resolve the timeout issue?

  1. Place a NAT Gateway in a public subnet, and configure the private subnet's route table to route outbound internet traffic (0.0.0.0/00.0.0.0/0) to the NAT Gateway.Cevap
  2. B
    Relocate the Lambda function to a public subnet of the VPC so that it can directly assign a public IP address to its elastic network interface (ENI).
  3. C
    Update the trust policy of the Lambda function's execution role to grant assume role permissions to the external API's domain.
  4. D
    Migrate the external API credentials from the Lambda function code to AWS Secrets Manager and create an interface VPC endpoint for Secrets Manager in the private subnet.

Cevap

Place a NAT Gateway in a public subnet, and configure the private subnet's route table to route outbound internet traffic to the NAT Gateway.
For resources inside a private subnet to establish outbound connections to the internet, they must route traffic through a NAT Gateway. The NAT Gateway must be located in a public subnet and have a route from the private subnet's route table pointing 0.0.0.0/00.0.0.0/0 to it.

Adım Adım Çözüm

1
Analyze the network route requirements.
The Lambda function needs to communicate internally with the Amazon RDS database and externally with a public API endpoint.
Establishing both private and public paths helps determine the required VPC components.
2
Select the correct translation gateway for private subnets.
A NAT Gateway must be provisioned in a public subnet of the VPC.
A NAT Gateway maps private IP addresses to a public IP to enable outbound communication with internet resources.
3
Configure the route table.
A route is added to the private subnet's route table directing destination traffic 0.0.0.0/00.0.0.0/0 to the NAT Gateway.
This instructs the VPC router to forward all outbound internet traffic from the private subnet through the NAT Gateway, resolving the connection timeout.

Anahtar Kavram

VPC Routing for Lambda Functions needing Public and Private Access
Tahmini Süre:55s
Bu soruyu puanla