Infrastructure cost optimization

From aj-geddes/useful-ai-prompts · View interactive version

Infrastructure cost optimization is an AI agent skill from the GitHub repository aj-geddes/useful-ai-prompts. Optimize cloud infrastructure costs through resource rightsizing, reserved instances, spot instances, and waste reduction strategies.

How to use this skill

Skill file

Infrastructure Cost Optimization

Table of Contents

Overview

Reduce infrastructure costs through intelligent resource allocation, reserved instances, spot instances, and continuous optimization without sacrificing performance.

When to Use

Quick Start

Minimal working example:

# cost-optimization-setup.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: cost-optimization-scripts
  namespace: operations
data:
  analyze-costs.sh: |
    #!/bin/bash
    set -euo pipefail

    echo "=== AWS Cost Analysis ==="

    # Get daily cost trend
    echo "Daily costs for last 7 days:"
    aws ce get-cost-and-usage \
      --time-period Start=$(date -d '7 days ago' +%Y-%m-%d),End=$(date +%Y-%m-%d) \
      --granularity DAILY \
      --metrics "BlendedCost" \
      --group-by Type=DIMENSION,Key=SERVICE \
      --query 'ResultsByTime[*].[TimePeriod.Start,Total.BlendedCost.Amount]' \
      --output table

    # Find unattached resources
    echo -e "\n=== Unattached EBS Volumes ==="
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

| Guide | Contents |

|---|---|

| AWS Cost Optimization Configuration | AWS Cost Optimization Configuration |

| Kubernetes Cost Optimization | Kubernetes Cost Optimization |

| Cost Monitoring Dashboard | Cost Monitoring Dashboard |

Best Practices

✅ DO

❌ DON'T

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.