Skip to main content

Blazing Fast AWS Lambda Build System with Global Project Detection

Project description

Autoklug - Blazing Fast AWS Lambda Build System

PyPI version Python Support License: MIT

A blazing fast, high-performance AWS Lambda deployment system that works globally in any project with automatic context detection. Makes complex AWS infrastructure "stupid simple" with minimal configuration.

๐Ÿš€ Core Principles

  • Unified Developer Experience: One CLI, consistent interface
  • Build Locally, Deploy Globally: Local development with seamless AWS deployment
  • Stupid Simple: Complex AWS infrastructure made accessible with minimal configuration
  • Production Ready: Enterprise-grade features with developer-friendly interfaces
# Autoklug Commands
autoklug init          # Initialize project
autoklug run           # Local development server
autoklug deploy        # Deploy to AWS Lambda
autoklug deploy --validate  # Deploy with enhanced validation

๐Ÿš€ Features

  • โšก Parallel Processing: Layers, functions, and APIs built simultaneously
  • ๐Ÿ”„ Smart Comparison: Only updates what's changed using SHA256 hashing
  • ๐Ÿ“ฆ S3 Requirements Checking: Compares local requirements.txt with S3
  • ๐ŸŒ Public API Detection: Automatically configures public APIs without authorizers
  • ๐Ÿšฆ Rate Limiting: Built-in throttling for public APIs
  • ๐ŸŒ Global Usage: Works in any project with auto-detection
  • ๐ŸŽจ Beautiful CLI: Click-based CLI with progress bars and colored output
  • ๐Ÿ”ง Zero Configuration: Just run autoklug build from any project

๐Ÿ“ฆ Installation

pip install autoklug

๐ŸŽฏ Quick Start

Zero Configuration Usage

# Just run from any project directory - it detects everything!
autoklug build

With Explicit Configuration

# Override auto-detection if needed
autoklug build --tool .tool.dev --env .env.dev

Individual Components

# Build only layers
autoklug layers

# Build only functions  
autoklug functions

# Build only API Gateway
autoklug api

Local Development

# Start local development server
autoklug run

# With custom port
autoklug run --port 8080

# With authorizer simulation
autoklug run --use-authorizer

# With custom configuration
autoklug run --tool .tool.dev --env .env.dev

Project Analysis

# See what the system detects
autoklug detect

# Show configuration
autoklug config

๐Ÿ” Project Context Detection

Autoklug automatically detects:

Configuration Files

  • .tool, .tool.dev, .tool.prod, .tool.public, etc.
  • .env, .env.dev, .env.prod, etc.
  • Preference: Uses .tool and .env over environment-specific versions

Project Structure

  • API Directories: api/, api_public/, src/api/, functions/, lambda/
  • Layer Directories: layers/, lambda_layers/, src/layers/

Infrastructure Detection

  • From File Names: Detects prod, staging, dev from .tool.* files
  • Default: Uses dev if not detected
  • Public APIs: Detects from api_public/ or .tool.public.* files

๐Ÿ“Š Example Detection Output

$ autoklug detect

๐Ÿ” Project Context Detection
========================================
Current directory: /path/to/my-project
Detected infrastructure: prod
Public API detected: True

๐Ÿ“ Configuration Files:
Tool files found: ['.tool.public.prod', '.tool.dev', '.tool']
Env files found: ['.env.prod', '.env.dev', '.env']
Selected tool file: .tool.public.prod
Selected env file: .env.prod

๐Ÿ“‚ Project Structure:
API paths found: ['./api', './api_public']
Layer paths found: ['./layers']

๐ŸŽจ CLI Commands

Command Description Auto-Detection
autoklug build ๐Ÿ—๏ธ Build complete infrastructure โœ…
autoklug layers ๐Ÿ“ฆ Build only Lambda layers โœ…
autoklug functions โšก Build only Lambda functions โœ…
autoklug api ๐ŸŒ Build only API Gateway โœ…
autoklug run ๐Ÿš€ Start local development server โœ…
autoklug config โš™๏ธ Show configuration info โœ…
autoklug detect ๐Ÿ” Show project detection โœ…
autoklug demo ๐ŸŽจ Run logging demo โŒ

๐Ÿ”ง Project Structure Support

Autoklug works with any of these common project structures:

Standard Structure

my-project/
โ”œโ”€โ”€ .tool
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ api/
โ”‚   โ”œโ”€โ”€ health/
โ”‚   โ”‚   โ””โ”€โ”€ get.py
โ”‚   โ””โ”€โ”€ users/
โ”‚       โ”œโ”€โ”€ get.py
โ”‚       โ””โ”€โ”€ post.py
โ””โ”€โ”€ layers/
    โ”œโ”€โ”€ shared/
    โ””โ”€โ”€ thirdparty/
        โ””โ”€โ”€ requirements.txt

