How do I plan for and migrate my AWS Lambda function when a runtime is deprecated or reaches end of support?
This article helps AWS customers who received a Lambda runtime deprecation or end-of-support notification. It explains what deprecation means for existing functions, how to find all affected functions across accounts and regions using AWS Health Dashboard, Trusted Advisor, AWS CLI, and AWS Config, and provides a step-by-step migration workflow. It covers identifying breaking changes per language (Python, Node.js, Java, .NET), rebuilding Lambda Layers for new OS versions, safe testing strategies.
Issue statement
I received a notification that my AWS Lambda function runtime is deprecated or approaching end of support. I want to understand what this means for my existing functions, find all affected functions in my account, and safely migrate them to a supported runtime.
Short description
When AWS Lambda deprecates a runtime, your existing functions continue to invoke but you lose the ability to create or update functions using that runtime. After end of support, the runtime receives no security patches. This article explains the Lambda runtime deprecation lifecycle, helps you identify affected functions, walks you through testing and migrating to a supported runtime, and covers common issues including Lambda Layer compatibility, operating system changes, and SDK changes.
Resolution
Step 1: Understand the Lambda runtime deprecation lifecycle
Lambda runtime deprecation happens in three phases. Understanding these phases helps you plan your migration timeline.
Phase 1 — Deprecation (Create blocked)
- You can no longer create new functions using the deprecated runtime.
- Existing functions continue to run normally — they are NOT stopped.
- You can still update existing function code and configuration.
- You receive AWS Health Dashboard notifications and emails about the upcoming end-of-support date.
Phase 2 — End of Support (Update blocked)
- You can no longer create or update functions using this runtime.
- Existing functions still continue to invoke — they are NOT stopped.
- AWS no longer applies security patches to this runtime.
- You cannot change function code, environment variables, memory, timeout, or any other configuration.
Phase 3 — Post End of Support (Functions still invoke, but unpatched)
- Your functions still invoke and process events — Lambda does NOT disable them.
- The runtime receives no security patches, bug fixes, or technical support.
- Your functions may be exposed to known vulnerabilities (CVEs).
- You are responsible for any security risks from running on an unsupported runtime.
Note: "Deprecated" does NOT mean your function will stop working. Your function continues to invoke even after end of support. However, you should migrate as soon as possible because you cannot deploy code fixes or configuration changes after end of support, your function runs on an unpatched runtime with potential security vulnerabilities, and if an incident occurs you cannot update the function to resolve it. To check the current deprecation schedule for all runtimes, see Lambda runtime support policy.
Step 2: Find all functions on deprecated or soon-to-be-deprecated runtimes
Use one or more of the following methods to identify affected functions in your account.
Method A: AWS Health Dashboard (recommended)
- Open the AWS Health Dashboard console.
- In the left navigation, choose Event log.
- Filter by AWS Lambda service.
- Look for events related to Lambda runtime deprecation.
- The event details list the specific functions and runtimes affected.
Note: To receive proactive email notifications, configure Amazon EventBridge rules for AWS Health events filtered to Lambda deprecation events, and route them to an Amazon SNS topic.
Method B: AWS Trusted Advisor
- Open the AWS Trusted Advisor console.
- Navigate to the Security category.
- Look for the check: AWS Lambda Functions Using Deprecated Runtimes.
- This check lists all functions in your account using deprecated or soon-to-be-deprecated runtimes.
Note: This check is available with AWS Business, Enterprise On-Ramp, or Enterprise Support plans. For more information about support plans, see Compare AWS Support plans.
Method C: AWS CLI — Scan all functions in a single region
Run the following command to list all functions using a specific runtime (for example, python3.8):
aws lambda list-functions \ --function-version ALL \ --query "Functions[?Runtime=='python3.8'].[FunctionName, Runtime, LastModified]" \ --output table
To check for multiple deprecated runtimes at once:
aws lambda list-functions \ --function-version ALL \ --query "Functions[?Runtime=='python3.8' || Runtime=='nodejs16.x' || Runtime=='dotnet6'].[FunctionName, Runtime, LastModified]" \ --output table
Method D: AWS CLI — Scan all functions across ALL regions
for region in $(aws ec2 describe-regions --query "Regions[].RegionName" --output text); do echo "=== Region: $region ===" aws lambda list-functions \ --region "$region" \ --function-version ALL \ --query "Functions[?Runtime=='python3.8' || Runtime=='nodejs16.x' || Runtime=='dotnet6'].[FunctionName, Runtime]" \ --output table 2>/dev/null done
Method E: AWS Config rule
- Open the AWS Config console.
- Choose Rules, then Add rule.
- Search for lambda-function-settings-check.
- In the rule parameters, set the runtime parameter to a comma-separated list of approved runtimes (for example,
python3.12,python3.13,nodejs20.x,nodejs22.x). - Any function NOT using an approved runtime is flagged as noncompliant.
Step 3: Identify breaking changes for your runtime before migrating
Before changing the runtime, you must identify the breaking changes that affect your specific function code. Changing the runtime without addressing these can cause your function to fail.
Note: The breaking changes between runtime versions vary significantly depending on the packages and language features your code uses. This section describes how to identify breaking changes for your function. Do NOT rely solely on the common examples below — always consult the official upstream migration guides for the complete list of changes relevant to your code.
How to identify breaking changes in your code
- Review the official upstream "What's New" or "Migration Guide" documentation for every major version between your current runtime and target runtime (links provided below).
- Run your code locally with the new runtime version and fix any errors or deprecation warnings.
- For Python, run
python -W all your_script.pyto surface all deprecation warnings before deploying. - For Node.js, check if your code uses
require('aws-sdk')— this is the most common failure when migrating from Node.js 16 to 18+, because AWS SDK v2 is no longer bundled in the runtime. - For Java, check for reflective access to internal JDK classes and usage of removed Java EE modules (JAXB, JAX-WS).
- For .NET, test JSON serialization/deserialization thoroughly as System.Text.Json defaults changed.
Common breaking changes (not exhaustive)
The following are some of the most commonly encountered breaking changes during Lambda runtime migrations. This is NOT a comprehensive list — different functions use different packages, and any of those packages may have their own breaking changes between versions.
- Python 3.8 → 3.12/3.13:
distutilsmodule removed (usesetuptools);impmodule removed (useimportlib);collections.Mappingaliases removed (usecollections.abc.Mapping). - Node.js 16 → 18/20/22: AWS SDK v2 no longer bundled (must bundle SDK v2 or migrate to SDK v3
@aws-sdk/client-*packages); OpenSSL upgraded from 1.1.1 to 3.0 (legacy crypto algorithms disabled). - Java 8 (AL1) → Java 17/21: Module system restricts reflective access; Java EE modules (JAXB, JAX-WS) removed from JDK; OS changes from Amazon Linux 1 to Amazon Linux 2/2023.
- .NET 6 → .NET 8: System.Text.Json serialization behavior changes; trimming behavior changes.
Official migration guides (consult these for the complete list of changes)
- Python: What's New in Python 3.12, What's New in Python 3.13
- Node.js: Node.js 18 Changelog, Node.js 20 Changelog, Migrating to AWS SDK for JavaScript v3
- Java: Oracle JDK Migration Guide
- .NET: Microsoft .NET 8 breaking changes
Step 4: Update and rebuild Lambda Layers
If your function uses Lambda Layers, you must verify and potentially rebuild them for the new runtime. This is the most commonly missed step during migration.
Why Layers can break
- Layers containing native binaries (C extensions, shared libraries) compiled on Amazon Linux 1 (AL1) may not work on Amazon Linux 2 (AL2) or Amazon Linux 2023 (AL2023). This is especially relevant for Java 8 (AL1) → Java 17 (AL2) or Java 21 (AL2023) migrations.
- Layers with Python packages that include compiled C extensions (for example, numpy, pandas, Pillow, cryptography) must be rebuilt for the target OS and Python version.
- Layers with Node.js native addons (
.nodefiles) must be recompiled for the target Node.js version.
How to update Layers
- Identify all Layers attached to your function:
aws lambda get-function-configuration \ --function-name my-function \ --query "Layers[].Arn"
- Rebuild the Layer using a Docker container that matches the target runtime environment:
# Example for Python — rebuild using the SAM build image for the target runtime docker run --rm -v $(pwd):/var/task public.ecr.aws/sam/build-python3.12 \ pip install -r requirements.txt -t python/ # Package and publish the new Layer version zip -r layer.zip python/ aws lambda publish-layer-version \ --layer-name my-layer \ --zip-file fileb://layer.zip \ --compatible-runtimes python3.12 python3.13
- Update your function to use the new Layer version:
aws lambda update-function-configuration \ --function-name my-function \ --layers arn:aws:lambda:us-east-1:123456789012:layer:my-layer:2
Note: Always test the new Layer version with your function code before deploying to production. For detailed steps on rebuilding Lambda Layers using Docker, see How do I create a Lambda layer using a simulated Lambda environment with Docker?
Step 5: Test your function on the new runtime before switching production
Do NOT change the runtime directly in production. Use one of these safe testing strategies.
Note: If your function does not have automated tests, consider writing basic integration tests BEFORE starting the migration. At minimum, capture the current function's input/output pairs to use as regression tests.
Option A: Test with a function alias (recommended)
- Update the runtime on your function. You can do this through the Lambda console (Code tab → Runtime settings → Edit) or using the AWS CLI:
aws lambda update-function-configuration \ --function-name my-function \ --runtime python3.12
- Publish a new version:
aws lambda publish-version \ --function-name my-function \ --description "Testing python3.12 runtime"
- Create a test alias pointing to the new version:
aws lambda create-alias \ --function-name my-function \ --name test-runtime \ --function-version 2
- Route test traffic to the alias and validate behavior.
- If tests pass, update your production alias to the new version.
- If tests fail, revert the alias to the previous version:
aws lambda update-alias \ --function-name my-function \ --name production \ --function-version 1
For more information on configuring function runtime through the console and CLI, see Configuring Lambda function options.
Option B: Canary deployment with weighted alias
Run the following command to route 10% of traffic to the new runtime version. This routes 10% of traffic to version 2 (new runtime) and 90% to version 1 (old runtime). Monitor CloudWatch metrics for errors, then gradually increase the weight.
aws lambda update-alias \ --function-name my-function \ --name production \ --function-version 1 \ --routing-config AdditionalVersionWeights={"2"=0.1}
What to validate during testing
- Confirm the function completes without errors (check CloudWatch Logs for Lambda for exceptions).
- Verify the response payload matches expected output.
- Check execution duration is within acceptable range (compare p50/p99 with previous runtime using Lambda CloudWatch metrics).
- Verify memory usage is within limits (check Max Memory Used in the
REPORTlog line). - Confirm all downstream service calls succeed (DynamoDB, S3, SQS, external APIs).
- Verify Lambda Layers load correctly (no import errors or missing module errors).
Post-migration monitoring
After switching production traffic to the new runtime, monitor your function closely for 24–72 hours.
- Set up a CloudWatch Alarm on the Errors metric to alert you immediately if the new runtime causes failures:
aws cloudwatch put-metric-alarm \ --alarm-name "my-function-runtime-migration-errors" \ --metric-name Errors \ --namespace AWS/Lambda \ --statistic Sum \ --period 300 \ --threshold 1 \ --comparison-operator GreaterThanOrEqualToThreshold \ --evaluation-periods 1 \ --dimensions Name=FunctionName,Value=my-function \ --alarm-actions arn:aws:sns:us-east-1:123456789012:my-alerts
-
Compare key metrics before and after migration:
- Duration (p50 and p99) — significant increases may indicate compatibility issues.
- Errors — any new errors likely indicate breaking changes.
- Throttles — unexpected throttling may indicate cold start duration increases.
- ConcurrentExecutions — higher concurrency may indicate slower execution.
-
Check CloudWatch Logs for new warnings or deprecation messages that were not present before.
-
If issues are detected, immediately revert using your alias:
aws lambda update-alias \ --function-name my-function \ --name production \ --function-version 1
Step 6: Update Infrastructure as Code (IaC) templates
If you manage your Lambda functions with IaC (CloudFormation, SAM, CDK, or Terraform), update the runtime property in your templates to match the new runtime. This prevents deployment failures on your next stack update.
Note: When updating CloudFormation stacks with deprecated runtimes, update ONLY the Lambda runtime property in the first deployment. Do not change other resources simultaneously, as a failed update could trigger a rollback that attempts to restore the deprecated runtime — which will also fail. For more details, see How should I Create/Update Deprecated Runtime in AWS Lambda functions using CloudFormation. For organizations managing large fleets of functions, consider using AWS Transform custom to automate runtime upgrades at scale.
Step 7: Respond to Lambda security vulnerability notifications
If you receive a security notification (CVE alert) about your Lambda runtime, take the following actions.
For functions on supported runtimes
If your runtime management mode is set to Auto (the default), Lambda automatically applies security patches. No action is needed. If you use Manual mode, update to the latest runtime version ARN or switch to Auto mode. Check your current mode:
aws lambda get-function-configuration \ --function-name my-function \ --query "RuntimeVersionConfig.RuntimeVersionArn"
Note: Your function is not immediately compromised when you receive a CVE notification. The notification means a known vulnerability exists in the runtime version your function uses. After end of support, AWS no longer patches the Lambda runtime — new CVEs will NOT be fixed. The permanent fix is to migrate to a supported runtime.
For functions on deprecated or end-of-life runtimes
The only fix is to migrate to a supported runtime (follow the steps above). Prioritize migration based on risk:
- Migrate internet-facing functions first.
- Then migrate functions processing sensitive data.
- Then migrate internal functions.
Step 8: Set up proactive monitoring for future deprecations
To avoid being caught off guard by future deprecation cycles, set up these monitoring mechanisms.
Create an EventBridge rule for AWS Health notifications
Use the following event pattern to create an EventBridge rule that routes Lambda deprecation notifications to an Amazon SNS topic:
{ "source": ["aws.health"], "detail-type": ["AWS Health Event"], "detail": { "service": ["LAMBDA"], "eventTypeCategory": ["scheduledChange"] } }
Route this rule to an SNS topic to receive email or chat notifications when Lambda announces runtime deprecations.
Deploy an AWS Config rule for continuous compliance
Deploy the lambda-function-settings-check rule (see Step 2, Method E) to continuously flag any function that uses a non-approved runtime. This provides ongoing visibility into your compliance posture without requiring manual checks.
Related information
- Lambda runtimes
- Configuring Lambda function options
- Understanding how Lambda manages runtime version updates
- Lambda CloudWatch metrics
- Accessing Lambda CloudWatch Logs
- Migrating to AWS SDK for JavaScript v3
- How do I create a Lambda layer using a simulated Lambda environment with Docker?
- How should I Create/Update Deprecated Runtime in AWS Lambda functions using CloudFormation
- Managing AWS Lambda runtime upgrades (AWS Compute Blog)
- Upgrading Lambda function runtimes at scale with AWS Transform custom
- AWS Transform custom — Automate code transformations at scale
- Lambda SnapStart for Java
- .NET Native AOT compilation for Lambda
- What's New in Python 3.12
- What's New in Python 3.13
- Oracle JDK Migration Guide
- Microsoft .NET 8 breaking changes
- Compare AWS Support plans
- Language
- English
Nice article
replied a month ago
Relevant content
AWS OFFICIALUpdated a year agoasked 5 years ago
asked 5 years ago