COST 1: How do you optimize your Serverless application’s costs?

Design, implement, and optimize your application to maximize value. Asynchronous design patterns and performance practices ensure efficient resource use and directly impact the value per business transaction.

Resources

AWS Lambda Best Practices
re:Invent 2019 - Serverless architectural patterns and best practices
re:Invent 2019 - Optimizing your Serverless applications

Best Practices:

Improvement Plan

Minimize external calls and function code initialization

  • Review code initialization.
  • Review third-party application deployments and permissions.
  • Optimize logging output and its retention

  • Emit and capture only what is necessary to understand and operate your component as intended.
  • Define and set a log retention strategy to meet your operational and business needs.
  • Optimize function configuration to reduce cost

  • Benchmark your function using different memory sizes.
  • Use cost-aware usage patterns in code

  • Decide whether your application can fit an async pattern.
  • Consider asynchronous invocations and review run away functions where applicable.