DEV Community

Cover image for Listing All AWS Lambda functions with Runtime end of support(across all regions)
rotem levi # Cloud Security
rotem levi # Cloud Security

Posted on

Listing All AWS Lambda functions with Runtime end of support(across all regions)

In the post, there is an AWS CLI / AWS CloudShell command that lists all Lambda functions that have Runtime end of support.

Script:

runtimes=("dotnetcore3.1" "nodejs12.x" "dotnetcore2.1" "python3.6" "python2.7" "ruby2.5" "nodejs10.x" "nodejs8.10" "nodejs6.10" "nodejs4.3-edge" "nodejs4.3" "nodejs")
for region in `aws ec2 describe-regions --query "Regions[].RegionName" --region us-west-1 --output text`
do
    echo "[${region}]"
    for runtime in ${runtimes[@]}
    do
        aws lambda list-functions --region ${region} --output text --query "Functions[?Runtime=='${runtime}'].{ARN:FunctionArn, Runtime:Runtime}"
    done
done
Enter fullscreen mode Exit fullscreen mode

Usage AWS CLI

export AWS_PROFILE=xxxx # Not necessary if you always set the default profile.
sh ListingLambdaEOS.sh
Enter fullscreen mode Exit fullscreen mode

Usage AWS CloudShell
Just copy the Script and run in your CloudShell.

Output

[eu-north-1]
[ap-south-1]
[eu-west-3]
[eu-west-2]
[eu-west-1]
[ap-northeast-3]
[ap-northeast-2]
[ap-northeast-1]
arn:aws:lambda:ap-northeast-1:111111111111:function:bla   python2.7
arn:aws:lambda:ap-northeast-1:111111111111:function:blalba   python3.6
[ca-central-1]
[ap-east-1]
[ap-southeast-1]
[ap-southeast-2]
[eu-central-1]
[us-east-1]
arn:aws:lambda:us-east-1:111111111111:function:testx node12
[us-east-2]
[us-west-1]
[us-west-2]
arn:aws:lambda:us-west-2:111111111111:function:testz rubi
Enter fullscreen mode Exit fullscreen mode

Reference
Lambda runtimes
AWS Command Line Interface

Top comments (0)