Skip to content

AWS Lambda Python runtime 3.9 EoL

-1

Hi AWS Support Team, as AWS Lambda approaches end-of-life for the Python 3.9 runtime, we understand that:

  1. New Lambda functions using Python 3.9 cannot be created after January 15, 2026.
  2. Existing Lambda functions cannot be updated using this runtime after February 15, 2026.

In preparation for upgrading our Lambda functions to Python 3.10 or later, we would like to ensure that all necessary DevOps / SRE sanity checks and prerequisites are completed to avoid any potential breaking changes in production that could impact business operations. Could you please provide guidance on:

  • Recommended pre-upgrade validation steps
  • Known compatibility or breaking change considerations
  • Best practices for testing, rollout, and rollback during Lambda runtime upgrades

Your inputs will help us plan and execute this upgrade safely and in line with AWS best practices.

  • 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').

asked 9 months ago989 views

1 Answer
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

answered 9 months ago

EXPERT

reviewed 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.