gcp-waf-cost-optimization
Google CloudのWell-Architected Frameworkに基づき、コスト最適化の視点からワークロードを評価し、請求データ分析、予算設定、リソース最適化、スポットVM活用、ストレージ管理、サーバーレス化など、FinOpsの実践を提案するSkill。
📜 元の英語説明(参考)
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.
🇯🇵 日本人クリエイター向け解説
Google CloudのWell-Architected Frameworkに基づき、コスト最適化の視点からワークロードを評価し、請求データ分析、予算設定、リソース最適化、スポットVM活用、ストレージ管理、サーバーレス化など、FinOpsの実践を提案するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o gcp-waf-cost-optimization.zip https://jpskill.com/download/14934.zip && unzip -o gcp-waf-cost-optimization.zip && rm gcp-waf-cost-optimization.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14934.zip -OutFile "$d\gcp-waf-cost-optimization.zip"; Expand-Archive "$d\gcp-waf-cost-optimization.zip" -DestinationPath $d -Force; ri "$d\gcp-waf-cost-optimization.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
gcp-waf-cost-optimization.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
gcp-waf-cost-optimizationフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
GCP Well-Architected Framework — コスト最適化
概要
クラウドは OpEx であり、CapEx ではありません。コストを適切に管理するには、可視性(どこにお金が使われているか?)、説明責任(各項目は誰が所有しているか?)、継続的な調整(各リソースはまだそのコストに見合っているか?)が必要です。このスキルでは、Google Cloud Well-Architected Framework のコスト最適化の柱を適用して、ワークロードを評価し、FinOps の制御を推奨します。
手順
基本原則
| 原則 | 実際の意味 |
|---|---|
| ビジネス価値に合わせた支出 | すべてのドルは、製品/チーム/機能に対応している必要があります。ビジネス指標に結びつかないインフラは拒否します。 |
| コスト意識の醸成 | 財務部門だけでなく、エンジニアにもダッシュボードを通じて支出を可視化します。 |
| リソース使用率の最適化 | 適切なサイジング、フォールトトレラントな場合に安価なコンピューティング(Spot)の使用、安定している場合はコミット(CUD) |
| 継続的な最適化 | コストレビューは定期的に行います。Recommender のインサイトに毎月対応します。 |
可視化レイヤー(基盤)
# BigQuery への課金エクスポートを有効にする — 詳細な分析に必要
gcloud beta billing accounts list # 課金アカウント ID を見つける
# 次にコンソールで: 課金 → エクスポート → BigQuery エクスポート → "詳細な使用コストデータ" を有効にする
-- コスト上位 20 のサービス(過去 30 日間)
SELECT
service.description AS service,
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 _PARTITIONTIME >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
GROUP BY service
ORDER BY net_usd DESC
LIMIT 20;
-- ラベル(env、team、app)別のコスト — 一貫したラベル付けが必要
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,
SUM(cost) AS cost_usd
FROM `my-project.billing_export.gcp_billing_export_resource_v1_*`
WHERE _PARTITIONTIME >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
GROUP BY team, env, service
ORDER BY cost_usd DESC;
予算とアラート
# 予測支出の 50%、90%、100% でアラートを出すプロジェクトごとの予算
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
Pub/Sub トピックを Cloud Functions にパイプして、開発/テストプロジェクトの予算の 95% で重要でないリソースを自動的に無効にします。
Active Assist による適切なサイジング
# プロジェクト全体の適切なサイジングの推奨事項を一覧表示する
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)'
# アイドル状態の VM (停止または削除を検討)
gcloud recommender recommendations list \
--project=my-project \
--location=us-central1-a \
--recommender=google.compute.instance.IdleResourceRecommender
# アイドル状態の永続ディスク
gcloud recommender recommendations list \
--project=my-project \
--location=us-central1-a \
--recommender=google.compute.disk.IdleResourceRecommender
より安価なコンピューティング
# Spot VM — 最大 91% 安価、30 秒前にプリエンプションされる可能性あり
gcloud compute instances create batch-worker \
--zone=us-central1-a \
--machine-type=n2-standard-4 \
--provisioning-model=SPOT \
--instance-termination-action=DELETE
# Committed Use Discount — 1 年または 3 年のコミットメント、安定したワークロードの場合 ~57% オフ
gcloud compute commitments create prod-commit-3y \
--region=us-central1 \
--resources=vcpu=64,memory=256 \
--plan=THIRTY_SIX_MONTH \
--type=GENERAL_PURPOSE
変動するワークロードの場合は、Cloud Run / Cloud Run functions / GKE Autopilot を使用します。プロビジョニングされた容量ではなく、実際のリクエスト秒数に対して料金を支払います。トラフィックの少ない API を Compute Engine VM から Cloud Run に移行すると、通常、コストが 70% 以上削減されます。
ストレージライフサイクルポリシー
# オブジェクトをより安価な階層に自動的に移動する
cat > lifecycle.json <<EOF
{
"lifecycle": {
"rule": [
{ "action": { "type": "SetStorageClass", "storageClass": "NEARLINE" },
"condition": { "age": 30 } },
{ "action": { "type": "SetStorageClass", "storageClass": "COLDLINE" },
"condition": { "age": 90 } },
{ "action": { "type": "SetStorageClass", "storageClass": "ARCHIVE" },
"condition": { "age": 365 } },
{ "action": { "type": "Delete" },
"condition": { "age": 2555 } }
]
}
}
EOF
gcloud storage buckets update gs://my-archive-bucket --lifecycle-file=lifecycle.json
ストレージクラスの料金(米国、GB/月あたり、概算):Standard $0.020、Nearline $0.010、Coldline $0.004、Archive $0.0012。ライフサイクルルールは、コールドデータでは数週間以内に元が取れます。
ワークロード評価の質問
ワークロードを評価する際は、以下を確認してください。
- BigQuery への課金エクスポートは有効になっており、月次レビューで使用されていますか?
- リソースの 100% に
env、team、appのラベルが付いていますか? - プロジェクト/ビジネスユニットごとに予算とアラートが構成されていますか?
- Active Assist の適切なサイジングの推奨事項は毎月レビューされていますか?
- CUD のカバレッジは、実際の安定した消費量に対してレビューされていますか?
- アイドル状態のディスク、IP、VM は毎月整理されていますか?
- 新しいワークロードは、そうでない明確な理由がない限り、デフォルトでサーバーレスですか?
- オブジェクトストレージバケットにライフサイクルポリシーはありますか?
- 開発/テストは、Spot、営業時間外のシャットダウン、または本番環境よりも安価な階層を使用していますか?
- 高価なデフォルト(リージョン、
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
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 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 beta 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,
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 _PARTITIONTIME >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
GROUP BY service
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,
SUM(cost) AS cost_usd
FROM `my-project.billing_export.gcp_billing_export_resource_v1_*`
WHERE _PARTITIONTIME >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
GROUP BY team, env, service
ORDER BY cost_usd DESC;
Budgets and Alerts
# Per-project budget with alerts at 50%, 90%, 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
Pipe the Pub/Sub topic to a Cloud Function that auto-disables non-critical resources at 95% of budget 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 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 with 30s notice
gcloud compute instances create batch-worker \
--zone=us-central1-a \
--machine-type=n2-standard-4 \
--provisioning-model=SPOT \
--instance-termination-action=DELETE
# Committed Use Discount — 1 or 3 year commit, ~57% off for stable workloads
gcloud compute commitments create prod-commit-3y \
--region=us-central1 \
--resources=vcpu=64,memory=256 \
--plan=THIRTY_SIX_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" },
"condition": { "age": 30 } },
{ "action": { "type": "SetStorageClass", "storageClass": "COLDLINE" },
"condition": { "age": 90 } },
{ "action": { "type": "SetStorageClass", "storageClass": "ARCHIVE" },
"condition": { "age": 365 } },
{ "action": { "type": "Delete" },
"condition": { "age": 2555 } }
]
}
}
EOF
gcloud storage buckets update gs://my-archive-bucket --lifecycle-file=lifecycle.json
Storage class pricing (US, per GB-month, approximate): Standard $0.020, Nearline $0.010, Coldline $0.004, Archive $0.0012. Lifecycle rules pay for themselves within weeks on cold data.
Workload Assessment Questions
When evaluating a workload, work through:
- Is BigQuery billing export enabled and used in monthly reviews?
- Are 100% of resources labeled with
env,team,app? - Are budgets + alerts configured per project / business unit?
- Are Active Assist rightsizing recommendations reviewed monthly?
- Is CUD coverage reviewed against actual stable consumption?
- Are idle disks, IPs, and VMs swept monthly?
- Are new workloads serverless-by-default unless there's a hard reason not to be?
- Do object storage buckets have lifecycle policies?
- Is dev/test on Spot, off-hours shutdown, or cheaper tiers than prod?
- Are there organization policies preventing expensive defaults (regions, machine types)?
Validation Checklist
- [ ] Cost attribution — 100% of resources carry
env,team,applabels - [ ] Granular visibility — BigQuery billing export enabled, queried in monthly reviews
- [ ] Budgets and alerts — every project / BU has a budget with 50%/90%/100% alerts
- [ ] Rightsizing — Active Assist recommendations reviewed and acted on monthly
- [ ] Commitments — CUD coverage reviewed monthly against stable consumption
- [ ] Idle resource sweeps — disks, IPs, VMs cleaned up monthly
- [ ] Managed services first — serverless preferred for new workloads
- [ ] Storage tiering — lifecycle policies on all archival buckets
- [ ] Org policies — region / machine type / external IP restrictions enforced
- [ ] Dev/test cost — non-prod runs on Spot, scales to zero, or shuts down off-hours
Examples
Example 1 — Monthly cost review for a startup
User shares last month's GCP bill ($15k, up from $9k). Pull billing-export data into BigQuery, group by service and label, identify the spike (a forgotten n2-standard-32 in dev with no auto-shutdown). Run Active Assist rightsizing across the project, surface 6 idle disks and 12 oversized VMs. Estimated savings: $4.2k/month. Recommend a CUD for the stable Compute Engine baseline (+$1.8k/month savings) and lifecycle policies on three archival buckets (+$200/month).
Example 2 — Architectural cost review of a new service
Team is designing a new background job processor. Default proposal is 6 always-on n2-standard-8 VMs ($1.4k/month). Recommend Cloud Run Jobs with --task-count matching peak burst — pay only for actual job seconds (~$200/month at expected volume). For the message queue, Pub/Sub instead of self-hosted RabbitMQ on GCE. For object storage, Standard tier with lifecycle to Coldline at 90 days.
Guidelines
- Labels first — without
env/team/applabels, every other recommendation is approximate - BigQuery billing export beats Console reports for any non-trivial analysis
- Budgets with Pub/Sub alerts — wire to a function that can auto-disable resources for dev/test
- Recommender insights are passive — schedule a monthly sweep, don't expect them to act themselves
- Spot VMs are the right default for any fault-tolerant workload (CI, batch, inference, dev/test)
- CUDs require >12 months of usage history to size correctly — never commit before that
- Migrate static-VM workloads to Cloud Run / Cloud Run Jobs / GKE Autopilot whenever possible
- Storage lifecycle policies pay for themselves in weeks; there's no reason not to set them
- For multi-team accounts, use Folders + per-folder budgets and aggregated billing rollups
- Set Org Policies to restrict regions and machine types — prevents accidentally provisioning the world's most expensive VM in Sydney