Archive
How to Check All AWS Regions for Deprecated Python 3.9 Lambda Functions (PowerShell Guide)

If you’ve received an email from AWS notifying you that Python 3.9 is being deprecated for AWS Lambda, you’re not alone. As runtimes reach End-Of-Life, AWS sends warnings so you can update your Lambda functions before support officially ends.
The key question is:
How do you quickly check every AWS region to see where you’re still using Python 3.9?
AWS only gives you a single-region example in their email, but many teams have functions deployed globally. Fortunately, you can automate a full multi-region check using a simple PowerShell script.
This post shows you exactly how to do that.
🚨 Why You Received the Email
AWS is ending support for Python 3.9 in AWS Lambda.
After the deprecation dates:
- No more security patches
- No AWS technical support
- You won’t be able to create/update functions using Python 3.9
- Your functions will still run, but on an unsupported runtime
To avoid risk, you should upgrade these functions to Python 3.10, 3.11, or 3.12.
But first, you need to find all the functions using Python 3.9 — across all regions.
✔️ Prerequisites
Make sure you have:
- AWS CLI installed
- AWS credentials configured (via
aws configure) - Permissions to run:
lambda:ListFunctionsec2:DescribeRegions
🧪 Step 1 — Verify AWS CLI Access
Run this to confirm your CLI is working:
aws sts get-caller-identity --region eu-west-1
If it returns your AWS ARN, you’re good to go.
If you see “You must specify a region”, set a default region:
aws configure set region eu-west-1
📝 Step 2 — PowerShell Script to Check Python 3.9 in All Regions
Save this as aws-lambda-python39-check.ps1 (or any name you prefer):
# Get all AWS regions (forcing region so the call always works)
$regions = (aws ec2 describe-regions --region us-east-1 --query "Regions[].RegionName" --output text) -split "\s+"
foreach ($region in $regions) {
Write-Host "Checking region: $region ..."
$functions = aws lambda list-functions `
--region $region `
--query "Functions[?Runtime=='python3.9'].FunctionArn" `
--output text
if ($functions) {
Write-Host " → Found Python 3.9 functions:"
Write-Host " $functions"
} else {
Write-Host " → No Python 3.9 functions found."
}
}
This script does three things:
- Retrieves all AWS regions
- Loops through each region
- Prints any Lambda functions that still use Python 3.9
It handles the common AWS CLI error:
You must specify a region
by explicitly using --region us-east-1 when retrieving the region list.
▶️ Step 3 — Run the Script
Open PowerShell in the folder where your script is saved:
.\aws-lambda-python39-check.ps1
You’ll see output like:
Checking region: eu-west-1 ...
→ Found Python 3.9 functions:
arn:aws:lambda:eu-west-1:123456789012:function:my-old-function
Checking region: us-east-1 ...
→ No Python 3.9 functions found.
If no functions appear, you’re fully compliant.
🛠️ What to Do Next
For each function identified, update the runtime:
aws lambda update-function-configuration `
--function-name MyFunction `
--runtime python3.12
If you package dependencies manually (ZIP deployments), ensure you rebuild them using the new Python version.
🎉 Summary
AWS’s deprecation emails can be slightly alarming, but the fix is simple:
- Scan all regions
- Identify Python 3.9 Lambda functions
- Upgrade them in advance of the cutoff date
With the PowerShell script above, you can audit your entire AWS account in seconds.