A developer is packaging a serverless microservice to run on AWS Lambda. The developer wants to optimize the function's startup performance by reducing cold start latency. Which two actions should the developer take? (Select two.)
- Initialize AWS SDK clients and database connection pools outside the handler function to allow reuse across invocationsCevap
- Reduce the deployment package size by packaging only the code and dependencies required for executionCevap
- CStore AWS Access Key ID and Secret Access Key directly within the function's environment variables for client authentication
- DSet the Amazon SQS queue visibility timeout to be lower than the Lambda function timeout to ensure fast processing
- EDeploy the Lambda function in a private VPC subnet without an internet route or NAT Gateway to access external APIs
Cevap
Initialize AWS SDK clients and database connection pools outside the handler function, and reduce the deployment package size by packaging only the required code and dependencies.
The correct options represent two standard AWS practices for reducing Lambda latency: utilizing the global execution scope for client initialization to enable context reuse, and minimizing the package size to decrease download and extraction times.
Adım Adım Çözüm
Anahtar Kavram
AWS Lambda cold start optimization and execution context reuse