Please tell me how to change the Lambda runtime
The issue
I received a notification from AWS to update the Lambda runtime that I am currently using.
I want to change to a new runtime in order to update the Lambda runtime, but could you please tell me how to make this change?
The solution
You can make changes using the Lambda console and the Lambda UpdateFunctionConfiguration API.
Deploying Lambda functions as .zip file archives - AWS Lambda
If you update the function configuration to use a new runtime, you may need to update the function code to be compatible with the new runtime.
I tried it
I will try changing the runtime using the following 5 patterns.
- Lambda console
- AWS CLI
- CloudFormation
- AWS SDK for JavaScript v3
- AWS SDK for Python (Boto3)
1. Lambda console
I created a function that uses the Python 3.10 runtime for verification purposes.
I will try changing the function's runtime to Python 3.13.
Click Runtime settings > Edit.
Select "Python 3.13" from the runtime list.
Without changing any other settings, click "Save".
"Successfully updated the function function-name." is displayed at the top of the screen, and the runtime has also been changed to Python 3.13.
2. AWS CLI
To make changes with AWS CLI, use the update-function-configuration command.
When changing the runtime, use the --runtime
option.
This time, I will try changing the sample function's runtime from Python 3.10 to Python 3.13 using the following command from CloudShell.
$ aws lambda update-function-configuration \
--function-name test \
--runtime python3.13
{
"FunctionName": "test",
"FunctionArn": "arn:aws:lambda:ap-northeast-1:012345678901:function:test",
"Runtime": "python3.13",
"Role": "arn:aws:iam::012345678901:role/LambdaBasicExecutionRole",
"Handler": "lambda_function.lambda_handler",
"CodeSize": 299,
"Description": "",
"Timeout": 3,
"MemorySize": 128,
"LastModified": "2025-10-22T23:51:34.000+0000",
"CodeSha256": "HAPq9EReJVEC5gLavtc/gyd5vZtd9eiUGF932t0jBxY=",
"Version": "$LATEST",
"TracingConfig": {
"Mode": "PassThrough"
},
"RevisionId": "1e10fc2c-1bb2-4988-a963-4a66a1a46215",
"State": "Active",
"LastUpdateStatus": "InProgress",
"LastUpdateStatusReason": "The function is being created.",
"LastUpdateStatusReasonCode": "Creating",
"PackageType": "Zip",
"Architectures": [
"x86_64"
],
"EphemeralStorage": {
"Size": 512
},
"SnapStart": {
"ApplyOn": "None",
"OptimizationStatus": "Off"
},
"RuntimeVersionConfig": {
"RuntimeVersionArn": "arn:aws:lambda:ap-northeast-1::runtime:fe7a78198cc1037d599c8e576c9b94c4d6b88f8067b86f7d3481b75d9fd76c24"
},
"LoggingConfig": {
"LogFormat": "Text",
"LogGroup": "/aws/lambda/test"
}
}
The command executed successfully, and you can see from the response that the runtime has been changed to Python 3.13.
3. CloudFormation
In the case of CloudFormation, you change the Runtime of AWS::Lambda::Function.
First, I will create the pre-change Python 3.10 function using the following template.
AWSTemplateFormatVersion: "2010-09-09"
Description: "Python 3.10 Lambda Function"
Resources:
LambdaFunction:
Type: AWS::Lambda::Function
Properties:
FunctionName: test
Runtime: python3.10
Role: arn:aws:iam::012345678901:role/LambdaBasicExecutionRole
Handler: index.lambda_handler
Code:
ZipFile: |
def lambda_handler(event, context):
return {
'statusCode': 200,
'body': 'Hello from Lambda!'
}
After creating the function with CloudFormation, I will change the Runtime to python3.13 and update the stack.
AWSTemplateFormatVersion: "2010-09-09"
Description: "Python 3.13 Lambda Function"
Resources:
LambdaFunction:
Type: AWS::Lambda::Function
Properties:
FunctionName: test
Runtime: python3.13
Role: arn:aws:iam::012345678901:role/LambdaBasicExecutionRole
Handler: index.lambda_handler
Code:
ZipFile: |
def lambda_handler(event, context):
return {
'statusCode': 200,
'body': 'Hello from Lambda!'
}
I will replace and update the existing template.
The stack update is complete, please confirm that the runtime has been changed using the Lambda console or other means.
4. AWS SDK for JavaScript v3
In AWS SDK for JavaScript v3, use UpdateFunctionConfigurationCommand.
import { LambdaClient, UpdateFunctionConfigurationCommand } from "@aws-sdk/client-lambda";
const client = new LambdaClient({ region: "ap-northeast-1" });
export const handler = async (event) => {
const command = new UpdateFunctionConfigurationCommand({
FunctionName: "test",
Runtime: "python3.13",
});
const response = await client.send(command);
return {
statusCode: 200,
body: JSON.stringify({
message: "Function configuration updated",
functionName: response.FunctionName
})
};
};
5. AWS SDK for Python (Boto3)
In AWS SDK for Python (Boto3), use update_function_configuration.
import json
import boto3
client = boto3.client('lambda')
def lambda_handler(event, context):
response = client.update_function_configuration(
FunctionName='test',
Runtime='python3.13'
)
print(json.dumps(response))
return
Note
When changing the Lambda runtime, it is recommended to thoroughly verify in a development environment or similar whether there is compatibility between the new runtime and the source code before making the change.