finops-cost-optimization について
Oracle Cloud Infrastructure(OCI)のコストを管理する担当者向けに、最適化手法、見落としやすい課金要因、削減額の試算をまとめています。リソース調整、予算、Universal Credits、共有コスト配分を扱い、OCIコマンドと最新価格の確認も促します。
主な機能
- 01OCIの隠れた課金要因の把握
- 02リソース変更・移行による削減額の試算
- 03ストレージ階層と自動停止の最適化
- 04Universal Creditsの契約計画
- 05予算アラートと共有コスト配分
- 06未使用リソースの監査チェックリスト
活用シーン
- 01予想外の請求やコスト増加の調査
- 02予算計画と費用の見積もり
- 03未使用リソースと過剰構成の削減
- 04OCI構成ごとの削減額の比較
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ acedergren/ oci-agent-skills --skill finops-cost-optimizationインストール後、Claude Code で/finops-cost-optimizationを入力して読み込まれたか確認します。
同梱ファイルmetadata.jsonreferences/oci-cost-cli.md
詳細
OCI FinOps - 専門知識
🏗️ OCI Landing Zone Terraform モジュールを使用する
車輪の再発明は避けましょう。 コスト効率に優れたインフラストラクチャには、oracle-terraform-modules/landing-zone を使用してください。
Landing Zone で解決できること:
- ❌ 悪いプラクティス #3:スポークネットワークからのインターネットへのブレークアウト(エグレスコストの無駄が月額 3,000~5,000 ドル。Landing Zone では、NAT/ファイアウォールを一元管理するハブ&スポーク構成を使用します)
- ❌ 悪いプラクティス #8:独自の Terraform モジュールを作成する(保守コストが発生します。Landing Zone は Oracle が保守し、CIS 認定済みで、技術的負債もありません)
- ❌ 悪いプラクティス #10:モニタリングを行わない(支出が把握できなくなります。Landing Zone は予算アラート、使用量通知、コスト追跡を自動的に構成します)
このスキルが提供するもの:Landing Zone 内にデプロイされたリソースのコスト最適化戦略、隠れたコストの落とし穴、削減額の計算。
⚠️ OCI CLI/API に関する知識の不足
OCI CLI コマンドや OCI API の構造については把握していません。
トレーニングデータに含まれる次の知識は限られており、古くなっています。
- OCI CLI の構文とパラメーター(毎月更新)
- OCI API のエンドポイントとリクエスト/レスポンス形式
- Cost Management CLI の操作(
oci usage-api) - 現在の OCI 料金(頻繁に変更)
- Universal Credits の消費率と SKU
OCI の操作が必要な場合:
- スキルのリファレンスに記載されている正確な CLI コマンドを使用してください
- OCI CLI の構文やパラメーターを推測しないでください
- 現在の料金を決めつけず、必ず確認してください
- Oracle 公式の料金計算ツールを参照してください
把握していること:
- クラウドコスト最適化の一般原則
- FinOps のフレームワークと手法
- リソースの適正サイズ化の概念
このスキルは、OCI 固有の現在のコストの落とし穴と最適化パターンを提供することで、この知識の不足を補います。
あなたは OCI のコスト最適化エキスパートです。このスキルでは、Claude が持たない知識、つまり隠れたコストの落とし穴、Universal Credits の注意点、正確な削減額の計算、無料枠の最大活用、OCI 固有の請求に関する注意点を提供します。
絶対にしてはいけないこと
❌ 孤立したブートボリュームを絶対に放置しないでください(気付かないうちにコストが発生します)
# Default OCI behavior: Boot volumes PRESERVED after instance termination
oci compute instance terminate --instance-id <ocid> --force
# Instance deleted, but boot volume remains (charges continue!)
Cost trap:
- Boot volume: 50 GB × $0.025/GB/mo = $1.25/month per instance
- 20 terminated test instances = $25/month wasted
- Over 1 year: $300 wasted on deleted instances
# RIGHT - explicitly delete boot volume
oci compute instance terminate \
--instance-id <ocid> \
--preserve-boot-volume false # Critical flag!
# Or in Terraform:
resource "oci_core_instance" "dev" {
preserve_boot_volume = false # Must set explicitly
}
クリーンアップ戦略:7 日以上アタッチされていないブートボリュームを毎月監査します
❌ 未アタッチの予約済みパブリック IP にも料金が発生することを絶対に忘れないでください
Cost: $0.01/hour = $7.30/month per IP
# Common mistake: Reserve IP, detach from instance, forget to release
oci network public-ip create --lifetime RESERVED
# Later: delete instance but IP remains reserved (charges continue)
Wasted cost example:
- 5 old reserved IPs from deleted instances
- 5 × $7.30/month = $36.50/month waste
- Over 1 year: $438 wasted
# RIGHT - use ephemeral IPs for temporary resources
oci network public-ip create --lifetime EPHEMERAL
# Auto-deleted when instance terminated
# Or release reserved IPs explicitly
oci network public-ip delete --public-ip-id <ocid>
検出方法:インスタンスにアタッチされていない予約済み IP を一覧表示します
❌ 停止したリソースのコストがゼロになると絶対に思い込まないでください
Stopped Autonomous Database:
✓ Compute: Zero cost (stopped)
✗ Storage: $0.025/GB/mo continues
✗ Backups: Retention charges continue
Example: 1 TB ADB stopped for 30 days
Storage: 1000 GB × $0.025 = $25/month (charged!)
Stopped Compute Instance:
✓ Compute: Zero cost
✗ Boot volume: $0.025/GB/mo continues
✗ Block volumes: $0.025/GB/mo continues
✗ Reserved IP (if attached): $7.30/month continues
# Better for long-term idle (>30 days): TERMINATE + backup
# Restore from backup when needed
ルール:停止するとコンピュートは一時停止しますが、ストレージには引き続き料金が発生します
❌ データエグレスコストを絶対に無視しないでください(予想外の請求につながります)
OCI egress pricing:
- First 10 TB/month: FREE
- 10-50 TB: $0.0085/GB
- 50+ TB: Contact sales for discount
# Common mistake: Large data export
oci os object bulk-download --bucket-name backups --download-dir /local
# Downloading 15 TB = 5 TB chargeable × $0.0085/GB = $42,500 surprise!
# Cheaper alternatives:
1. Use OCI FastConnect (fixed cost, unlimited egress)
2. Download within same region (free between OCI services)
3. Export to another OCI region first (inter-region = free)
Cost comparison (15 TB export):
- Internet egress: $42,500
- FastConnect (1 Gbps): $1,100/month flat rate
- Breakeven: 130 GB/month egress
注意点:OCI リージョン間のエグレスは無料です(Oracle 内部ネットワーク)
❌ コストを理解せずに NAT Gateway を絶対に有効にしないでください
NAT Gateway pricing:
- Gateway itself: $0.01/hour = $7.30/month
- Data processed: $0.01/GB
# Mistake: Use NAT Gateway for high-traffic apps
Example: Application with 5 TB/month outbound traffic
- Gateway: $7.30/month
- Data: 5000 GB × $0.01 = $50/month
- Total: $57.30/month
# Cheaper alternative: Public IP on instance (ephemeral IP = free)
Cost: $0/month for egress <10 TB
When NAT Gateway makes sense:
- Private subnets with <100 GB/month egress
- Security requirement (no public IPs on instances)
When to avoid:
- High-traffic egress (use public IPs instead)
- Low-security dev/test environments
❌ Universal Credits を絶対に過剰にコミットしないでください
Universal Credits gotcha:
- Credits are NON-TRANSFERABLE between service categories
* Compute credits → can only pay for compute
* Database credits → can only pay for database
* Cannot move credits between categories
# Mistake: Commit to $10k/month compute credits
# Reality: Only use $6k/month compute
# Cannot use $4k surplus for database spending
# Result: Waste $4k/month ($48k/year)
# RIGHT - commit conservatively based on baseline usage
Analyze 3-6 months historical usage
Commit to 70-80% of baseline (not peak)
Expiration gotcha:
- Monthly credits expire end of month
- Cannot roll over to next month
- Use-it-or-lose-it model
❌ 予測予算を絶対に鵜呑みにしないでください(誤差率は 30~40%)
OCI Budget types:
1. ACTUAL: Alerts on actual spending (accurate)
2. FORECAST: Alerts on projected spending (often wrong)
# Problem: Forecast uses simple linear projection
Example:
- Week 1: $100 spend
- Forecast for month: $100 × 4 = $400
- Reality: Week 1 included one-time data migration
- Actual month: $150 total
- Forecast error: 167% over-prediction
# WRONG - rely on forecast alerts
Alert at 80% forecast → fires prematurely
# RIGHT - use actual spend alerts at multiple thresholds
Alert at 50% actual, 75% actual, 90% actual, 100% actual
ベストプラクティス:傾向の把握には FORECAST、予算編成には ACTUAL を使用します
コスト最適化戦略
シェイプ移行による削減額(正確な計算)
固定シェイプ → フレックスシェイプへの移行
Legacy fixed shape:
VM.Standard2.4: 4 OCPUs, 60 GB RAM (fixed ratio 1:15)
Cost: $0.06/hr × 4 = $0.24/hr = $175/month
Flex shape (right-sized):
VM.Standard.E4.Flex: 4 OCPUs, 16 GB RAM (custom ratio)
Cost: ($0.02/OCPU-hr × 4) + ($0.0015/GB-hr × 16) = $0.104/hr = $76/month
Savings: $99/month per instance (56% reduction)
Migration path:
1. Create flex instance with same OCPU count
2. Test with minimal RAM (4 GB per OCPU)
3. Increase RAM only if needed
4. Delete fixed instance
AMD → Arm への移行
AMD instance:
VM.Standard.E4.Flex: 4 OCPUs, 16 GB RAM
Cost: $0.02/OCPU-hr × 4 × 730 = $58.40/month
Arm instance (same workload):
VM.Standard.A1.Flex: 4 OCPUs, 16 GB RAM
Cost: $0.01/OCPU-hr × 4 × 730 = $29.20/month
Savings: $29.20/month per instance (50% reduction)
Gotcha: ARM64 architecture (not all apps compatible)
Check: Docker images available for ARM64?
無料枠の最大活用
正確なコスト回避額(支払わずに済む金額):
Always-Free tier value if fully utilized:
Compute:
- 2 AMD Micro VMs: 2 × $7/month = $14/month
- 4 Arm OCPUs (24 GB): 4 × $7.30/month = $29.20/month
Subtotal: $43.20/month
Database:
- 2 Autonomous Databases: 2 × $292/month = $584/month
Storage:
- 200 GB block: $5/month
- 10 GB object: $0.26/month
- 10 GB archive: $0.02/month
Subtotal: $5.28/month
Networking:
- 1 load balancer: $10/month
- 10 TB egress: $85/month
Subtotal: $95/month
TOTAL COST AVOIDED: $727.48/month ($8,730/year)
注意点:ADB の上限 2 台はテナンシー全体に適用されます(リージョン/コンパートメントごとではありません)
ストレージのライフサイクル最適化
自動階層化による削減額:
Scenario: 10 TB compliance data, accessed quarterly
Without tiering (all Standard):
10,000 GB × $0.0255/GB/mo = $255/month = $3,060/year
With tiering (Archive after 30 days):
Month 1 (Standard): 10,000 GB × $0.0255 = $255
Months 2-12 (Archive): 10,000 GB × $0.0024 × 11 = $264
Total year: $519
Savings: $2,541/year (83% reduction)
Lifecycle policy:
- Day 0-30: Standard (frequent access window)
- Day 31+: Archive (compliance retention)
- Retrieval cost: $0.01/GB (acceptable for quarterly access)
コンピュートの自動シャットダウンによる削減額
開発/テスト環境の自動化:
Scenario: 10 development instances, 2 OCPUs each
Running 24/7: 10 × 2 × $0.02/hr × 730 = $292/month
Auto-shutdown (weekdays 9am-6pm only):
Usage: 9 hours/day × 5 days = 45 hours/week = 195 hours/month
Cost: 10 × 2 × $0.02/hr × 195 = $78/month
Savings: $214/month (73% reduction)
Implementation:
1. Tag instances: Environment=Development
2. Create Functions for start/stop
3. Schedule with OCI Events:
- Start: Weekdays 9am
- Stop: Weekdays 6pm
Universal Credits の注意点
クレジットのカテゴリ(相互に譲渡できません):
| カテゴリ | 対象サービス | 典型的な用途 |
|---|---|---|
| コンピュート | VM、ベアメタル、コンテナインスタンス、OKE | アプリケーション、ワークロード |
| データベース | ADB、DB Systems、Exadata、MySQL | データストレージ、トランザクション |
| ストレージ | ブロック、オブジェクト、ファイル、アーカイブ | バックアップ、データレイク |
| ネットワーク | ロードバランサー、FastConnect、NAT GW | 接続、エグレス |
コミットメントの落とし穴:
Scenario: Commit to $5k/month database credits
Month 1-3: Use only $3k/month (waste $2k/month)
Cannot: Transfer $2k to compute spending
Result: Waste $6k over 3 months
Better approach:
1. Analyze 6 months baseline usage per category
2. Commit to 70% of baseline (room for variance)
3. Over-commit only if growth guaranteed
有効期限:月次クレジットは使い切りで、翌月に繰り越せません
コスト配賦の課題
共有リソースの配賦(OCI 固有):
Problem: How to allocate costs for shared VCN?
VCN costs:
- DRG: $0.01/hr = $7.30/month
- NAT Gateway: $0.01/hr + $0.01/GB = variable
- FastConnect: $1,100/month (1 Gbps)
Allocation strategies:
1. Equal split: $1,107.30 / N teams
2. Usage-based: Track egress per team (requires tagging)
3. Chargeback: Production pays 100%, dev/test free
Gotcha: OCI doesn't auto-allocate shared resource costs
Must implement manual showback/chargeback process
ロードバランサーのコスト配賦:
Problem: Multiple apps share 1 load balancer
LB costs:
- Flexible LB: $10/month + $0.008/LCU-hour
- Bandwidth: $0.01/GB processed
Allocation approach:
1. Tag backends by team (freeform_tags.Team)
2. Estimate traffic % per team (monitoring metrics)
3. Allocate LB cost proportionally
Example:
- Total LB cost: $50/month
- Team A: 60% traffic → $30/month
- Team B: 40% traffic → $20/month
予算管理のベストプラクティス
複数しきい値のアラート:
# Best practice: Set 4 alert levels
oci budgets alert-rule create \
--budget-id <ocid> \
--type ACTUAL \
--threshold 50 \
--recipients "[email protected]"
oci budgets alert-rule create \
--budget-id <ocid> \
--type ACTUAL \
--threshold 80 \
--recipients "[email protected],[email protected]"
oci budgets alert-rule create \
--budget-id <ocid> \
--type ACTUAL \
--threshold 90 \
--recipients "[email protected],[email protected],[email protected]"
oci budgets alert-rule create \
--budget-id <ocid> \
--type ACTUAL \
--threshold 100 \
--recipients "[email protected],[email protected],[email protected]"
Alert strategy:
50%: FYI to team (informational)
80%: Action required (investigate spike)
90%: Escalation to management
100%: Finance involved (budget exceeded)
注意点:予算はアラート通知のみで、支出を制限するものではありません(支出をブロックできません)。
隠れたコストの検出
月次監査チェックリスト:
# 1. Orphaned boot volumes (cost trap #1)
oci bv boot-volume list --all --lifecycle-state AVAILABLE \
| grep -v "attached-instance"
# 2. Unattached block volumes
oci bv volume list --all --lifecycle-state AVAILABLE
# 3. Reserved IPs without instance
oci network public-ip list --scope REGION --lifetime RESERVED
# 4. Stopped instances with volumes
oci compute instance list --lifecycle-state STOPPED
# 5. Old snapshots/backups
oci bv backup list --all \
| jq '.data[] | select(.["time-created"] < "2024-01-01")'
# 6. Unused load balancers (no backends)
oci lb load-balancer list --all
# 7. Empty Object Storage buckets
oci os bucket list --all --fields approximateCount,approximateSize
推定月間削減額:一般的なテナンシーで $100~500(無駄なリソースのクリーンアップ)
段階的な読み込みに関する参照情報
OCI Cost Management CLI
次の場合に読み込む oci-cost-cli.md:
- 予算とアラートルールの設定
- CLI を使用した使用状況レポートの照会
- サービス制限とクォータの管理
- コスト配賦のためのタグ付けの実装
- 詳細なコストレポートのダウンロード
次の場合は読み込まないでください:
- 簡単なコスト計算(上記の表と例で説明済み)
- コスト上の落とし穴の把握(上記に必ず一覧表示されています)
- シェイプの料金比較(上記で説明済み)
Oracle 公式ドキュメントのソース
主な参照先(200 件以上の公式ソースをスクレイピング):
注:このスキルに記載されているコスト計算、落とし穴、注意点はすべて、これらの公式ソースと A-Team Oracle ブログに基づいています。
このスキルを使用する場面
- 予期しない請求:料金を調査し、コストの急増を特定する
- 予算計画:コストを見積もり、予算を設定し、予測する
- コスト最適化:適正なサイズへの変更、無駄の削減、シェイプの移行
- Free tier:Always Free の利用を最大化し、過剰なプロビジョニングを避ける
- Universal Credits:コミットメントの計画、クレジットの割り当て
- コスト配賦:ショーバック、チャージバック、共有リソースのコスト
- 削減額の計算:選択肢の比較、ROI 分析