AWS recently introduced runtime management controls which provide more visibility and control when Lambda applies runtime updates to functions.
With runtime management controls, developers now have three new capabilities they can leverage:
- Visibility into which patch version a runtime function uses and when runtime updates are applied
- Synchronize runtime updates with function deployments
- Rollback functions to an earlier runtime version
These capabilities are available by choosing one of the update modes for the lambda runtime using AWS CLI and Lambda AWS Management Console. In addition, developers can choose the Infrastructure as Code (IaC) route and use tools such as AWS CloudFormation and the AWS Serverless Application Model (AWS SAM).
Jonathan Tuliani, a principal product manager at AWS, explains in an AWS blog post the runtime version update modes:
You can specify one of three runtime update modes: auto, function update, or manual. The runtime update mode controls when Lambda updates the function version to a new runtime version.
Source: https://aws.amazon.com/blogs/compute/introducing-aws-lambda-runtime-management-controls/
The auto mode is the default, where Lambda takes care of the update, where functions will receive runtime updates in two phases. First, Lambda will apply a new runtime version to newly created or updated functions and, after that, to any remaining functions.
In the second mode, function update, Lambda updates functions to the latest available runtime version whenever a developer changes their function code or configuration, similar to the first phase of auto mode, yet will leave any other function untouched.
And finally, the manual mode gives developers complete control over their function’s runtime version. It allows them to perform a rollback to a previous version. However, AWS strongly recommends using manual mode only for short-term remediation of code incompatibilities.
Eric Hammond, an AWS Hero, posted on the AWS Community social :
I'm going to stick with the default "Automatic" updates to the AWS Lambda runtime stack, because:
- I rarely update the code in my functions
- I don't want to add more manual tasks to my life, and
- I've never experienced a problem with the automatic updates so far
where "so far" is over eight years of running services with AWS Lambda.
Furthermore, Ben Kehoe, an AWS Serverless Hero, tweeted:
The hardest part of serverless is giving up control. Everyone says it's good to update your dependencies and runtime versions. It's a *good* thing to be forced to do that.
And additionally, he tweeted:
You should know how to use this new Lambda runtime version control for emergencies, but consider it radioactive. Use a Step Function that will automatically turn it off after 1 or 2 sprints.
Lastly, more details on runtime management controls are available on the documentation page.