The AWS Lambda best practices are as follows:
- It is best practice to write an AWS Lambda function in a stateless style. It should not have any rapport with the basic compute infrastructure.
- A persistent state should be stored in another cloud service, such as Amazon S3 or DynamoDB.
- It is recommended to separate core logic from the Lambda handler, as the handler is generally used as an entry point to the function.
- When a Lambda function is deployed over a VPC, it is a best practice to avoid using DNS resolution for a public hostname, as it may take several seconds to resolve, adding several billable seconds.
- It is recommended that you specify at least one subnet in each AZ with the Lambda function configuration.
- It is recommended that you make sure that sufficient subnet IPs are free to allow Lambda functions to scale. If there aren't any free subnet...