Skip to content

benbpyle/lambdalens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Lambda Lens

AWS Lambda Rust 1.70+ License Release

A blazingly fast terminal user interface (TUI) for exploring and managing AWS Lambda functions. Built with Rust, inspired by k9s for Kubernetes and ecs-voyager for ECS.

Why Lambda Lens? The AWS Console is slow and requires multiple clicks to navigate. Lambda Lens gives you instant visibility into your Lambda functions, logs, metrics, and configurationsβ€”all from your terminal with vim-style keybindings.

✨ Features

πŸš€ Core Functionality

  • Lightning-Fast Navigation - Browse hundreds of Lambda functions with instant keyboard navigation (↑↓/jk)
  • Real-Time Monitoring - Auto-refresh with configurable intervals (default: 30s) to keep data current
  • Function Details - Comprehensive configuration display with formatted/JSON toggle ('J' key)
  • Direct AWS SDK Integration - No AWS CLI required; uses AWS SDK for Rust directly
  • Multi-Profile & Multi-Region - Switch between AWS profiles ('P') and regions ('R') on-the-fly
  • HUD Display - Quick-view selected function details (name, runtime, memory, timeout, code size, last modified)

πŸ” Search & Filtering

  • Live Search - Instant case-insensitive function name filtering (press '/')
  • Regex Support - Toggle between literal and regex pattern matching ('M' key)
  • Runtime Filters - Filter by runtime with 'F' key:
    • All (default)
    • Python (all versions)
    • Node.js (all versions)
    • Go
    • Java
    • .NET
    • Ruby
    • Custom Runtime (provided.al2, provided.al2023)
  • Combined Filters - Stack search queries with runtime filters for precise results
  • Clear Filters - Press 'C' to reset all active filters
  • Filter Status Display - Active filters shown in status bar

πŸ“Š CloudWatch Metrics Dashboard

  • Time Range Selection - View metrics for 1h / 6h / 24h / 7d (cycle with 'T' key)
  • Key Performance Metrics:
    • Total invocations
    • Error count and error rate percentage (color-coded: red >5%, yellow >1%)
    • Throttle count and throttle rate percentage
    • Average/Max/Min duration (ms)
    • Max concurrent executions
  • ASCII Charts - Visual time-series data for:
    • Invocations over time
    • Errors over time
    • Duration over time
    • Throttles over time
  • Real-Time Refresh - Press 'r' to fetch latest metrics from CloudWatch
  • Smart Data Display - Only shows relevant charts (e.g., error chart only appears if errors > 0)

πŸ“ CloudWatch Logs Viewer

  • Structured Log Display - Formatted log entries with timestamps (local time)
  • Auto-Tail Mode - Continuously stream new logs (toggle with 't' key)
  • Intelligent Log Parsing:
    • Request ID extraction and highlighting (bold cyan)
    • Log level detection (START, END, REPORT, ERROR, WARN, INFO, DEBUG)
    • Color-coded severity (green=START/END, cyan=REPORT, red=ERROR, yellow=WARN)
    • REPORT line metrics parsing (duration, billed duration, memory used with %, cold start detection)
  • Scroll Navigation - Use j/k to navigate through log history
  • Multi-Stream Support - Automatically fetches from the most recent log stream

πŸ”§ Function Configuration

  • Comprehensive Details View - All function configuration in one place:
    • Basic Info: Name, ARN, Runtime, Handler, Description
    • Resources: Memory size, Timeout, Code size, Architecture (x86_64/arm64)
    • State & Status: Active/Failed/Pending with color coding, last update status
    • Package Type: Zip or Image (with image URI for containers)
    • Concurrency: Reserved concurrent executions
    • Dead Letter Queue: Target ARN (SQS/SNS) if configured
    • Ephemeral Storage: /tmp directory size (default: 512 MB)
    • Environment Variables: Key-value pairs
    • VPC Configuration: VPC ID, Subnets, Security Groups
    • Layers: Layer ARNs with size
    • File Systems: EFS mount configurations
    • Tracing: X-Ray mode
    • Tags: All resource tags for organization
  • JSON Toggle - Press 'J' to switch between formatted and raw JSON view
  • Scrollable Content - Navigate through large configurations with j/k

πŸ”— Event Source Mappings / Triggers

  • Trigger Listing - View all event sources for a function (press 'e')
  • Supported Sources: SQS, DynamoDB Streams, Kinesis, MSK (Kafka), Amazon MQ
  • Trigger Details:
    • Source type auto-detection from ARN
    • State (Enabled/Disabled/Creating/Updating/Deleting) with color coding
    • Batch size and batch window
    • Starting position (TRIM_HORIZON/LATEST for streams)
    • Parallelization factor (Kinesis)
    • Last modified timestamp
    • Last processing result (success/failure with color coding)
    • Function response types (ReportBatchItemFailures support)
  • Scrollable View - Handle functions with many triggers

