aws cli : Listing Lambda functions and filtering with jq

‘aws lambda list-functions’ returns function details in your current region, but the info is sometimes too verbose when you’re looking for a list of names:

{
    "Functions": [
{
    "FunctionName": "example1",
    "FunctionArn": "arn:aws:lambda:us-west-2:111111111:function:example1",
    "Runtime": "java8",
    "Role": "arn:aws:iam::111111111:role/example-role",
    "Handler": "package.YourHandler::myHandler",
    "CodeSize": 3381385,
    "Description": "",
    "Timeout": 6,
    "MemorySize": 1024,
    "LastModified": "2021-01-13T08:18:33.727+0000",
    "CodeSha256": "aaabbbccc=",
    "Version": "$LATEST",
    "TracingConfig": {
      "Mode": "PassThrough"
    },
    "RevisionId": "aa-bb-cc-dd"
  },
  {
    "FunctionName": "example2",
    "FunctionArn": "arn:aws:lambda:us-west-2:111111111:function:example2",
    "Runtime": "java8",
    "Role": "arn:aws:iam::111111111:role/example-role",
    "Handler": "package.YourHandler2::myHandler",
    "CodeSize": 3381385,
    "Description": "",
    "Timeout": 6,
    "MemorySize": 1024,
    "LastModified": "2021-01-13T08:18:33.727+0000",
    "CodeSha256": "aaabbbccc=",
    "Version": "$LATEST",
    "TracingConfig": {
      "Mode": "PassThrough"
    },
    "RevisionId": "aa-bb-cc-dd"
  }
]
}

Passing this into JQ you can filter to display any of the properties easily with patterns like:

aws lambda list-functions | jq '.Functions[].FunctionName

One Reply to “aws cli : Listing Lambda functions and filtering with jq”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.