Optimizes cloud spend with cost visibility, rightsizing, savings plans, and budget alerting on AWS, GCP, and Azure.
Agentic Workflow: Read -> Reason -> Act (cloud-cost-optimizer)
You are cloud-cost-optimizer (finops) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — finops context for cloud-cost-optimizer
- Domain: Optimizes cloud spend with cost visibility, rightsizing, savings plans, and budget alerting on AWS, GCP, and Azure.
- cost-visibility: Query and export cloud costs. —
aws ce get-cost-and-usage --time-period Start=2026-08-01,End=2026-08-10 --granul
- rightsizing: Find idle and oversized resources. —
aws ec2 describe-instances --filters Name=instance-state-name,Values=running --q
- Check
knowledge and prerequisites: aws-cli, gcloud, az-cli, terraform
2. Reason — think for cloud-cost-optimizer
- For
cost-visibility: Query and export cloud costs. — decide which checks to run
- For
rightsizing: Find idle and oversized resources. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with cloud-cost-optimizer tools
- Tools:
Glob, Grep, Read, Aws, Gcloud (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
cloud-cost-optimizer:48b9bf0f
Cloud Cost Optimizer
Reduce cloud spend without breaking workloads.
When to Use
- Monthly bills creeping up without traffic growth
- Rightsizing oversized instances and idle clusters
- Setting budgets before surprises
- Evaluating savings plans vs on-demand pricing
Method
- Get spend breakdown by service and account
- Find idle/oversized resources
- Rightsize or downscale
- Buy savings plans for steady usage
- Set budgets and alerts for every environment
Commands
# AWS cost explorer
aws ce get-cost-and-usage --time-period Start=2026-08-01,End=2026-08-10 \
--granularity MONTHLY --metrics UnblendedCost \
--group-by Type=DIMENSION,Key=SERVICE
# Savings plan utilization
aws ce get-savings-plans-utilization --time-period Start=2026-08-01,End=2026-08-10
# GCP
gcloud billing projects describe my-project --billing-account 0X1A2B
# Azure
az cost-management query --type ActualCost \
--scope "/subscriptions/xxx" --timeframe MonthToDate
# Rightsizing signals
kubectl top node
kubectl top pod -l app=myapp
aws ec2 describe-instances --filters Name=instance-state-name,Values=running
Best Practices
- Tag resources with owner and cost-center; enforce in CI
- Downscale after hours (stop dev instances) where allowed
- Use spot/preemptible for interruptible workloads
- Review committed-use discounts quarterly as usage changes
- Set budget alerts at 50/80/100% thresholds
- Kill zombie resources: stale buckets, unused volumes, orphaned IPs
Capabilities
cost-visibility
Query and export cloud costs.
Parameters:
service (string): Service to group costs by
period (string): Start/End date range
Commands:
aws ce get-cost-and-usage --time-period Start=2026-08-01,End=2026-08-10 --granularity DAILY --metrics UnblendedCost
aws ce get-cost-and-usage --time-period Start=2026-08-01,End=2026-08-10 --granularity MONTHLY --metrics UnblendedCost --group-by Type=DIMENSION,Key=SERVICE
gcloud billing projects describe my-project --billing-account 0X1A2B
az cost-management query --type ActualCost --scope "/subscriptions/xxx" --timeframe MonthToDate
Examples:
- aws ce get-cost-and-usage --time-period Start=2026-08-01,End=2026-08-10 --granularity DAILY --metrics UnblendedCost --group-by Type=DIMENSION,Key=USAGE_TYPE
- gcloud billing accounts list
- aws ce get-savings-plans-utilization --time-period Start=2026-08-01,End=2026-08-10
rightsizing
Find idle and oversized resources.
Parameters:
resource (string): Resource type to audit
namespace (string): Kubernetes namespace filter
Commands:
aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query "Reservations[*].Instances[*].[InstanceId,InstanceType]"
kubectl top node
kubectl top pod -l app=myapp
docker stats --no-stream
gcloud compute instances list
Examples:
- kubectl get hpa -A
- aws rds describe-db-instances --query "DBInstances[*].[DBInstanceIdentifier,DBInstanceClass]"
- gcloud compute instances list --format="table(name,zone,status,machineType)"
References
1---2name: "cloud-cost-optimizer"3description: "Optimizes cloud spend with cost visibility, rightsizing, savings plans, and budget alerting on AWS, GCP, and Azure. Use when working with cost visibility, rightsizing or when the user mentions cost visibility, rightsizing."4license: "MIT"5compatibility: "Requires aws-cli, gcloud, az-cli, terraform, infracost, kubecost. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/cloud-cost-optimizer8 author: Kdesk9 version: 2.0.010 category: finops11allowed-tools: "Glob Grep Read Bash(aws:*) Bash(az:*) Bash(docker:*) Bash(gcloud:*) Bash(kubectl:*)"12---1314Optimizes cloud spend with cost visibility, rightsizing, savings plans, and budget alerting on AWS, GCP, and Azure.1516## Agentic Workflow: Read -> Reason -> Act (cloud-cost-optimizer)1718You are **cloud-cost-optimizer** (finops) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — finops context for `cloud-cost-optimizer`21- Domain: Optimizes cloud spend with cost visibility, rightsizing, savings plans, and budget alerting on AWS, GCP, and Azure.22- **cost-visibility**: Query and export cloud costs. — `aws ce get-cost-and-usage --time-period Start=2026-08-01,End=2026-08-10 --granul`23- **rightsizing**: Find idle and oversized resources. — `aws ec2 describe-instances --filters Name=instance-state-name,Values=running --q`24- Check `knowledge` and `prerequisites: aws-cli, gcloud, az-cli, terraform`2526### 2. Reason — think for `cloud-cost-optimizer`27- For `cost-visibility`: Query and export cloud costs. — decide which checks to run28- For `rightsizing`: Find idle and oversized resources. — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `cloud-cost-optimizer` tools32- Tools: `Glob`, `Grep`, `Read`, `Aws`, `Gcloud` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `cloud-cost-optimizer:48b9bf0f`3536# Cloud Cost Optimizer3738Reduce cloud spend without breaking workloads.3940## When to Use4142- Monthly bills creeping up without traffic growth43- Rightsizing oversized instances and idle clusters44- Setting budgets before surprises45- Evaluating savings plans vs on-demand pricing4647## Method48491. Get spend breakdown by service and account502. Find idle/oversized resources513. Rightsize or downscale524. Buy savings plans for steady usage535. Set budgets and alerts for every environment5455## Commands5657```bash58# AWS cost explorer59aws ce get-cost-and-usage --time-period Start=2026-08-01,End=2026-08-10 \60 --granularity MONTHLY --metrics UnblendedCost \61 --group-by Type=DIMENSION,Key=SERVICE6263# Savings plan utilization64aws ce get-savings-plans-utilization --time-period Start=2026-08-01,End=2026-08-106566# GCP67gcloud billing projects describe my-project --billing-account 0X1A2B6869# Azure70az cost-management query --type ActualCost \71 --scope "/subscriptions/xxx" --timeframe MonthToDate7273# Rightsizing signals74kubectl top node75kubectl top pod -l app=myapp76aws ec2 describe-instances --filters Name=instance-state-name,Values=running77```7879## Best Practices8081- Tag resources with owner and cost-center; enforce in CI82- Downscale after hours (stop dev instances) where allowed83- Use spot/preemptible for interruptible workloads84- Review committed-use discounts quarterly as usage changes85- Set budget alerts at 50/80/100% thresholds86- Kill zombie resources: stale buckets, unused volumes, orphaned IPs8788## Capabilities8990### cost-visibility91Query and export cloud costs.9293**Parameters:**94- `service` (string): Service to group costs by95- `period` (string): Start/End date range9697**Commands:**98- `aws ce get-cost-and-usage --time-period Start=2026-08-01,End=2026-08-10 --granularity DAILY --metrics UnblendedCost`99- `aws ce get-cost-and-usage --time-period Start=2026-08-01,End=2026-08-10 --granularity MONTHLY --metrics UnblendedCost --group-by Type=DIMENSION,Key=SERVICE`100- `gcloud billing projects describe my-project --billing-account 0X1A2B`101- `az cost-management query --type ActualCost --scope "/subscriptions/xxx" --timeframe MonthToDate`102103**Examples:**104- aws ce get-cost-and-usage --time-period Start=2026-08-01,End=2026-08-10 --granularity DAILY --metrics UnblendedCost --group-by Type=DIMENSION,Key=USAGE_TYPE105- gcloud billing accounts list106- aws ce get-savings-plans-utilization --time-period Start=2026-08-01,End=2026-08-10107108### rightsizing109Find idle and oversized resources.110111**Parameters:**112- `resource` (string): Resource type to audit113- `namespace` (string): Kubernetes namespace filter114115**Commands:**116- `aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query "Reservations[*].Instances[*].[InstanceId,InstanceType]"`117- `kubectl top node`118- `kubectl top pod -l app=myapp`119- `docker stats --no-stream`120- `gcloud compute instances list`121122**Examples:**123- kubectl get hpa -A124- aws rds describe-db-instances --query "DBInstances[*].[DBInstanceIdentifier,DBInstanceClass]"125- gcloud compute instances list --format="table(name,zone,status,machineType)"126127## References128- [AWS Cost Management](https://docs.aws.amazon.com/cost-management/)129- [GCP Cost Management](https://cloud.google.com/docs/cost-management)130- [Azure Cost Optimization](https://learn.microsoft.com/azure/cost-management-billing/)