🎨 User Experience

  • Beautiful Interface - Clean, intuitive TUI with consistent color scheme:
    • Cyan highlights for selected items
    • Yellow for headers and warnings
    • Red for errors
    • Green for success states
    • Gray for dimmed/inactive items
  • Loading Indicators - Clear feedback during operations ("[Loading...]" in status bar)
  • Status Messages - Real-time operation feedback in footer
  • Error Display - Prominent error messages with "ERROR:" prefix in red
  • Breadcrumb Navigation - Always know where you are (Functions > Details > Logs)
  • Context-Aware Help - Press '?' for keybindings reference
  • Terminal Validation - Minimum size check (80x24) with clear error messages
  • Responsive Layout - Adapts to terminal size

βš™οΈ Configuration

  • TOML Config File - Store preferences at ~/.lambdalens/config.toml
  • Auto-Creation - Default config generated on first run
  • Configurable Settings:
    • Default AWS region
    • Default AWS profile
    • Auto-refresh enabled/disabled
    • Refresh interval (seconds)
    • Default view on startup
    • Color theme (for future use)
  • Standard Credential Chain - AWS credentials from:
    1. Environment variables
    2. Config file settings
    3. ~/.aws/credentials
    4. IAM role (EC2/ECS/Lambda)

πŸ“¦ Installation

Homebrew (macOS and Linux)

# Add the tap
brew tap benbpyle/lambdalens

# Install Lambda Lens
brew install lambdalens

# Verify installation
lambdalens --version

Download Pre-Built Binaries

Download the latest release for your platform from the releases page:

  • macOS:
    • Apple Silicon (M1/M2/M3): lambdalens-vX.X.X-aarch64-apple-darwin.tar.gz
    • Intel: lambdalens-vX.X.X-x86_64-apple-darwin.tar.gz
  • Linux:
    • ARM64: lambdalens-vX.X.X-aarch64-unknown-linux-gnu.tar.gz
    • x86_64: lambdalens-vX.X.X-x86_64-unknown-linux-gnu.tar.gz
    • Debian/Ubuntu: lambdalens_X.X.X_amd64.deb
    • RHEL/Fedora/CentOS: lambdalens-X.X.X-1.x86_64.rpm
  • Windows:
    • lambdalens-vX.X.X-x86_64-pc-windows-msvc.zip

Extract and move to your PATH:

tar -xzf lambdalens-*.tar.gz
sudo mv lambdalens /usr/local/bin/

Build from Source

Requirements:

  • Rust 1.70+ (Install Rust)
  • Valid AWS credentials configured
git clone https://github.com/benbpyle/lambdalens.git
cd lambdalens
cargo build --release

The binary will be at target/release/lambdalens

Install locally:

cargo install --path .

πŸš€ Quick Start

1. Ensure AWS Credentials are Configured

Lambda Lens uses the standard AWS credential chain. Configure your credentials:

# Option 1: Environment variables
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_REGION="us-east-1"

# Option 2: AWS credentials file
aws configure

2. Launch Lambda Lens

lambdalens

The application will:

  1. Load AWS credentials
  2. Fetch Lambda functions from the current region
  3. Display the Functions view

3. Navigate and Explore

  • Use ↑/↓ or j/k to navigate functions
  • Press Enter to view function details
  • Press l to view CloudWatch logs
  • Press m to view metrics dashboard
  • Press e to view event source mappings
  • Press ? for help

⌨️ Keybindings

Navigation

Key Action
↑ / k Move up
↓ / j Move down
Enter Select item / View details
Esc / h Go back to previous view

Views

Key Action
1 Functions view
d Function details
l CloudWatch logs
e Event source mappings / Triggers
m CloudWatch metrics dashboard

Actions

Key Action
r Refresh current view
P Switch AWS profile
R Switch AWS region
J Toggle JSON view (Details)
t Toggle log auto-tail (Logs)
T Cycle time range (Metrics: 1h β†’ 6h β†’ 24h β†’ 7d)
? Toggle help screen
q Quit application

Search & Filters

Key Action
/ Enter search mode
M Toggle regex mode
F Cycle runtime filter
C Clear all filters
Esc Clear search / Exit search mode

πŸ“ Workflow Examples

Find and Debug a Failing Function

1. Start Lambda Lens
2. Press '/' and type "api" to filter functions
3. Press 'F' to filter by runtime (e.g., Python)
4. Select function with Enter
5. Press 'm' to view metrics - see error rate is 15%
6. Press Esc, then 'l' to view logs
7. Scan for ERROR lines (in red)
8. Identify the issue from stack trace

