volume_mute
A developer has been asked to troubleshoot a Lambda function that is in production. They've been told that it runs for 5 minutes and has been asked to reduce its duration to save on billable costs. Which actions should the developer take?
publish date: 2024/09/01 23:58:4.510722 UTC
volume_muteCorrect Answer
(1) Confirm whether 5 minutes is the typical duration through production monitoring
(2) Test at higher memory configurations and compare the duration and cost at each configuration
(3) Check whether any unecessary SDK components are in the deployment package
Explanation
A developer must make sure that a 5-minute duration isn't reflective of a single invocation. Instead of running it once from the console, they need to examine how it actually runs in production.
Decreasing the timeout would save costs, but it would probably mean that the function would frequently fail to complete. A best practice is to experiment with different memory configurations and estimate whether a higher memory configuration would actually be less expensive. They can also determine whether there are unnecessary components in the function itself that could be removed to speed up its initialization.
Reference
AWS Skill Builder