Run AWS Lambda functions locally with smart preferences and flexible test data management
Transform your AWS Lambda development workflow with Lambda Run - the VS Code extension that makes local testing effortless, intelligent, and lightning-fast.
Execute Lambda functions directly from your YAML files with intuitive CodeLens buttons
Remembers your preferences per function - test files, environments, and regions
Works seamlessly with both SAM and Serverless Framework
Intelligent test file discovery with customizable search patterns
Complete history of your function runs with detailed statistics
- VS Code 1.93.0 or higher
- AWS SAM CLI (for SAM projects) or Serverless Framework (for Serverless projects)
- Node.js for your Lambda functions
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X) - Search for "Lambda Run"
- Click Install
- Open a workspace with
template.yaml(SAM) orserverless.yml(Serverless) - Look for the π Run Function buttons above your function definitions
- Click to execute - the extension will guide you through the setup!
Smart buttons appear directly in your YAML files:
functions:
getUserData: # π Run Function | β‘ Run (Last Settings)
handler: src/handlers/user.getUserData
events:
- http:
path: /user/{id}
method: get- π Run Function - Execute with full configuration options
- β‘ Run (Last Settings) - Instant re-run with previously used settings
Lambda Run learns and adapts to your workflow:
- Per-Function Memory: Remembers test files, environments, and regions for each function
- Smart Defaults: Pre-selects your most-used configurations
- Auto-Cleanup: Removes invalid preferences when files or configs change
Multiple discovery strategies for maximum flexibility:
π my-lambda-project/
βββ π test-data/
β βββ user-create.json β Prioritized for 'createUser' function
β βββ user-update.json β Prioritized for 'updateUser' function
β βββ general-test.json
βββ π tests/fixtures/
β βββ integration-tests.json
βββ π custom-location/
βββ specific-test.json
Configuration Options:
- Specific Folders: Configure exact locations for test files
- Pattern Matching: Use glob patterns (
**/*.json,**/test-*.json) - Function Priority: Automatically prioritize test files containing function names
- Workspace Search: Fall back to searching entire workspace
Flexible configuration management:
Environments:
Development β PreProd β Prod
AWS Regions:
ap-south-1 (Primary)
us-east-1 (Backup)
eu-west-1 (Global)
- Add/remove environments and regions through UI
- Validation prevents empty configurations
- Auto-cleanup of invalid defaults
Complete visibility into your development workflow:
π Execution Statistics:
βββ Total Runs: 47
βββ Success Rate: 94%
βββ Average Duration: 2.3s
βββ Most Used: getUserData (12 runs)
π Recent History:
βββ β
getUserData (PreProd, ap-south-1) - 2.1s
βββ β
createUser (Prod, us-east-1) - 1.8s
βββ β updateUser (PreProd, ap-south-1) - Failed
βββ β
deleteUser (PreProd, ap-south-1) - 2.5s
Features:
- Detailed Logging: Track every execution with timestamps and duration
- Re-run from History: Click any history item to execute again
- Success Tracking: Monitor which functions are working reliably
- Export Capabilities: Copy statistics for reporting
Access all features via Ctrl+Shift+P:
- Lambda Run: Configure Environments - Manage deployment stages
- Lambda Run: Configure Regions - Manage AWS regions
- Lambda Run: Configure Test Data Locations - Set up test file directories
- Lambda Run: Show Execution History - View and re-run previous executions
- Lambda Run: Manage Extension Data - Statistics and data management
- Lambda Run: Reset Extension to Defaults - Clean slate reset
| Shortcut | Action |
|---|---|
Ctrl+Shift+R |
Run function with last settings |
Ctrl+Shift+H |
Show execution history |
Mac users: Replace Ctrl with Cmd
Fine-tune Lambda Run through VS Code Settings (Ctrl+,):
{
"lambdaRun.environments": ["Dev", "Staging", "Prod"],
"lambdaRun.regions": ["us-east-1", "eu-west-1"],
"lambdaRun.testDataLocations": ["test-data", "tests/fixtures"],
"lambdaRun.rememberPreferences": true,
"lambdaRun.functionSpecificTestPriority": true,
"lambdaRun.maxExecutionHistory": 50,
"lambdaRun.notificationLevel": "info"
}Key Settings:
testDataLocations- Folders to search for test filestestFilePatterns- File patterns to match (e.g.,**/*.json)rememberPreferences- Save last-used settings per functionreuseTerminals- Reuse terminals vs create new onesautoShowTerminal- Automatically show terminal during execution
Configure specific patterns for your test files:
{
"lambdaRun.testFilePatterns": [
"**/*-test.json", // Standard test files
"**/fixtures/*.json", // Fixture files
"**/samples/**.json" // Sample data
]
}Lambda Run automatically detects and uses environment files:
π your-project/
βββ env.json β Used for PreProd environment
βββ envProd.json β Used for Prod environment
βββ template.yaml
Control how terminals are handled:
- Reuse Terminals: One terminal per function (efficient)
- New Terminals: Fresh terminal for each execution (isolated)
- Auto-Show: Automatically bring terminal to focus
File Structure:
# template.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
GetUserFunction: # π Run Function
Type: AWS::Serverless::Function
Properties:
Handler: src/user.getUser
Runtime: nodejs18.xGenerated Command:
sam local invoke GetUserFunction \
--template-file template.yaml \
--event "test-data/user-get.json" \
--parameter-overrides Stage=PreProd Mode=Update \
--region ap-south-1 \
--env-vars env.jsonFile Structure:
# serverless.yml
service: my-lambda-service
functions:
getUser: # π Run Function
handler: src/user.getUser
events:
- http:
path: /user/{id}
method: getGenerated Command:
serverless invoke local \
--function getUser \
--path "test-data/user-get.json" \
--stage PreProd \
--region ap-south-1 \
--param 'mode=Update'- Morning Setup: Open your Lambda project
- Quick Testing: Use β‘ Run (Last Settings) for rapid iterations
- New Features: Use π Run Function to test with different data
- Environment Testing: Switch between PreProd/Prod environments
- History Review: Check
Ctrl+Shift+Hfor execution patterns
- Shared Config: Commit
.vscode/settings.jsonwith team preferences - Test Organization: Standardize test file locations and patterns
- Environment Sync: Ensure all team members have same environments configured
While Lambda Run is for local development, it helps prepare for CI/CD:
- Test Validation: Ensure all test files work locally before CI
- Environment Parity: Test with same environments used in CI/CD
- Command Generation: See exact commands that work locally
πΈ "No test files found"
- Check
lambdaRun.testDataLocationssettings - Verify test files exist in specified locations
- Try "Configure Test Data Locations" command
πΈ "Handler not defined"
- Ensure your YAML has proper
handlerfield - Check function syntax matches SAM or Serverless format
πΈ "Command failed"
- Verify SAM CLI or Serverless Framework is installed
- Check terminal output for detailed error messages
- Ensure AWS credentials are configured
Enable verbose logging:
{
"lambdaRun.notificationLevel": "verbose"
}View detailed logs in:
- Output Panel: View β Output β "Lambda Run"
- Developer Tools: Help β Toggle Developer Tools β Console
π my-lambda-project/
βββ π src/
β βββ handlers/
β βββ utils/
βββ π test-data/ β Organized test files
β βββ user/
β β βββ create-user.json
β β βββ update-user.json
β βββ auth/
β βββ login.json
βββ π tests/ β Unit tests
βββ env.json β PreProd environment variables
βββ envProd.json β Prod environment variables
βββ template.yaml β SAM template
βββ serverless.yml β Serverless config
- Enable Preference Memory: Set
rememberPreferences: true - Reuse Terminals: Set
reuseTerminals: true - Organize Test Files: Use function-specific naming
- Limit History: Set reasonable
maxExecutionHistory
- Environment Files: Add
env*.jsonto.gitignore - Sensitive Data: Use AWS Parameter Store for secrets
- Local Only: Lambda Run is for local development - not production
We welcome contributions! Here's how to get started:
# Clone the repository
git clone https://github.com/madara-uchihaaa/lambda-run.git
# Install dependencies
npm install
# Start development
npm run watch
# Package extension
npm run package- π Bug Reports: Use GitHub issues with detailed reproduction steps
- π‘ Feature Requests: Describe use case and expected behavior
- π§ Pull Requests: Include tests and update documentation
- π Documentation: Help improve examples and guides
MIT License - see LICENSE file for details.
- AWS SAM Team - For the excellent local development tools
- Serverless Framework - For revolutionizing serverless development
- VS Code Team - For the amazing extension API
- Community - For feedback and feature suggestions
Need help? Here are your options:
- π Documentation: Check this README and in-editor help
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π§ Contact: Create an issue for any questions
Made with β€οΈ for the serverless community
β Star on GitHub β’ π¦ VS Code Marketplace β’ π Report Bug