Monitor Function Performance

1. Navigate to function
2. Press 'm' for metrics dashboard
3. Review current time range (default: 1h)
4. Press 'T' to cycle to 24h view
5. Check duration trends and throttle rate
6. Press 'r' to refresh latest metrics

Compare Function Configurations

1. Press '/' to search for "payment"
2. Select first function, press Enter
3. Note memory and timeout settings
4. Press Esc to go back
5. Select second function, press Enter
6. Compare configurations

πŸ” AWS Permissions Required

Read-Only Permissions (Recommended)

Lambda Lens requires the following IAM permissions for full functionality:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "lambda:ListFunctions",
        "lambda:GetFunction",
        "lambda:GetFunctionConfiguration",
        "lambda:ListEventSourceMappings",
        "lambda:ListTags",
        "logs:DescribeLogGroups",
        "logs:DescribeLogStreams",
        "logs:GetLogEvents",
        "logs:FilterLogEvents",
        "cloudwatch:GetMetricStatistics"
      ],
      "Resource": "*"
    }
  ]
}

Minimal Permissions (Functions Only)

For basic function listing without logs or metrics:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "lambda:ListFunctions",
        "lambda:GetFunction"
      ],
      "Resource": "*"
    }
  ]
}

βš™οΈ Configuration

Configuration File Location

~/.lambdalens/config.toml (auto-created on first run)

Example Configuration

[aws]
region = "us-east-1"      # Default AWS region
profile = "default"        # AWS profile from ~/.aws/credentials

[behavior]
auto_refresh = true        # Enable automatic refresh
refresh_interval = 30      # Seconds between refreshes (default: 30)
default_view = "functions" # Initial view: "functions"

[ui]
theme = "dark"            # Color theme (currently only "dark" supported)

Runtime Profile/Region Switching

You can switch profiles and regions without editing the config:

  • Press P to select a different AWS profile
  • Press R to select a different AWS region

Both will reinitialize the AWS client and refresh all data.

πŸ› οΈ Development

Project Structure

src/
β”œβ”€β”€ main.rs         # Application entry point and event loop
β”œβ”€β”€ app.rs          # Application state and business logic
β”œβ”€β”€ aws.rs          # AWS SDK client wrapper (Lambda, CloudWatch)
β”œβ”€β”€ config.rs       # TOML configuration file handling
β”œβ”€β”€ log_parser.rs   # CloudWatch log parsing and formatting
β”œβ”€β”€ ui/
β”‚   β”œβ”€β”€ mod.rs      # UI module exports
β”‚   β”œβ”€β”€ render.rs   # View rendering (all views)
β”‚   β”œβ”€β”€ theme.rs    # Color themes and styling
β”‚   β”œβ”€β”€ utils.rs    # Layout helpers and utilities
β”‚   └── widgets.rs  # Reusable UI components

Building

# Development build
cargo build

# Release build (optimized)
cargo build --release

Running Tests

# Run all tests
cargo test

# Run tests with output
cargo test -- --nocapture

# Run specific test module
cargo test app::tests

Code Quality

# Format code
cargo fmt

# Lint with Clippy
cargo clippy --all-targets --all-features -- -D warnings

Generating Documentation

# Generate and open documentation
cargo doc --open --no-deps

πŸ—ΊοΈ Roadmap

Current Release: v0.2.0 (P1 - In Progress)

βœ… Completed:

  • Profile & Region switching
  • CloudWatch Metrics Dashboard

🚧 In Progress:

  • Log export functionality

Planned Features

P2 - Power User Features

  • Function invocation with test payloads
  • Version and alias management
  • Event source mapping management
  • Configuration editing (memory, timeout, env vars)

P3 - Advanced Features

  • AWS X-Ray integration
  • Cost analysis and estimation
  • Multi-region view
  • Session management with bookmarks
  • Advanced log querying with CloudWatch Insights

See REQUIREMENTS.md for detailed roadmap.

🀝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Development Setup

  1. Fork the repository
  2. Clone your fork: git clone https://github.com/YOUR-USERNAME/lambdalens.git
  3. Create a feature branch: git checkout -b feature/amazing-feature
  4. Make your changes
  5. Run tests: cargo test
  6. Commit your changes: git commit -m 'Add amazing feature'
  7. Push to the branch: git push origin feature/amazing-feature
  8. Open a Pull Request

πŸ“„ License

MIT License - see LICENSE file for details.

πŸ™ Acknowledgments

πŸ’¬ Support


Made with ❀️ by Ben Pyle

About

Rust TUI for managing AWS Lambda right from the console

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •