Metadata-Version: 2.4
Name: spotter-cli
Version: 1.0.0
Summary: Production-grade spot instance scheduling for EKS worker nodes
Author: Spotter Contributors
License: MIT License
        
        Copyright (c) 2025 S Murali Krishnan
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/mrlikl/spotter
Project-URL: Repository, https://github.com/mrlikl/spotter
Project-URL: Issues, https://github.com/mrlikl/spotter/issues
Project-URL: Documentation, https://github.com/mrlikl/spotter#readme
Keywords: aws,eks,spot-instances,kubernetes,cost-optimization
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer[all]>=0.9.0
Requires-Dist: rich>=13.0.0
Requires-Dist: boto3>=1.26.0
Requires-Dist: botocore>=1.29.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: isort>=5.12.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: types-boto3>=1.0.0; extra == "dev"
Dynamic: license-file

# Spotter

**Production-grade spot instance scheduling for EKS worker nodes**

Spotter intelligently manages EC2 spot instances as EKS worker nodes, automatically finding the cheapest ARM64 instances across availability zones while handling interruptions gracefully. Achieves 70-80% cost savings over on-demand instances.

## Features

- **Real-time Pricing Analysis**: Continuous spot price monitoring with automatic instance selection
- **Multi-AZ Distribution**: Optimal instance placement across availability zones
- **Interruption Resilience**: Automatic replacement with fallback instance types
- **ARM64 Optimization**: Targets modern ARM64 families (c7g, c8g, m7g, m8g, r7g, r8g)
- **EKS Integration**: Native integration via CloudFormation launch templates

## Architecture

### Core Components

**Spotter Lambda**
- Analyzes spot pricing every 10 minutes
- Stores top 6 cheapest instances per AZ in SSM parameters
- Filters for ARM64, current-generation, non-burstable instances

**InstanceRunner Lambda**
- Launches instances based on pricing recommendations
- Handles spot interruption events with same-AZ replacement
- Implements intelligent fallback on Capacity issues

## Installation

### Prerequisites

- AWS CLI configured with appropriate permissions
- SAM CLI installed
- EKS cluster with kubectl access
- EC2 Spot service-linked role

### Quick Start

1. **Bootstrap Infrastructure**
```bash
spotter bootstrap --region us-west-2
```

2. **Onboard EKS Cluster**
```bash
spotter onboard my-cluster --region us-west-2
```

3. **Launch Instances**
```bash
spotter scale my-cluster --count 3
```

## Commands

### Infrastructure Management
```bash
spotter bootstrap [--region REGION] [--min-savings 80] [--check-frequency 10]
spotter destroy [--region REGION]
```

### Cluster Operations
```bash
spotter onboard CLUSTER [--region REGION] [--subnets SUBNET_IDS]
spotter offboard CLUSTER [--region REGION]
spotter list-clusters [--region REGION]
```

### Instance Management
```bash
spotter scale CLUSTER --count COUNT [--scale-to-count] [--region REGION]
spotter list-instances CLUSTER [--region REGION]
spotter rebalance CLUSTER [--region REGION]
```

### Monitoring
```bash
spotter pricing [--region REGION]
spotter refresh-prices [--region REGION]
```

## Configuration

### Instance Selection Criteria
- **Architecture**: ARM64 only
- **Families**: c7g, c8g, m7g, m8g, r7g, r8g
- **Generation**: Current generation
- **Performance**: Non-burstable
- **EKS Compatibility**: <110 pods per node

### Data Storage
Pricing data stored in SSM parameters:
- `/spotter/prices/{az}` - Top 6 instances per availability zone
- `/spotter/settings/{cluster}` - Cluster configuration


## Monitoring & Troubleshooting

### CloudWatch Logs
- `/aws/lambda/Spotter` - Pricing analysis logs
- `/aws/lambda/InstanceRunner` - Instance launch logs

### Troubleshooting
See [docs/troubleshooting.md](docs/troubleshooting.md) for comprehensive troubleshooting guidance.

## Cleanup

Remove all Spotter resources:
```bash
spotter destroy --region us-west-2
```

For cluster-specific cleanup:
```bash
spotter offboard my-cluster --region us-west-2
```

---

Vibe coded with [Amazon Q](https://github.com/aws/amazon-q-developer-cli)