Public API Structure

my-project/
โ”œโ”€โ”€ .tool.public
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ api_public/
โ”‚   โ”œโ”€โ”€ health/
โ”‚   โ””โ”€โ”€ catalog/
โ””โ”€โ”€ layers/

Environment-Specific Structure

my-project/
โ”œโ”€โ”€ .tool.dev
โ”œโ”€โ”€ .tool.prod
โ”œโ”€โ”€ .env.dev
โ”œโ”€โ”€ .env.prod
โ”œโ”€โ”€ api/
โ””โ”€โ”€ layers/

โš™๏ธ Configuration Files

.tool File Example

# AWS Configuration
AWS_PROFILE_BUILD=default
AWS_REGION=eu-west-3
AWS_ACCOUNT_ID=123456789012

# Application Configuration
APP_NAME=my-app
PUBLIC_APP_NAME=my-app-public
INFRA=dev

# Lambda Configuration
LAMBDA_RUNTIME=python3.11
LAMBDA_ROLE=arn:aws:iam::123456789012:role/lambda-execution-role

# Layer Configuration
LAYER_PATH=./layers
LAYER_COMPATIBLE_RUNTIMES=python3.11
LAYER_ARCHITECTURE=x86_64

# API Configuration
API_PATH=./api
AUTHORIZER_FUNCTION_NAME=api-my-app-dev-authorizer

# S3 Configuration for requirements.txt checking (auto-generated from APP_NAME)
# Bucket name will be: <APP_NAME>-requirements-txt-bucket
# Example: my-app-requirements-txt-bucket

.env File Example

# Database Configuration
DATABASE_URL=postgresql://user:password@localhost:5432/my_app_dev

# External Services
UPLOADS_CDN=https://cdn.example.com
API_BASE_URL=https://api.example.com

# Feature Flags
ENABLE_FEATURE_X=true
DEBUG_MODE=true

๐Ÿš€ Performance Benefits

  • Parallel Processing: Up to 10 concurrent Lambda updates
  • Smart Comparison: SHA256 hashing prevents unnecessary rebuilds
  • S3 Integration: Requirements.txt comparison without local rebuilds
  • Boto3 Optimization: Adaptive retries and connection pooling
  • Async/Await: Non-blocking I/O operations

๐ŸŽฏ Use Cases

Development

  • Local Development: Quick builds during development
  • Feature Branches: Deploy to dev environment
  • Testing: Validate changes before production

CI/CD

  • GitHub Actions: Automated deployments
  • Jenkins: Build pipeline integration
  • GitLab CI: Continuous deployment

Production

  • Blue-Green Deployments: Zero-downtime updates
  • Rollback Support: Quick reversion capabilities
  • Monitoring: Health checks and validation

๐Ÿ”ง Advanced Usage

Force Layer Updates

autoklug build --force-update-layers

Dry Run Mode

autoklug build --dry-run

Verbose Logging

autoklug build --verbose

Custom Configuration

autoklug build --tool .tool.prod --env .env.prod

๐Ÿ› ๏ธ Development

Install Development Dependencies

pip install autoklug[dev]

Run Tests

pytest

Code Formatting

black autoklug/

Type Checking

mypy autoklug/

๐Ÿ“š Documentation

๐Ÿค Contributing

Contributions are welcome! Please see our Contributing Guide for details.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built with Click for CLI
  • Uses Boto3 for AWS integration
  • Inspired by modern DevOps practices

๐Ÿ“ž Support


Made with โค๏ธ by Luรญs Miguel Sousa

Blazing fast AWS Lambda deployments, globally! ๐Ÿš€

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autoklug-2.0.0.tar.gz (60.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autoklug-2.0.0-py3-none-any.whl (70.6 kB view details)

Uploaded Python 3

File details

Details for the file autoklug-2.0.0.tar.gz.

File metadata

  • Download URL: autoklug-2.0.0.tar.gz
  • Upload date:
  • Size: 60.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for autoklug-2.0.0.tar.gz
Algorithm Hash digest
SHA256 a4db67efb8c1e66675887dd10d9619a209bad95610f580f53835132e649d68b2
MD5 84a58e64669d9b19a2dbb2dab8f0a212
BLAKE2b-256 c702594fadc0e518e1ac4fa313665442a3b0478477980b9d5c5b20e0ab72713e

See more details on using hashes here.

File details

Details for the file autoklug-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: autoklug-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 70.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for autoklug-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3f54a35bca58716567a2ded1c15c69a99f256bc5607c85049924fa5cd244982
MD5 7a9ddd0d9fd88c92629878704804161b
BLAKE2b-256 a21e4a00a98f7aa27fedda587a105f7195dfdda91e1d29820ba19c846afd4843

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page