DEV Community

Shuichi
Shuichi

Posted on • Edited on

2 2

Listing of AWS Lambda Python 2.7 functions that will be EOL(across all regions)

The official AWS blog posted An announcement titled Announcing end of support for Python 2.7 in AWS Lambda.

In the post, there is an AWS CLI command that lists Python 2.7 Lambda functions.

aws lambda list-functions --function-version ALL --output text --query "Functions[?Runtime=='python2.7'].FunctionArn"
Enter fullscreen mode Exit fullscreen mode

Across all regions

Here is a shell to run its command across all regions.

Script(list-py27functions.sh)

for region in `aws ec2 describe-regions --query "Regions[].RegionName" --region us-west-1 --output text`
do
    echo "[${region}]"
    aws lambda list-functions --region ${region} --output text --query "Functions[?Runtime=='python2.7'].{ARN:FunctionArn, Runtime:Runtime}"
done
echo "finished"
Enter fullscreen mode Exit fullscreen mode

Usage

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

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:xxxxx   python2.7
arn:aws:lambda:ap-northeast-1:111111111111:function:yyyyy   python2.7
[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:test python2.7
[us-east-2]
[us-west-1]
[us-west-2]
arn:aws:lambda:us-west-2:111111111111:function:zzzz python2.7
finished
Enter fullscreen mode Exit fullscreen mode

You can also run it from within CloudShell without specifying a profile.

Reference

Announcing end of support for Python 2.7 in AWS Lambda
AWS CLI::list-functions
AWS CLI::describe-regions
AWS CLI::Filtering

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay