AWS Lambda Function Bookmarks Exporter

3 minute read Published: 2024-11-27

Managing and navigating AWS Lambda functions can be a challenging task, especially if your environment has many functions spread across different projects. To make this easier, I created a bash script that allows you to search for Lambda functions by name and export them as HTML bookmarks. This way, you can have all the necessary links in one place for easy access.

The script not only provides a link to the Lambda function itself but also links to the corresponding CloudWatch Logs, making it easy to investigate and debug any issues. The generated HTML file is compatible with most browsers, allowing you to easily import the bookmarks.

Script

Detailed Explanation

The script starts by checking if the necessary dependencies are installed (AWS CLI and jq). It then takes a search term as input and lists all Lambda functions whose names contain the search term. For each matching function, it generates two bookmarks: one for accessing the Lambda function in the AWS console and another for viewing its CloudWatch logs.

These bookmarks are saved in an HTML file, which follows the Netscape Bookmark File format. This format is widely supported by modern browsers, allowing you to easily import the bookmarks.

The script also includes helpful error messages for missing dependencies or incorrect usage, making it beginner-friendly.

Usage

Here are some practical ways you can use this script:

  1. Running the Script: To run the script, provide a search term that matches the name of the Lambda functions you want to find. For example:
    bash search_lambda_functions.sh my-search-term
    
  2. AWS CLI and jq: Make sure you have both the AWS CLI and jq installed and properly configured. The AWS CLI must have sufficient permissions to list Lambda functions.
  3. Importing Bookmarks: Once the script has run, it will generate an HTML file containing the bookmarks. You can import this file into your browser to quickly navigate to the Lambda functions and their logs.