Skip to content

How do I update my Lambda function runtime to the latest supported version?

2 minute read
3

I want to update my AWS Lambda function runtime to the latest version.

Resolution

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

Before you update your Lambda function runtime

Complete the following actions:

  • To list all the functions that use the runtime that you want to update, run the following list-functions command:
aws lambda list-functions --query "Functions[?Runtime=='python3.12'].FunctionArn"

Note: Replace python3.12 with your runtime.

  • Back up the Lambda functions that you want to update. It's a best practice to back up Lambda functions before you update them to the latest runtime version. For more information, see AWS Lambda - exporting functions.

Update the Lambda function runtime

To update the Lambda runtime, navigate to the runtime management settings and set your runtime management configuration to Auto. It's a best practice to use the auto runtime mode so that your function automatically updates to the latest runtime version. Lambda uses the two-phase runtime version rollout to introduce new runtime versions.

After you update your Lambda function runtime

Complete the following actions:

  • Verify that the existing code runs on the new runtime version. If the function causes issues on the new runtime version, then roll back to the previous runtime version. To roll back to the previous runtime version, set the runtime management configuration to Manual. Then, enter the runtime version ARN for the previous runtime version ARN and choose Save.
    Note: To find the runtime version ARN, check your function's INIT_START log entries in CloudWatch logs from previous successful invocations.

  • Verify that all the dependencies and layers in the code are compatible with the new runtime version.
    Note: The code that you update in the new runtime version must be backward compatible.

Related information

Changing the runtime

Introducing AWS Lambda runtime management controls

Understanding how Lambda manages runtime version updates

AWS OFFICIALUpdated 6 months ago
2 Comments

Recently, AWS is ending support for Python 3.9 in Lambda on December 15, 2025. Python 3.9 End-Of-Life (EOL) reached on October 30, 2025.

You can use the following script to identify these lambda functions in your account for any regions

#!/bin/bash

OLD_RUNTIME="python3.9"
NEW_RUNTIME="python3.12"

# Get a list of all enabled AWS regions
REGIONS=$(aws ec2 describe-regions --output text --query "Regions[].RegionName")

# For each region:
for REGION in $REGIONS; do
  echo "Processing region: $REGION"

  # List functions with the old runtime in the current region and extract FunctionNames
  aws lambda list-functions --region "$REGION" --output text \
    --query "Functions[?Runtime=='$OLD_RUNTIME'].FunctionName" | \
    grep -v '^$' | \
    xargs -I {} aws lambda update-function-configuration \
      --function-name {} \
      --runtime "$NEW_RUNTIME" \
      --region "$REGION"
done

echo "Upgrade process completed for all regions."

AWS

replied a year ago

This article was reviewed and updated on 2026-04-08.

AWS
EXPERT

replied 5 months ago