Automate updating Lambda runtimes at scale with safety features.
pip install -r requirements.txtEnsure AWS credentials are configured:
aws configure
# or use environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEYpython update_lambda_runtimes.py \
--old-runtime python3.8 \
--new-runtime python3.11 \
--dry-runpython update_lambda_runtimes.py \
--old-runtime python3.8 \
--new-runtime python3.11 \
--region us-east-1python update_lambda_runtimes.py \
--old-runtime python3.8 \
--new-runtime python3.11 \
--region us-west-2 \
--batch-size 20 \
--delay 1.0--old-runtime: Current runtime to find (required)--new-runtime: Target runtime to update to (required)--region: AWS region (default: us-east-1)--dry-run: Preview without making changes--batch-size: Concurrent updates (default: 10)--delay: Delay between updates in seconds (default: 0.5)
- Python: python3.8, python3.9, python3.10, python3.11, python3.12
- Node.js: nodejs16.x, nodejs18.x, nodejs20.x
- Java: java11, java17, java21
- .NET: dotnet6, dotnet8
- Ruby: ruby3.2, ruby3.3
- Go: provided.al2, provided.al2023
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"lambda:ListFunctions",
"lambda:UpdateFunctionConfiguration"
],
"Resource": "*"
}
]
}- Always run with --dry-run first
- Test on non-production environments first
- Update in batches during low-traffic periods
- Monitor CloudWatch Logs after updates
- Have a rollback plan ready