Jonathan Moo
Jonathan Moo

Reputation: 3267

How To Filter Out Lambdas with the AWS Cli with tags?

So I know I can grab all lambda functions via this command in text/csv form:

aws lambda list-functions --region us-east-1 --query 'Functions[].FunctionName' --output text

But I want to list all the functions with their relevant tags associated with the lambda. How do I do it? I want to output all of them into a CSV/text form, such as:

Name Tag_1 Tag2    
{lambda_name} {tag_1} {tag_2}

Upvotes: 2

Views: 3290

Answers (2)

Balu Vyamajala
Balu Vyamajala

Reputation: 10333

We can combine list-functions and list-tags

An example:

aws lambda list-functions | jq -r ".Functions[].FunctionArn" | xargs -I {} aws lambda list-tags --resource {} --query '{"{}":Tags}'

Upvotes: 4

Robert Kossendey
Robert Kossendey

Reputation: 6998

You would first of all need to call aws lambda list-functions, then save the results, and then call aws lambda list-tags --resource 'YourLambda' for all of your retrieved functions. Unfortunately there is no other way currently.

Upvotes: 1

Related Questions