-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A Python Lambda runtime version #13733
Comments
Hey @imortkz, thank you for reaching, marking this as feature-request to upgrade the default python runtime. amplify-cli/packages/amplify-python-function-runtime-provider/src/util/buildUtils.ts Line 10 in 6340adb
you should be able to update the runtime in the CloudFormation template and pip file present in the function to 3.10, then run |
It's supposed to work for new function only? Tried that with already deployed Python lambda function, didn't work:
I guess the problem is that virtualenv was already built for Python 3.8 Can you please recommend steps to migrate function from 3.8 to 3.10 properly? |
@imortkz the information is currently documented here: https://docs.amplify.aws/react/build-a-backend/functions/configure-options/#updating-the-runtime |
@ykethan I am having the same issue, updating the runtime in the cloudformation template json does not appear to be sufficient for python. Can you point us to a guide specifically for python (and not node)? |
+1. Just want to emphasize these dates for the amplify team: Starting February 28, 2025, you will no longer be able to create new Lambda functions using the Python 3.8 runtime. Starting March 31, 2025, you will no longer be able to update existing functions using the Python 3.8 runtime. |
Struggled with this for a while, but I was able to successfully upgrade an existing 3.8 function to 3.11 AND build it using Steps:
"Resources": {
"LambdaFunction": {
...
"Properties": {
"Runtime": "python3.11",
"Layers": [],
}
...
}
}
[requires]
python_version = "3.11"
version: 1
backend:
phases:
build:
commands:
# install python3.11
# https://plainenglish.io/community/how-to-install-python-3-11-with-pip-on-amazon-linux-2023-9ab2ed
- sudo dnf install python3.11 -y
- sudo dnf install python3.11-pip -y
# install pipenv directly into 3.11
- pip3.11 install --user pipenv
# update path
# https://medium.com/@miramnair/aws-amplify-building-a-bedrock-powered-ai-model-with-python-based-lambda-function-556d501f1e5f
- export PATH=$PATH:/root/.local/bin
# update python3.11 symlinks
# it is not recommended to overwrite the python3 symlink, but it's been working so far, so whatever
# https://docs.aws.amazon.com/linux/al2023/ug/python.html
- ln -fs /usr/bin/python3.11 /usr/bin/python3
- ln -fs /usr/bin/pip3.11 /usr/bin/pip3
- amplifyPush --simple
Pushing all those changes FINALLY resulted in a successful build, and the lambdas deployed to the new python 3.11 runtime 😃 |
Amplify CLI Version
12.11.1
Question
The latest Amplify version still generates v3.8 Python runtime, while it will be EOL soon:
I can manually update the CloudFormation for lambda function to use v3.10 runtime, but it still will create a v3.8 venv.
Is there any plans to upgrade a default Python runtime?
The text was updated successfully, but these errors were encountered: