Deploy Bacalhau compute nodes globally using AWS spot instances for cost-effective distributed computing
Project description
๐ Amauo - AWS Spot Instance Deployment Tool
Modern AWS spot instance deployment tool for deploying Bacalhau compute nodes and sensor simulations. Features a clean Python package structure with beautiful Rich terminal output.
Deploy Bacalhau compute nodes across AWS regions using spot instances for cost-effective distributed computing.
๐ One-Command Global Deployment
Deploy clusters across worldwide regions with a single command:
# Install and run instantly with uvx (no local setup required)
uvx amauo create
# Check status
uvx amauo list
# Setup configuration
uvx amauo setup
# Clean up
uvx amauo destroy
โจ PyPI Package Architecture
๐ Zero Setup Required
- uvx execution: No installation or environment setup needed
- Python packaging: Clean CLI with Rich output and proper error handling
- Direct AWS deployment: Uses boto3 for native AWS integration
- Cross-platform: Works on any system with Python 3.12+
๐ฅ What This Provides
- โ
Instant execution โ
uvx amauoworks immediately - โ Rich terminal UI โ Beautiful tables and progress indicators
- โ Proper YAML parsing โ Clean configuration management
- โ Type safety โ Full type annotations throughout
- โ AWS-native โ Direct boto3 integration, no container overhead
๐ฏ Superior Features
- Automatic spot preemption handling - Cost-effective deployment
- Built-in health monitoring - Comprehensive node validation
- Multi-region deployment - Distributed across AWS regions
- Deterministic node identity - Consistent sensor identities
- Secure credential management - Never commit secrets
๐๏ธ Architecture
Modern Stack
- Python Package: PyPI-distributed CLI with Rich output
- AWS Integration: Direct boto3 calls for native cloud operations
- Bacalhau: Distributed compute with Docker engine support
- YAML Processing: Proper PyYAML parsing and configuration management
- Type Safety: Full mypy type checking throughout
Deployment Flow
uvx amauo create โ Python CLI โ AWS boto3 โ Spot Instance Deploy โ Health check
Package Architecture
PyPI Package (amauo):
โโโ CLI framework with Rich UI
โโโ AWS Resource Manager
โโโ SSH Manager for remote operations
โโโ YAML configuration parsing
โโโ State management (JSON-based)
โโโ Node identity generation
๐ Prerequisites
Required
- Python 3.12+ (for uvx, usually already installed)
- AWS Account with EC2 permissions
- AWS Credentials configured in
~/.aws/credentialsor environment
Automatic
The CLI automatically handles:
- AWS resource management (VPC, Security Groups, Key Pairs)
- Prerequisites checking (AWS access, SSH keys)
- YAML configuration parsing and validation
- File synchronization to remote nodes
๐๏ธ Configuration
Credential Setup
Create these files in the project directory before deployment:
# Required credential files
mkdir -p credentials/
# Bacalhau orchestrator endpoint
echo "nats://your-orchestrator.example.com:4222" > credentials/orchestrator_endpoint
# Bacalhau authentication token
echo "your-secret-token" > credentials/orchestrator_token
# AWS credentials for S3 access (optional)
cp ~/.aws/credentials credentials/aws-credentials
Deployment Settings
Edit config.yaml to customize:
aws:
total_instances: 3
username: ubuntu
ssh_key_name: my-key
files_directory: "deployment-files"
scripts_directory: "instance/scripts"
regions:
- us-west-2:
machine_type: t3.medium
image: auto # Auto-discovers latest Ubuntu 24.04
- us-east-1:
machine_type: t3.medium
image: auto
๐ง Commands
Core Operations
# Deploy instances across AWS regions
uvx amauo create
# List all running instances with details
uvx amauo list
# Destroy all instances
uvx amauo destroy
# Setup initial configuration
uvx amauo setup
# Show version
uvx amauo version
# Show help
uvx amauo help
# Migrate from legacy spot-deployer
uvx amauo migrate
Advanced Options
# Use custom config file (default: config.yaml)
uvx amauo create --config my-config.yaml
# Dry run to validate configuration without deploying
uvx amauo create --dry-run
# Verbose output for debugging
uvx amauo create --verbose
๐งช Local Development & Testing
Quick Test
# Test the CLI without installation
uvx amauo version
# Setup configuration
uvx amauo setup
# Test with dry run
uvx amauo create --dry-run
Local Development
# Clone the repository for development
git clone <repository-url>
cd bacalhau-skypilot
# Install in development mode with uv
uv pip install -e .
# Run locally during development
python -m amauo version
# Run tests
uv run pytest
# Run linting
uv run ruff check .
Debug Deployment
# Enable verbose logging for debugging
uvx amauo create --verbose
# Check instance status
uvx amauo list
# SSH to specific instance for debugging
# Use instance ID from the list command
ssh -i ~/.ssh/your-key ubuntu@instance-ip
Test Individual Components
# Test node identity generation
INSTANCE_ID=i-test123 python3 instance/scripts/generate_node_identity.py
# Test Bacalhau config generation
python3 instance/scripts/generate_bacalhau_config.sh
# Check deployment logs on instance
ssh -i ~/.ssh/your-key ubuntu@instance-ip sudo tail -f /opt/deployment.log
๐ AWS Integration
Current Support
- AWS: Full native support with spot instances
- Multi-region: Deploy across multiple AWS regions simultaneously
Cloud Provider Detection
# AWS: Uses IMDS for instance metadata
curl -s http://169.254.169.254/latest/meta-data/instance-id
# Node identity automatically detects cloud provider
# and generates appropriate sensor identities
๐ Monitoring & Health
Built-in Health Checks
Every deployment includes comprehensive monitoring:
- Docker service status
- Container health (Bacalhau + Sensor)
- Network connectivity (API ports 1234, 4222)
- File system status (configs, data directories)
- Resource utilization (disk, memory)
- Orchestrator connectivity
- Log analysis (error detection)
Status Dashboard
# View instance overview
uvx amauo list
# SSH to specific node for debugging
ssh -i ~/.ssh/your-key ubuntu@instance-ip
# Check deployment logs
ssh -i ~/.ssh/your-key ubuntu@instance-ip sudo tail -f /opt/deployment.log
๐ Security
Credential Management
- Never committed to git - credentials/ in .gitignore
- Secure file transfer via SSH to remote instances
- Encrypted in transit - SSH/TLS everywhere
- Least privilege - minimal required AWS permissions
Instance Security
- Official Ubuntu 24.04 LTS AMI - automatically discovered
- Security groups with minimal required ports
- SSH key-based access - no password authentication
- Automatic security updates via cloud-init
๐ Performance
Deployment Speed
- ~3-5 minutes for multi-region deployment
- Parallel deployment across regions via boto3
- Fast startup time - ~0.15 seconds CLI response
Resource Efficiency
- t3.medium instances (2 vCPU, 4GB RAM) by default
- 30GB disk per node
- Spot pricing - up to 90% cost savings
- Efficient resource cleanup on destroy
Reliability
- Immutable infrastructure - destroy and recreate for changes
- Health monitoring with systemd services
- Multi-region distribution for availability
- AWS retry logic for transient API failures
๐ Troubleshooting
Common Issues
1. AWS Credentials
# Check AWS access
aws sts get-caller-identity
# Configure if needed
aws configure
# or
aws sso login
2. SSH Key Issues
# Ensure SSH key exists and has correct permissions
chmod 400 ~/.ssh/your-key.pem
# Test SSH access to instance
ssh -i ~/.ssh/your-key.pem ubuntu@instance-ip
3. Configuration Issues
# Validate configuration file
uvx amauo create --dry-run
# Check current configuration
cat config.yaml
4. Instance Connectivity
# List current instances
uvx amauo list
# Check instance logs
ssh -i ~/.ssh/your-key ubuntu@instance-ip sudo tail -f /opt/deployment.log
Debug Commands
# Verbose deployment
uvx amauo create --verbose
# Check AWS resources directly
aws ec2 describe-instances --filters "Name=tag:amauo,Values=true"
# SSH to node for debugging
ssh -i ~/.ssh/your-key ubuntu@instance-ip
# Then run: sudo docker ps, sudo systemctl status bacalhau
๐ค Contributing
Development Setup
git clone <repository-url>
cd bacalhau-skypilot
# Install in development mode
uv pip install -e .
# Test the CLI
python -m amauo version
Testing Changes
- Local testing: Use
uvx amauo versionto test CLI - Configuration test: Modify
config.yamland test parsing - Single node test: Deploy to one region first with minimal config
- Full deployment test: Test complete multi-region deployment
Code Standards
- Python-first - native Python with boto3, no containers
- Type safety - full type annotations and mypy checking
- Rich UI - beautiful terminal output with progress indicators
- Immutable infrastructure - destroy and recreate for changes
๐ License
MIT License - see LICENSE for details.
๐ Links
- Bacalhau Documentation: https://docs.bacalhau.org/
- AWS Documentation: https://docs.aws.amazon.com/
- uvx Documentation: https://docs.astral.sh/uv/guides/tools/
Ready to deploy? Ensure AWS credentials are configured, then: uvx amauo create
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file amauo-3.0.5.tar.gz.
File metadata
- Download URL: amauo-3.0.5.tar.gz
- Upload date:
- Size: 78.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c1999420aceead616adc65f5a4e11948b4d4fc332ae810e756483cd8b0dd47a
|
|
| MD5 |
48bd88cabb862a1dfb2901fe76fc41bb
|
|
| BLAKE2b-256 |
9adcec0a481e809394d649ddd604054a02acea51dfe0e92f35bff4a5f3977b7f
|
Provenance
The following attestation bundles were made for amauo-3.0.5.tar.gz:
Publisher:
pypi.yml on bacalhau-project/amauo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
amauo-3.0.5.tar.gz -
Subject digest:
1c1999420aceead616adc65f5a4e11948b4d4fc332ae810e756483cd8b0dd47a - Sigstore transparency entry: 454747748
- Sigstore integration time:
-
Permalink:
bacalhau-project/amauo@7a7003c1673859db05d19fa685efda8c6c20c0c2 -
Branch / Tag:
refs/tags/v3.0.5 - Owner: https://github.com/bacalhau-project
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@7a7003c1673859db05d19fa685efda8c6c20c0c2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file amauo-3.0.5-py3-none-any.whl.
File metadata
- Download URL: amauo-3.0.5-py3-none-any.whl
- Upload date:
- Size: 98.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a3c4648fc1efe599e11ff86351c978bda855c9f2b8cb9eb7e665ae1fceb02c8
|
|
| MD5 |
2c65bdb80d5448a92871b5dedef027c3
|
|
| BLAKE2b-256 |
017b9d30fe6cc9caac035da6af34361af0501521b34d110362ba362aef8d5d5a
|
Provenance
The following attestation bundles were made for amauo-3.0.5-py3-none-any.whl:
Publisher:
pypi.yml on bacalhau-project/amauo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
amauo-3.0.5-py3-none-any.whl -
Subject digest:
5a3c4648fc1efe599e11ff86351c978bda855c9f2b8cb9eb7e665ae1fceb02c8 - Sigstore transparency entry: 454747749
- Sigstore integration time:
-
Permalink:
bacalhau-project/amauo@7a7003c1673859db05d19fa685efda8c6c20c0c2 -
Branch / Tag:
refs/tags/v3.0.5 - Owner: https://github.com/bacalhau-project
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@7a7003c1673859db05d19fa685efda8c6c20c0c2 -
Trigger Event:
push
-
Statement type: