gcp-cost-optimizer
Analyzes GCP costs and provides optimization recommendations including committed use discounts, rightsizing, and unused resources. Use when optimizing GCP spending or analyzing GCP costs.
Works with
--- name: gcp-cost-optimizer description: Analyzes GCP costs and provides optimization recommendations including committed use discounts, rightsizing, and unused resources. Use when optimizing GCP spending or analyzing GCP costs. license: MIT --- # GCP Cost Optimizer ## Quick Start Analyze GCP costs and implement optimization strategies to reduce spending. ## Instructions ### Step 1: Analyze current costs ```bash # View billing data gcloud billing accounts list # Export billing data to BigQuery gcloud billing accounts projects link PROJECT_ID \ --billing-account=BILLING_ACCOUNT_ID # Query costs bq query --use_legacy_sql=false \ 'SELECT service.description, SUM(cost) as total_cost FROM `project.dataset.gcp_billing_export` WHERE DATE(_PARTITIONTIME) >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY) GROUP BY service.description ORDER BY total_cost DESC' ``` ### Step 2: Identify optimization opportunities **Committed Use Discounts:** - 1-year or 3-year commitments - Up to 57% savings for Compute Engine - Up to 70% savings for Cloud SQL **Sustained Use Discounts:** - Automatic discounts for running instances - Up to 30% for instances running >25% of month **Preemptible VMs:** - Up to 80% savings - Suitable for fault-tolerant workloads **Rightsizing:** - Use Recommender API for suggestions - Downsize overprovisioned instances - Adjust machine types ### Step 3: Implement cost-saving measures ```bash # Get rightsizing recommendations gcloud recommender recommendations list \ --project=PROJECT_ID \ --location=us-central1 \ --recommender=google.compute.instance.MachineTypeRecommender # Apply recommendation gcloud recommender recommendations mark-claimed \ RECOMMENDATION_ID \ --project=PROJECT_ID \ --location=us-central1 \ --recommender=google.compute.instance.MachineTypeRecommender ``` ## Best Practices 1. Enable billing export to BigQuery 2. Set up budget alerts 3. Use labels for cost allocation 4. Review Recommender suggestions monthly 5. Implement committed use discounts for stable workloads 6. Use preemptible VMs for batch processing 7. Clean up unused resources regularly 8. Optimize storage classes
More DevOps & Infrastructure skills
azure-ai
microsoft/azure-skills
Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.
appinsights-instrumentation
microsoft/azure-skills
Guidance for instrumenting webapps with Azure Application Insights. Provides telemetry patterns, SDK setup, and configuration references. WHEN: how to instrument app, App Insights SDK, telemetry patterns, what is App Insights, Application Insights guidance, instrumentation examples, APM best practices.
azure-storage
microsoft/azure-skills
Azure Storage Services including Blob Storage, File Shares, Queue Storage, Table Storage, and Data Lake. Answers questions about storage access tiers (hot, cool, cold, archive), when to use each tier, and tier comparison. Provides object storage, SMB file shares, async messaging, NoSQL key-value, and big data analytics. Includes lifecycle management. USE FOR: blob storage, file shares, queue storage, table storage, data lake, upload files, download blobs, storage accounts, access tiers, storage tiers, hot cool cold archive, storage tier comparison, when to use storage tiers, lifecycle management, Azure Storage concepts. DO NOT USE FOR: SQL databases, Cosmos DB (use azure-prepare), messaging with Event Hubs or Service Bus (use azure-messaging).

