1 Answer
- Newest
- Most votes
- Most comments
0
When preparing to upgrade your Lambda functions from Python 3.9 to a newer runtime version, following a structured approach will help ensure a smooth transition. Here are recommendations to help you plan and execute this upgrade safely:
Pre-upgrade Validation Steps:
- Test the upgrade script or process in a non-production environment first
- Review your Lambda functions for Python version-specific code that might behave differently in newer versions
- Back up your Lambda function configurations before making any changes
- Create an inventory of all your Python 3.9 functions across accounts and regions
Compatibility and Breaking Change Considerations:
- After Python 3.9 is deprecated, AWS will no longer provide security updates, technical support, or hotfixes
- Functions using deprecated runtimes may experience degraded performance or issues like certificate expiry
- Deprecated runtimes are provided 'as-is' without warranties and may contain vulnerabilities
Best Practices for Testing, Rollout, and Rollback:
- Implement the upgrade in phases to minimize potential disruptions
- Use function versions and aliases to enable safe deployment with rollback capability
- Consider a tiered upgrade schedule based on function criticality:
- Critical functions: Plan 6-month migration cycles with extensive testing
- Important functions: Align with quarterly release cycles
- Non-critical functions: Upgrade within 30 days of availability
- Verify function behavior after the upgrade to ensure everything works as expected
- Maintain a detailed upgrade calendar and actively monitor AWS deprecation announcements
By following these recommendations, you can ensure a safe transition from Python 3.9 to newer supported runtimes while minimizing risks to your production environment.
Sources
Automated Migration Script for AWS Lambda Python 3.9 End-of-Support | AWS re:Post
Lambda runtimes - AWS Lambda
Managing runtime updates at scale for Lambda | AWS re:Post
Relevant content
asked 2 years ago
asked 3 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 4 years ago

Worth clearing up the dates first, because they've moved and most blog posts are stale: python3.9 was deprecated on 2025-12-15 (no more security patches). AWS originally set the create/update block dates for early 2026, then delayed them — per the current AWS Lambda runtime deprecation table the block-create date is 2027-02-01 and block-update is 2027-03-03. Since AWS has moved these before, treat that table as the source of truth — but either way it's already unpatched, so migrate now.
Target is python3.12 (3.13 is available). The notable breakages on 3.9 → 3.12: - distutils and imp are removed (ModuleNotFoundError) — use setuptools / importlib. - collections.Mapping etc. moved to collections.abc. - Native wheels: anything with C extensions needs a cp312 wheel built for Amazon Linux 2023 (glibc), or you get an import error at cold start. - datetime.utcnow() is deprecated.
Find every function on 3.9 across regions (Trusted Advisor's "Lambda Functions Using Deprecated Runtimes" check, or aws lambda list-functions --query "Functions[?Runtime=='python3.9']"), fix the code, then update the runtime with a canary + a CloudWatch alarm to auto-rollback.
I maintain a free, open-source CLI + browser checker that scans for exactly these and codemods the mechanical parts: https://eolkits.com/scan/ . (Disclosure: I built it — MIT.) There are also fix pages for the specific errors (e.g. No module named 'distutils').