Aws cost optimization

From phenobarbital/navigator · View interactive version

Aws cost optimization is an AI agent skill from the GitHub repository phenobarbital/navigator. Evaluate AWS costs and generate actionable optimization suggestions. Covers EC2, S3, RDS, Lambda, ECS/EKS, and data transfer. Use when analyzing AWS spending, right-sizing resources, choosing pricing models (RI/Savings Plans/Spot), implementing tagging strategies, setting budget alerts, or auditing

How to use this skill

Skill file

AWS Cost Optimization

Evaluate current AWS costs and produce actionable optimization suggestions across compute, storage, networking, and managed services.

Do not use this skill when

Instructions

  1. Identify the AWS services in scope (EC2, S3, RDS, Lambda, etc.).
  2. Apply the Cost Optimization Framework top-to-bottom: Visibility → Right-Sizing → Pricing → Architecture.
  3. For each service, check the Service-Specific Quick Reference below.
  4. Generate a prioritized list of suggestions with estimated savings.
  5. For Terraform/CLI/boto3 implementation details, open references/implementation-playbook.md.

Cost Optimization Framework

1. Visibility — Know What You Spend

| Action | Tool / Service |

|--------|---------------|

| Cost allocation tags on every resource | AWS Tag Editor, Tag Policies |

| Monthly/daily spend dashboards | Cost Explorer, QuickSight |

| Budget alerts at 50 %, 80 %, 100 % | AWS Budgets |

| Anomaly detection | AWS Cost Anomaly Detection |

| Per-team / per-env cost breakdown | Cost Categories, Linked Accounts |

2. Right-Sizing — Stop Over-Provisioning

| Signal | Action |

|--------|--------|

| CPU < 20 % sustained | Downsize instance family or switch to Graviton |

| Memory < 30 % sustained | Use memory-optimized → general purpose |

| EBS IOPS < provisioned | Switch gp3 / reduce provisioned IOPS |

| Idle resource (EIP, ELB, NAT, EBS) | Delete or stop |

| Lambda memory > 2× needed | Run aws lambda get-function-configuration and tune |

Use AWS Compute Optimizer and Trusted Advisor for automated right-sizing recommendations.

3. Pricing Models — Pay Less Per Unit

| Model | Savings | Best For | Commitment |

|-------|---------|----------|------------|

| On-Demand | 0 % | Spiky, unpredictable | None |

| Savings Plans (Compute) | up to 66 % | Steady compute (EC2, Fargate, Lambda) | 1 or 3 yr |

| Savings Plans (EC2 Instance) | up to 72 % | Known instance family & region | 1 or 3 yr |

| Reserved Instances (Standard) | up to 72 % | Steady-state, known type | 1 or 3 yr |

| Reserved Instances (Convertible) | up to 54 % | Steady-state, flexible type | 1 or 3 yr |

| Spot Instances | up to 90 % | Fault-tolerant batch, CI/CD, HPC | None (2-min notice) |

Decision heuristic:

  1. Steady 24/7 → Savings Plan or RI
  2. Batch / stateless → Spot with On-Demand fallback
  3. Unknown workload → start On-Demand, analyze with Cost Explorer, then commit

4. Architecture — Spend Smarter

| Pattern | Why |

|---------|-----|

| Serverless First | Zero idle cost; Lambda, Step Functions, EventBridge |

| Graviton (ARM) instances | 20-40 % cheaper at same performance |

| Multi-tier S3 storage | Auto-transition hot → IA → Glacier → Deep Archive |

| Caching (ElastiCache, CloudFront) | Reduce origin hits and data transfer |

| VPC Endpoints | Eliminate NAT Gateway data processing charges |

| Regional consolidation | Reduce cross-region transfer costs |


Service-Specific Quick Reference

EC2

S3

| Storage Class | Use Case | vs Standard |

|---------------|----------|-------------|

| Standard | Frequently accessed | baseline |

| Standard-IA | Accessed < 1×/month | –45 % |

| One Zone-IA | Non-critical, infrequent | –60 % |

| Glacier Instant Retrieval | Quarterly access, ms retrieval | –68 % |

| Glacier Flexible Retrieval | Annual access, hours retrieval | –78 % |

| Deep Archive | Compliance / 7-yr retention | –95 % |

Implement S3 Intelligent-Tiering when access patterns are unpredictable.

Use S3 Lifecycle rules for deterministic transitions (see playbook).

RDS / Aurora

| Environment | Recommended Tier |

|-------------|-----------------|

| Development | db.t4g.micro – db.t4g.small |

| Staging | db.t4g.medium – db.t4g.large |

| Production | db.r7g.xlarge + read replicas |

Lambda

ECS / EKS

Data Transfer

| Path | Cost | Mitigation |

|------|------|------------|

| Same AZ | Free | Co-locate services |

| Cross-AZ | $0.01/GB each way | Use AZ-aware routing |

| Internet egress | $0.09/GB first 10 TB | CloudFront ($0.085/GB), S3 Transfer Acceleration |

| Cross-region | $0.02/GB | Consolidate regions; use Global Accelerator |

| NAT Gateway processing | $0.045/GB | VPC Endpoints for S3/DynamoDB |


Tagging Strategy (Mandatory)

Every AWS resource MUST have these tags:

| Tag Key | Example | Purpose |

|---------|---------|---------|

| Environment | production | Filter by env |

| Project | navigator | Cost allocation |

| CostCenter | engineering | Chargeback |

| Owner | team@example.com | Accountability |

| ManagedBy | terraform | Audit |

Enforce via AWS Organizations Tag Policies and SCP deny rules.


Cost Evaluation Workflow

When asked to evaluate costs, follow this sequence:

  1. Inventory: List services, instance types, storage volumes, and data flows.
  2. Tag audit: Check for missing cost-allocation tags.
  3. Utilization check: Review CloudWatch metrics (CPU, memory, IOPS, network).
  4. Pricing check: Compare current pricing model vs optimal (RI/SP/Spot).
  5. Architecture review: Identify unnecessary data transfer, missing caching, idle resources.
  6. Report: Produce a table of findings with:

Tools

Implementation Details

For Terraform, AWS CLI, and boto3 code examples, see implementation-playbook.md.

Related Skills

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.