An IoT telemetry ingestion application uses an AWS Lambda function to process device log files uploaded to an Amazon S3 bucket. The function parses the logs and sends alerts to an external monitoring API on the public internet. To securely query an Amazon ElastiCache Redis cluster, the Lambda function is configured to run inside private subnets of a VPC. The developer notices that the function successfully queries Redis but fails to send alerts to the external monitoring API, resulting in connection timeouts. Furthermore, under peak load, some executions are terminated prematurely before completion.
Which two actions should the developer take to resolve these issues? (Select TWO.)
- Configure a NAT gateway in a public subnet of the VPC, and update the route table of the Lambda function's private subnets to route 0.0.0.0/0 to the NAT gateway.Cevap
- Increase the function's execution timeout setting in the AWS Lambda configuration.Cevap
- CEnable the public IP assignment setting in the VPC configuration of the Lambda function.
- DAttach an Internet Gateway directly to the private subnets and update their route tables to direct 0.0.0.0/0 traffic to it.
- EMove the Redis connection initialization inside the Lambda handler function to prevent the execution context from reusing stale connections that cause timeouts.
Cevap
The developer should configure a NAT gateway in a public subnet with a route in the private subnets' route table, and increase the execution timeout in the Lambda function's configuration.
To resolve the network connectivity issue, a NAT gateway must be set up in a public subnet, and the route table for the private subnets (where the Lambda function runs) must route outbound traffic (0.0.0.0/0) to the NAT gateway. To resolve the premature termination issue under peak load, the Lambda function's timeout configuration must be increased to allow enough time for processing larger logs.
Adım Adım Çözüm
Anahtar Kavram
Configuring VPC networking for Lambda internet access and managing Lambda execution timeouts