Skip to content

Instantly share code, notes, and snippets.

@tecmaverick
Created August 30, 2018 02:37
Show Gist options
  • Save tecmaverick/f85b518c313cba5511b2c244ab35a34f to your computer and use it in GitHub Desktop.
Save tecmaverick/f85b518c313cba5511b2c244ab35a34f to your computer and use it in GitHub Desktop.
Search Lambda functions by name across all AWS region
#Search for lambda function by partial name across all AWS regions
#Excluding ap-northeast-3 region because of exception while calling list-functions for this region
aws ec2 describe-regions \
--query 'Regions[?RegionName!=`ap-northeast-3`].[RegionName]' \
--output text | \
xargs -I {} \
aws lambda list-functions \
--query "Functions[].[FunctionArn]" \
--output text --region {} | \
grep -i <replace_with_text_to_search>
------------------------------------------------------------------------------------------------------------
#Search for lambda function by partial name AND filter by runtime across all AWS regions
#Runtime values
# nodejs, nodejs4.3, nodejs6.10, nodejs8.10, java8, python2.7, python3.6, dotnetcore1.0, dotnetcore2.0, dotnetcore2.1, nodejs4.3-edge, go1.x
#Specify Runtime from one of the above list
runtime="python2.7"
#Searches for function name filtered by runtime
aws ec2 describe-regions \
--query 'Regions[?RegionName!=`ap-northeast-3`].[RegionName]' \
--output text | \
xargs -I {} aws lambda list-functions \
--query "Functions[?Runtime=='$runtime'].[FunctionArn]" \
--output text --region {} | grep -i <replace_with_text_to_search>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment