gcp-waf-cost-optimization
БесплатноБез исполняемых скриптовНе проверенApply the Google Cloud Well-Architected Framework's Cost Optimization pillar to evaluate workloads and recommend FinOps practices — billing exports, budgets…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
GCP Well-Architected Framework — Cost Optimization
Overview
Cloud is OpEx, not CapEx — getting cost right requires visibility (where is money going?), accountability (who owns each line item?), and continuous tuning (is each resource still earning its cost?). This skill applies the Google Cloud Well-Architected Framework's Cost Optimization pillar to evaluate a workload and recommend FinOps controls.
Instructions
Core Principles
| Principle | What it means in practice |
|---|---|
| Align spending with business value | Every dollar should map to a product/team/feature; reject infra that doesn't tie back to a business metric |
| Foster a culture of cost awareness | Make spend visible to engineers via dashboards, not just to finance |
| Optimize resource usage | Rightsize, use cheap-when-fault-tolerant compute (Spot), commit when stable (CUDs) |
| Optimize continuously | Cost reviews are recurring; act on Recommender insights monthly |
Visibility Layer (Foundation)
# Enable BigQuery billing export — required for granular analysis
gcloud billing accounts list # find your billing account ID
# Then in Console: Billing → Export → BigQuery export → enable "Detailed usage cost data"
-- Top 20 services by cost, last 30 days
SELECT
service.description AS service_name,
SUM(cost) AS cost_usd,
SUM(IFNULL((SELECT SUM(c.amount) FROM UNNEST(credits) c), 0)) AS credits_usd,
SUM(cost) + SUM(IFNULL((SELECT SUM(c.amount) FROM UNNEST(credits) c), 0)) AS net_usd
FROM `my-project.billing_export.gcp_billing_export_resource_v1_*`
WHERE usage_start_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
GROUP BY service_name
ORDER BY net_usd DESC
LIMIT 20;
-- Cost by label (env, team, app) — requires consistent labeling
SELECT
(SELECT value FROM UNNEST(labels) WHERE key = 'team') AS team,
(SELECT value FROM UNNEST(labels) WHERE key = 'env') AS env,
service.description AS service_name,
SUM(cost) AS cost_usd
FROM `my-project.billing_export.gcp_billing_export_resource_v1_*`
WHERE usage_start_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
GROUP BY team, env, service_name
ORDER BY cost_usd DESC;
Budgets and Alerts
# Per-project budget: alerts at 50% and 90% of actual spend, 100% of forecasted spend
gcloud billing budgets create \
--billing-account=BILLING_ACCOUNT_ID \
--display-name="prod-monthly-budget" \
--budget-amount=10000USD \
--threshold-rule=percent=0.5,basis=current-spend \
--threshold-rule=percent=0.9,basis=current-spend \
--threshold-rule=percent=1.0,basis=forecasted-spend \
--filter-projects=projects/my-project \
--notifications-rule-pubsub-topic=projects/my-project/topics/billing-alerts
Budgets only notify; they do not cap spend. Pipe the Pub/Sub topic to a Cloud Run function that disables non-critical resources for dev/test projects.
Rightsizing via Active Assist
# List rightsizing recommendations across the project
gcloud recommender recommendations list \
--project=my-project \
--location=us-central1-a \
--recommender=google.compute.instance.MachineTypeRecommender \
--format='table(content.overview.currentMachineType, content.overview.recommendedMachineType, primaryImpact.costProjection.cost.units)'
# Idle VMs (consider stopping or deleting)
gcloud recommender recommendations list \
--project=my-project \
--location=us-central1-a \
--recommender=google.compute.instance.IdleResourceRecommender
# Idle reserved external IP addresses
gcloud recommender recommendations list \
--project=my-project \
--location=us-central1 \
--recommender=google.compute.address.IdleResourceRecommender
# Idle persistent disks
gcloud recommender recommendations list \
--project=my-project \
--location=us-central1-a \
--recommender=google.compute.disk.IdleResourceRecommender
Cheaper Compute
# Spot VMs — up to 91% cheaper; can be preempted at any time (best-effort 30s shutdown)
gcloud compute instances create batch-worker \
--zone=us-central1-a \
--machine-type=n2-standard-4 \
--provisioning-model=SPOT \
--instance-termination-action=DELETE
# Resource-based Committed Use Discount — plan is 12-month or 36-month; up to 55% off
# (70% for memory-optimized series) for stable workloads
gcloud compute commitments create prod-commit-3y \
--region=us-central1 \
--resources=vcpu=64,memory=256GB \
--plan=36-month \
--type=general-purpose
For variable workloads, use Cloud Run / Cloud Run functions / GKE Autopilot — pay for actual request seconds, not provisioned capacity. Migrating a low-traffic API from a Compute Engine VM to Cloud Run typically cuts cost 70%+.
Storage Lifecycle Policies
# Move objects to cheaper tiers automatically
cat > lifecycle.json <<EOF
{
"lifecycle": {
"rule": [
{ "action": { "type": "SetStorageClass", "storageClass": "NEARLINE" },
Установить gcp-waf-cost-optimization в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл gcp-waf-cost-optimization?
Apply the Google Cloud Well-Architected Framework's Cost Optimization pillar to evaluate workloads and recommend FinOps practices — billing exports, budgets, rightsizing via Active Assist, Spot VMs, Committed Use Discounts, storage lifecycle policies, and serverless adoption. Use for cloud cost reviews, monthly billing analysis, and architecture cost decisions.
Как установить скилл gcp-waf-cost-optimization?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл gcp-waf-cost-optimization запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic