An open API service indexing awesome lists of open source software.

https://github.com/kosty-cloud/kosty

Identify AWS cost waste and security vulnerabilities across 16 core services with a single command
https://github.com/kosty-cloud/kosty

aws cloud cost finops security

Last synced: about 2 months ago
JSON representation

Identify AWS cost waste and security vulnerabilities across 16 core services with a single command

Awesome Lists containing this project

README

          

# ๐Ÿ’ฐ Kosty - AWS Cost Optimization & Security Audit CLI Tool

![Kosty Logo](https://img.shields.io/badge/๐Ÿ’ฐ-Kosty-blue?style=for-the-badge)
[![Python](https://img.shields.io/badge/Python-3.7+-blue?style=flat-square&logo=python)](https://python.org)
[![AWS](https://img.shields.io/badge/AWS-Compatible-orange?style=flat-square&logo=amazon-aws)](https://aws.amazon.com)
[![License](https://img.shields.io/badge/License-MIT-green?style=flat-square)](LICENSE)

> ๐Ÿค– **New in v2.0.0** โ€” `kosty ai` now audits Bedrock and SageMaker workloads: guardrails, shadow AI detection, idle GPU endpoints, prompt caching, and more. [See what's new โ†’](docs/RELEASE_NOTES.md)

**Scan 30+ AWS services. Find cost waste. Detect security gaps. Audit GenAI workloads. One command.**

[Quick Start](#-quick-start) โ€ข [Key Features](#-key-features) โ€ข [Service Coverage](#-service-coverage) โ€ข [Documentation](docs/DOCUMENTATION.md)

---

## โšก Why Kosty

๐ŸŒ **External Attack Surface Mapping** โ€” scan 15 resource types, classify exposure as unprotected / partially protected / protected

๐Ÿ” **IAM Privilege Escalation Detection** โ€” 21 known escalation patterns with optional `--deep` confirmation via SimulatePrincipalPolicy

๐Ÿค– **GenAI Security & Cost Audit** โ€” Bedrock guardrails, shadow AI detection, SageMaker idle GPU endpoints, prompt caching

๐Ÿข **Organization-Wide Scanning** โ€” parallel audit across hundreds of AWS accounts with cross-account role assumption

๐Ÿ›ก๏ธ **200+ Security Checks** โ€” WAF hardening, API Gateway auth/throttling/TLS, CloudTrail, GuardDuty, VPC Flow Logs, KMS rotation

๐Ÿ’ฐ **Real Dollar Savings** โ€” not just recommendations, actual monthly amounts for 11 services ($280/mo per stopped m5.2xlarge, $700/mo per oversized db.r5.4xlarge)

---

## ๐ŸŽฏ Quick Start

```bash
pip install kosty

# Full audit โ€” cost + security across 30+ services
kosty audit --output all

# External attack surface mapping
kosty public-exposure --output console

# AI/ML audit โ€” Bedrock + SageMaker
kosty ai audit --output console

# IAM privilege escalation detection (21 patterns)
kosty iam check-privilege-escalation --deep

# Organization-wide scan
kosty audit --organization --max-workers 20 --output all
```

> ๐Ÿ’ก Need expert help? [Professional consulting available โ†’](https://kosty.cloud?utm_source=github&utm_medium=readme)

---

## ๐Ÿ“Š Visual Dashboard

![Kosty Dashboard](dashboard/kosty-dashboard-header.png)

Kosty Dashboard
AI Audit Dashboard

Full Audit Dashboard
AI/ML Audit Dashboard

Upload your JSON report to the built-in dashboard for interactive charts, filtering, and cost breakdowns.

---

## ๐Ÿš€ Key Features

### ๐ŸŒ Attack Surface Mapping

Map everything publicly exposed and evaluate protections โ€” ALB, EC2, S3, RDS, API Gateway, Lambda URLs, CloudFront, OpenSearch, Redshift, EKS, ECR, SNS, SQS, and snapshots.

```bash
kosty public-exposure --output console
```

Each finding is classified:
- ๐Ÿ”ด **Exposed & Unprotected** โ€” no protections, immediate action
- ๐ŸŸก **Exposed & Partially Protected** โ€” gaps remain
- ๐ŸŸข **Exposed & Protected** โ€” all protections verified

### ๐Ÿ” Security Audit

200+ checks across 30+ services. Highlights:

- **IAM Privilege Escalation** โ€” detects 21 known escalation patterns with optional `--deep` confirmation via SimulatePrincipalPolicy
- **WAF Hardening** โ€” managed rules, rate limiting, bot control, logging, action mode
- **API Gateway** โ€” WAF association, authorization, throttling, TLS 1.2, CloudFront bypass detection, request validation
- **Foundational** โ€” CloudTrail, VPC Flow Logs, GuardDuty, AWS Config, KMS key rotation
- **Data Protection** โ€” S3 encryption, RDS encryption, ElastiCache encryption, Secrets Manager rotation

```bash
kosty iam security-audit --deep
kosty waf audit
kosty apigateway security-audit
```

### ๐Ÿค– AI/ML Audit

Dedicated `kosty ai` command for Bedrock and SageMaker workloads. Catches the invisible waste and security gaps that standard audits miss.

```bash
kosty ai audit # full Bedrock + SageMaker
kosty ai bedrock check-no-guardrails # prompt injection protection
kosty ai bedrock check-shadow-ai # unapproved AI usage
kosty ai sagemaker check-idle-endpoints # GPU instances burning cash
```

**Bedrock** (12 checks) โ€” guardrails, shadow AI detection, VPC endpoints, prompt caching, inference profiles, custom model encryption, logging, budget limits, TPM quota monitoring, cross-account model access, model sizing analysis, batch eligibility detection

**SageMaker** (8 checks) โ€” idle endpoints, zombie notebooks, Spot training, checkpointing, Inference Components, VPC endpoints, internet access, root access

### ๐Ÿ’ฐ Cost Optimization

Real dollar savings for 11 services โ€” not just recommendations, actual monthly amounts:

| Finding | Typical Savings |
|---------|----------------|
| Stopped EC2 instances | $280/mo per m5.2xlarge |
| Oversized RDS instances | $700/mo per db.r5.4xlarge |
| Unused NAT Gateways | $33/mo each |
| Orphaned EBS volumes | $10/mo per 100GB |
| Load Balancers with no targets | $16/mo each |
| Unused secrets | $0.40/mo each |

```bash
kosty audit --output json # generates report with $ amounts
open dashboard/index.html # visualize savings
```

---

## ๐Ÿ“Š Service Coverage

**30 services**, organized by category:

| Category | Services | Key Checks |
|----------|----------|------------|
| **Compute** | EC2, Lambda | Oversized, idle, IMDSv1, outdated runtimes |
| **Storage** | S3, EBS, Snapshots | Public access, encryption, lifecycle, object lock |
| **Database** | RDS, DynamoDB | Public DBs, oversized, encryption, backups |
| **Network** | EIP, LB, NAT, SG, Route53, VPC | Unused resources, open ports, flow logs |
| **Security** | IAM, WAFv2, GuardDuty, KMS | Privilege escalation, MFA, key rotation, threat detection |
| **Management** | CloudWatch, Backup, CloudTrail, Config | Logging, audit trail, drift detection |
| **Application** | API Gateway | WAF, auth, throttling, TLS, CloudFront bypass |
| **AI/ML** | Bedrock, SageMaker | Guardrails, shadow AI, idle endpoints, prompt caching, VPC endpoints |
| **Secrets** | Secrets Manager | Unused secrets, rotation |
| **Messaging** | SNS, SQS | Encryption at rest and in transit |
| **Cache** | ElastiCache | Encryption at rest and in transit |
| **Certificates** | ACM | Expiring certificates |
| **Containers** | ECS | Privileged task definitions |
| **Patch Mgmt** | SSM | Patch compliance |

Full check list per service โ†’ [docs/SERVICES.md](docs/SERVICES.md)

---

## ๐Ÿ”ง Installation

```bash
# PyPI (recommended)
pip install kosty

# Docker
docker run --rm -v ~/.aws:/home/nonroot/.aws:ro ghcr.io/kosty-cloud/kosty:latest audit

# From source
git clone https://github.com/kosty-cloud/kosty.git && cd kosty && pip install -e .
```

---

## โš™๏ธ Configuration

```yaml
# kosty.yaml
default:
regions: [us-east-1, eu-west-1]
max_workers: 20

exclude:
services: [route53]
tags:
- key: "kosty_ignore"
value: "true"

profiles:
production:
role_arn: "arn:aws:iam::123456789012:role/AuditRole"
regions: [us-east-1]
staging:
aws_profile: "staging-profile"
regions: [eu-west-1]
```

```bash
kosty audit --profile production
kosty audit --profiles --output all # all profiles in parallel
```

Full configuration guide โ†’ [docs/CONFIGURATION.md](docs/CONFIGURATION.md)

---

## ๐Ÿ“– Documentation

| Guide | Description |
|-------|-------------|
| [Full Documentation](docs/DOCUMENTATION.md) | Complete user guide |
| [Service Coverage](docs/SERVICES.md) | All 30 services and their checks |
| [CLI Reference](docs/CLI_REFERENCE.md) | Every command and option |
| [Examples](docs/EXAMPLES.md) | Detailed usage examples |
| [Configuration](docs/CONFIGURATION.md) | YAML config, profiles, exclusions |
| [Multi-Profile Guide](docs/MULTI_PROFILE_GUIDE.md) | Parallel multi-customer audits |
| [Release Notes](docs/RELEASE_NOTES.md) | Version history |

---

## ๐Ÿค Contributing

1. **Report Issues** โ€” [Open an issue](https://github.com/kosty-cloud/kosty/issues)
2. **Add Services** โ€” Follow the pattern in `kosty/services/`
3. **Star the Repo** โ€” Show your support

---

## ๐Ÿ’ผ Professional Services

Free 30-minute assessment to discuss your AWS setup.

๐Ÿ“… [Book a call](https://calendly.com/consulting-kosty/30min) ยท ๐Ÿ“ง yassir@kosty.cloud ยท ๐ŸŒ [kosty.cloud](https://kosty.cloud?utm_source=github&utm_medium=readme)

---

## ๐Ÿ“„ License

MIT License โ€” see [LICENSE](LICENSE)

**๐Ÿ’ฐ Save money. Secure infrastructure. Ship faster.**

โญ Star this repo if Kosty saved you money