Yes the AWS CLI allows you to check your Lambda environment variables. To automate it end to end you'll need to chain some commands together. Also, I defaulted to using jq for the heavy lifting. I'm sure there is a way to do this in JMESPath but I didn't have time to figure it out.

Here's the overview of how it works:

Get a list of Lambda function names by calling list-functions and pipe that list as text to xargs Take the output from the previous step and use it to get all the Lambda function configuration details by calling get-function-configuration . Pipe that output to jq , ensure the Environment field is not null and search for the Variable you want. In this case I'm searching for a variable called customer which has a value of shared_services . Output the Lambda function name.

The code:

aws lambda list-functions --query 'Functions[*].[FunctionName]' --output text | xargs -I {} aws lambda get-function-configuration --function-name {} | jq -r 'select((.Environment) and select(.Environment.Variables.customer == "shared_services"))| .FunctionName'

Output

copy_snaps_shared_services

snapshot_by_customer

References

JQ Manual

JQ Presence of Key before Iterating

AWS CLI Usage Examples

AWS Lambda Get Function Configuration

AWS Lambda List Functions