A developer is troubleshooting a Python-based AWS Lambda function that processes real-time telemetry packets from an Amazon Kinesis Data Stream. The function is configured with a memory limit of and a timeout of . It is attached to a private subnet within a VPC to query an Amazon RDS database. During testing, the developer observes the following issues:
- The Lambda function logs `Task timed out after 3.00 seconds` when processing batches with larger telemetry packets.
- The Lambda function fails with a socket timeout error when trying to send analytical summaries to an external third-party API.
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 add a route in the private subnet's route table pointing traffic to the NAT Gateway.Cevap
- Increase the Lambda function's timeout configuration to allow more processing time and allocate more memory to scale CPU performance proportionally.Cevap
- CAssociate the Lambda function with a public subnet and enable the public IP assignment configuration on the function's elastic network interface (ENI).
- DAdd a route in the private subnet's route table that maps all internet-bound traffic () directly to an Internet Gateway.
- EModify the Lambda function's initialization code to force the destruction of the execution context at the end of every handler invocation.
Cevap
To resolve these issues, the developer must configure a NAT Gateway in a public subnet and update the private subnet's route table to route internet-bound traffic to it, and also increase the Lambda function's timeout and memory configuration.
To resolve the external API connection issue, the Lambda function must have outbound internet access. Since the function is in a private subnet, a NAT Gateway must be created in a public subnet, and the private subnet's route table must route all outbound traffic () to this NAT Gateway. To resolve the timeout issues, the function's execution time must be extended by increasing the timeout configuration, and allocating more memory will scale the CPU performance proportionally, allowing it to process large telemetry packets faster.
Adım Adım Çözüm
Anahtar Kavram
Configuring VPC Lambda network routing for internet access and tuning memory and timeout settings to resolve processing bottlenecks.
Tahmini Süre:2m 0s