What are the best Practices for Working with AWS Lambda Functions?

The following are recommended best practices for using AWS Lambda:

  • Write your Lambda function code in a stateless style, and ensure there is no affinity between your code and the underlying compute infrastructure.
  • Instantiate AWS clients outside the scope of the handler to take advantage of connection re-use.
  • Make sure you have set +rx permissions on your files in the uploaded ZIP to ensure Lambda can execute code on your behalf.
  • Lower costs and improve performance by minimizing the use of startup code not directly related to processing the current event.
  • Use the built-in CloudWatch monitoring of your Lambda functions to view and optimize request latencies.
  • Delete old Lambda functions that you are no longer using.


Comments

Archive

Contact Form

Send