A developer has deployed a Python-based AWS Lambda function that synchronizes real-time multiplayer game leaderboards with an external third-party API and retrieves player metadata from an Amazon ElastiCache (Memcached) cluster located in a private VPC subnet. The Lambda function is configured to run inside the VPC and is associated with the private subnet containing the ElastiCache cluster. During load testing, the developer observes two symptoms: 1. The function is able to connect to the ElastiCache cluster, but all requests to the external third-party leaderboard API fail with a connection timeout error. 2. Under sustained high concurrent load, subsequent invocations of the Lambda function occasionally process stale player metadata that was cached during earlier invocations of the same execution context. Which two actions should the developer take to resolve these issues? (Select TWO.)
- Configure the Lambda function to run in private subnets that have a route pointing to a NAT Gateway located in a public subnet of the VPC.Answer
- Modify the function code to clear or reinitialize global/module-level variables holding the cached player metadata at the start of each handler invocation.Answer
- CAssociate the Lambda function with a public subnet of the VPC and enable auto-assign public IP on the network interface to establish direct outbound routing.
- DIncrease the Lambda function's timeout configuration to allow the global execution context to automatically refresh and purge its in-memory state between consecutive invocations.
- EConfigure the Lambda execution role to allow the 'ec2:CreateNetworkInterface' and 'ec2:DescribeNetworkInterfaces' actions on the public subnets to bridge the external route.