Files
scripts/utils/analyze-costs.sh
2026-02-09 21:51:52 -08:00

63 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Load shared libraries
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../lib/init.sh"
# Script to analyze and optimize infrastructure costs
set -e
echo "💰 Analyzing infrastructure costs..."
# Check for cost tracking files
if [ -f "infrastructure/costs.md" ]; then
echo "✅ Cost tracking file found"
cat infrastructure/costs.md
else
echo "📝 Creating cost tracking template..."
cat > infrastructure/costs.md << 'EOF'
# Infrastructure Cost Tracking
## Monthly Costs
### Compute
- Kubernetes clusters: $XXX
- VMs: $XXX
- Containers: $XXX
### Storage
- Database: $XXX
- Object storage: $XXX
- Backups: $XXX
### Network
- Data transfer: $XXX
- CDN: $XXX
### Monitoring
- Prometheus/Grafana: $XXX
- Logging: $XXX
## Cost Optimization Opportunities
1. Consolidate infrastructure (30-40% savings)
2. Right-size resources (20-30% savings)
3. Use reserved instances (30-70% savings)
4. Optimize storage (10-20% savings)
## Targets
- **Current**: $XXX/month
- **Target**: $XXX/month (30-40% reduction)
- **Timeline**: 3-6 months
EOF
echo "✅ Cost tracking template created"
fi
echo ""
echo "📝 See docs/COST_OPTIMIZATION.md for optimization strategies"