Optimize cloud costs across AWS, Azure, GCP

Cloud Cost Optimization

by wshobson · MIT license · ★ 39,857 on GitHub · updated Sep 21

Cloud Cost Optimization cover

Optimize cloud costs across AWS, Azure, GCP, and OCI through resource rightsizing, tagging strategies, reserved instances, and spending analysis. Use when reducing cloud expenses, analyzing infrastructure costs, or implementing cost…

---
name: cost-optimization
description: Optimize cloud costs across AWS, Azure, GCP, and OCI through resource rightsizing, tagging strategies, reserved instances, and spending analysis. Use when reducing cloud expenses, analyzing infrastructure costs, or implementing cost governance policies.
---

# Cloud Cost Optimization

Strategies and patterns for optimizing cloud costs across AWS, Azure, GCP, and OCI.

## Purpose

Implement systematic cost optimization strategies to reduce cloud spending while maintaining performance and reliability.

## When to Use

- Reduce cloud spending
- Right-size resources
- Implement cost governance

Overview

Strategies and patterns for optimizing cloud costs across AWS, Azure, GCP, and OCI.

Manual install (npx, ZIP)
Claude Codenpx skills add wshobson/agents --skill cost-optimization -g -a claude-code
Claude Code (manual)mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/wshobson/agents/tar.gz/4236bb91f839 \ | tar -xz -C ~/.claude/skills --strip-components=4 agents-4236bb91f839/plugins/cloud-infrastructure/skills/cost-optimization
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/6cbb23e698c77db32858/cost-optimization.zip" -OutFile "$env:TEMP\cost-optimization.zip"; Expand-Archive "$env:TEMP\cost-optimization.zip" -DestinationPath "$HOME\.claude\skills" -Force
Claude.ai / desktopDownload the ZIP and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md6.7 KB
  • references/1 file · 832 B
Read the files here
wshobson/4236bb92 files
SKILL.md
Show the full text314 lines

Cloud Cost Optimization

Strategies and patterns for optimizing cloud costs across AWS, Azure, GCP, and OCI.

Purpose

Implement systematic cost optimization strategies to reduce cloud spending while maintaining performance and reliability.

When to Use

  • Reduce cloud spending
  • Right-size resources
  • Implement cost governance
  • Optimize multi-cloud costs
  • Meet budget constraints

Cost Optimization Framework

1. Visibility
  • Implement cost allocation tags
  • Use cloud cost management tools
  • Set up budget alerts
  • Create cost dashboards
2. Right-Sizing
  • Analyze resource utilization
  • Downsize over-provisioned resources
  • Use auto-scaling
  • Remove idle resources
3. Pricing Models
  • Use reserved capacity
  • Leverage spot/preemptible instances
  • Implement savings plans
  • Use committed use discounts
4. Architecture Optimization
  • Use managed services
  • Implement caching
  • Optimize data transfer
  • Use lifecycle policies

AWS Cost Optimization

Reserved Instances
Savings: 30-72% vs On-Demand
Term: 1 or 3 years
Payment: All/Partial/No upfront
Flexibility: Standard or Convertible
Savings Plans
Compute Savings Plans: 66% savings
EC2 Instance Savings Plans: 72% savings
Applies to: EC2, Fargate, Lambda
Flexible across: Instance families, regions, OS
Spot Instances
Savings: Up to 90% vs On-Demand
Best for: Batch jobs, CI/CD, stateless workloads
Risk: 2-minute interruption notice
Strategy: Mix with On-Demand for resilience
S3 Cost Optimization
resource "aws_s3_bucket_lifecycle_configuration" "example" {
  bucket = aws_s3_bucket.example.id

  rule {
    id     = "transition-to-ia"
    status = "Enabled"

    transition {
      days          = 30
      storage_class = "STANDARD_IA"
    }

    transition {
      days          = 90
      storage_class = "GLACIER"
    }

    expiration {
      days = 365
    }
  }
}

Azure Cost Optimization

Reserved VM Instances
  • 1 or 3 year terms
  • Up to 72% savings
  • Flexible sizing
  • Exchangeable
Azure Hybrid Benefit
  • Use existing Windows Server licenses
  • Up to 80% savings with RI
  • Available for Windows and SQL Server
Azure Advisor Recommendations
  • Right-size VMs
  • Delete unused resources
  • Use reserved capacity
  • Optimize storage

GCP Cost Optimization

Committed Use Discounts
  • 1 or 3 year commitment
  • Up to 57% savings
  • Applies to vCPUs and memory
  • Resource-based or spend-based
Sustained Use Discounts
  • Automatic discounts
  • Up to 30% for running instances
  • No commitment required
  • Applies to Compute Engine, GKE
Preemptible VMs
  • Up to 80% savings
  • 24-hour maximum runtime
  • Best for batch workloads

OCI Cost Optimization

Flexible Shapes
  • Scale OCPUs and memory independently
  • Match instance sizing to workload demand
  • Reduce wasted capacity from fixed VM shapes
Commitments and Budgets
  • Use annual commitments for predictable spend
  • Set compartment-level budgets with alerts
  • Track monthly forecasts with OCI Cost Analysis
Preemptible Capacity
  • Use preemptible instances for batch and ephemeral workloads
  • Keep interruption-tolerant autoscaling groups
  • Mix with standard capacity for critical services

Tagging Strategy

AWS Tagging
locals {
  common_tags = {
    Environment = "production"
    Project     = "my-project"
    CostCenter  = "engineering"
    Owner       = "[email protected]"
    ManagedBy   = "terraform"
  }
}

resource "aws_instance" "example" {
  ami           = "ami-12345678"
  instance_type = "t3.medium"

  tags = merge(
    local.common_tags,
    {
      Name = "web-server"
    }
  )
}

Reference: See references/tagging-standards.md

Cost Monitoring

Budget Alerts
# AWS Budget
resource "aws_budgets_budget" "monthly" {
  name              = "monthly-budget"
  budget_type       = "COST"
  limit_amount      = "1000"
  limit_unit        = "USD"
  time_period_start = "2024-01-01_00:00"
  time_unit         = "MONTHLY"

  notification {
    comparison_operator        = "GREATER_THAN"
    threshold                  = 80
    threshold_type            = "PERCENTAGE"
    notification_type         = "ACTUAL"
    subscriber_email_addresses = ["[email protected]"]
  }
}
Cost Anomaly Detection
  • AWS Cost Anomaly Detection
  • Azure Cost Management alerts
  • GCP Budget alerts
  • OCI Budgets and Cost Analysis

Architecture Patterns

Pattern 1: Serverless First
  • Use Lambda/Functions for event-driven
  • Pay only for execution time
  • Auto-scaling included
  • No idle costs
Pattern 2: Right-Sized Databases
Development: t3.small RDS
Staging: t3.large RDS
Production: r6g.2xlarge RDS with read replicas
Pattern 3: Multi-Tier Storage
Hot data: S3 Standard
Warm data: S3 Standard-IA (30 days)
Cold data: S3 Glacier (90 days)
Archive: S3 Deep Archive (365 days)
Pattern 4: Auto-Scaling
resource "aws_autoscaling_policy" "scale_up" {
  name                   = "scale-up"
  scaling_adjustment     = 2
  adjustment_type        = "ChangeInCapacity"
  cooldown              = 300
  autoscaling_group_name = aws_autoscaling_group.main.name
}

resource "aws_cloudwatch_metric_alarm" "cpu_high" {
  alarm_name          = "cpu-high"
  comparison_operator = "GreaterThanThreshold"
  evaluation_periods  = "2"
  metric_name         = "CPUUtilization"
  namespace           = "AWS/EC2"
  period              = "60"
  statistic           = "Average"
  threshold           = "80"
  alarm_actions       = [aws_autoscaling_policy.scale_up.arn]
}

Cost Optimization Checklist

  • Implement cost allocation tags
  • Delete unused resources (EBS, EIPs, snapshots)
  • Right-size instances based on utilization
  • Use reserved capacity for steady workloads
  • Implement auto-scaling
  • Optimize storage classes
  • Use lifecycle policies
  • Enable cost anomaly detection
  • Set budget alerts
  • Review costs weekly
  • Use spot/preemptible instances
  • Optimize data transfer costs
  • Implement caching layers
  • Use managed services
  • Monitor and optimize continuously

Tools

  • AWS: Cost Explorer, Cost Anomaly Detection, Compute Optimizer
  • Azure: Cost Management, Advisor
  • GCP: Cost Management, Recommender
  • OCI: Cost Analysis, Budgets, Cloud Advisor
  • Multi-cloud: CloudHealth, Cloudability, Kubecost
  • terraform-module-library - For resource provisioning
  • multi-cloud-architecture - For cloud selection
1---
2name: cost-optimization
3description: Optimize cloud costs across AWS, Azure, GCP, and OCI through resource rightsizing, tagging strategies, reserved instances, and spending analysis. Use when reducing cloud expenses, analyzing infrastructure costs, or implementing cost governance policies.
4---
5 
6# Cloud Cost Optimization
7 
8Strategies and patterns for optimizing cloud costs across AWS, Azure, GCP, and OCI.
9 
10## Purpose
11 
12Implement systematic cost optimization strategies to reduce cloud spending while maintaining performance and reliability.
13 
14## When to Use
15 
16- Reduce cloud spending
17- Right-size resources
18- Implement cost governance
19- Optimize multi-cloud costs
20- Meet budget constraints
21 
22## Cost Optimization Framework
23 
24### 1. Visibility
25 
26- Implement cost allocation tags
27- Use cloud cost management tools
28- Set up budget alerts
29- Create cost dashboards
30 
31### 2. Right-Sizing
32 
33- Analyze resource utilization
34- Downsize over-provisioned resources
35- Use auto-scaling
36- Remove idle resources
37 
38### 3. Pricing Models
39 
40- Use reserved capacity
41- Leverage spot/preemptible instances
42- Implement savings plans
43- Use committed use discounts
44 
45### 4. Architecture Optimization
46 
47- Use managed services
48- Implement caching
49- Optimize data transfer
50- Use lifecycle policies
51 
52## AWS Cost Optimization
53 
54### Reserved Instances
55 
56```
57Savings: 30-72% vs On-Demand
58Term: 1 or 3 years
59Payment: All/Partial/No upfront
60Flexibility: Standard or Convertible
61```
62 
63### Savings Plans
64 
65```
66Compute Savings Plans: 66% savings
67EC2 Instance Savings Plans: 72% savings
68Applies to: EC2, Fargate, Lambda
69Flexible across: Instance families, regions, OS
70```
71 
72### Spot Instances
73 
74```
75Savings: Up to 90% vs On-Demand
76Best for: Batch jobs, CI/CD, stateless workloads
77Risk: 2-minute interruption notice
78Strategy: Mix with On-Demand for resilience
79```
80 
81### S3 Cost Optimization
82 
83```hcl
84resource "aws_s3_bucket_lifecycle_configuration" "example" {
85 bucket = aws_s3_bucket.example.id
86 
87 rule {
88 id = "transition-to-ia"
89 status = "Enabled"
90 
91 transition {
92 days = 30
93 storage_class = "STANDARD_IA"
94 }
95 
96 transition {
97 days = 90
98 storage_class = "GLACIER"
99 }
100 
101 expiration {
102 days = 365
103 }
104 }
105}
106```
107 
108## Azure Cost Optimization
109 
110### Reserved VM Instances
111 
112- 1 or 3 year terms
113- Up to 72% savings
114- Flexible sizing
115- Exchangeable
116 
117### Azure Hybrid Benefit
118 
119- Use existing Windows Server licenses
120- Up to 80% savings with RI
121- Available for Windows and SQL Server
122 
123### Azure Advisor Recommendations
124 
125- Right-size VMs
126- Delete unused resources
127- Use reserved capacity
128- Optimize storage
129 
130## GCP Cost Optimization
131 
132### Committed Use Discounts
133 
134- 1 or 3 year commitment
135- Up to 57% savings
136- Applies to vCPUs and memory
137- Resource-based or spend-based
138 
139### Sustained Use Discounts
140 
141- Automatic discounts
142- Up to 30% for running instances
143- No commitment required
144- Applies to Compute Engine, GKE
145 
146### Preemptible VMs
147 
148- Up to 80% savings
149- 24-hour maximum runtime
150- Best for batch workloads
151 
152## OCI Cost Optimization
153 
154### Flexible Shapes
155 
156- Scale OCPUs and memory independently
157- Match instance sizing to workload demand
158- Reduce wasted capacity from fixed VM shapes
159 
160### Commitments and Budgets
161 
162- Use annual commitments for predictable spend
163- Set compartment-level budgets with alerts
164- Track monthly forecasts with OCI Cost Analysis
165 
166### Preemptible Capacity
167 
168- Use preemptible instances for batch and ephemeral workloads
169- Keep interruption-tolerant autoscaling groups
170- Mix with standard capacity for critical services
171 
172## Tagging Strategy
173 
174### AWS Tagging
175 
176```hcl
177locals {
178 common_tags = {
179 Environment = "production"
180 Project = "my-project"
181 CostCenter = "engineering"
182 Owner = "[email protected]"
183 ManagedBy = "terraform"
184 }
185}
186 
187resource "aws_instance" "example" {
188 ami = "ami-12345678"
189 instance_type = "t3.medium"
190 
191 tags = merge(
192 local.common_tags,
193 {
194 Name = "web-server"
195 }
196 )
197}
198```
199 
200**Reference:** See `references/tagging-standards.md`
201 
202## Cost Monitoring
203 
204### Budget Alerts
205 
206```hcl
207# AWS Budget
208resource "aws_budgets_budget" "monthly" {
209 name = "monthly-budget"
210 budget_type = "COST"
211 limit_amount = "1000"
212 limit_unit = "USD"
213 time_period_start = "2024-01-01_00:00"
214 time_unit = "MONTHLY"
215 
216 notification {
217 comparison_operator = "GREATER_THAN"
218 threshold = 80
219 threshold_type = "PERCENTAGE"
220 notification_type = "ACTUAL"
221 subscriber_email_addresses = ["[email protected]"]
222 }
223}
224```
225 
226### Cost Anomaly Detection
227 
228- AWS Cost Anomaly Detection
229- Azure Cost Management alerts
230- GCP Budget alerts
231- OCI Budgets and Cost Analysis
232 
233## Architecture Patterns
234 
235### Pattern 1: Serverless First
236 
237- Use Lambda/Functions for event-driven
238- Pay only for execution time
239- Auto-scaling included
240- No idle costs
241 
242### Pattern 2: Right-Sized Databases
243 
244```
245Development: t3.small RDS
246Staging: t3.large RDS
247Production: r6g.2xlarge RDS with read replicas
248```
249 
250### Pattern 3: Multi-Tier Storage
251 
252```
253Hot data: S3 Standard
254Warm data: S3 Standard-IA (30 days)
255Cold data: S3 Glacier (90 days)
256Archive: S3 Deep Archive (365 days)
257```
258 
259### Pattern 4: Auto-Scaling
260 
261```hcl
262resource "aws_autoscaling_policy" "scale_up" {
263 name = "scale-up"
264 scaling_adjustment = 2
265 adjustment_type = "ChangeInCapacity"
266 cooldown = 300
267 autoscaling_group_name = aws_autoscaling_group.main.name
268}
269 
270resource "aws_cloudwatch_metric_alarm" "cpu_high" {
271 alarm_name = "cpu-high"
272 comparison_operator = "GreaterThanThreshold"
273 evaluation_periods = "2"
274 metric_name = "CPUUtilization"
275 namespace = "AWS/EC2"
276 period = "60"
277 statistic = "Average"
278 threshold = "80"
279 alarm_actions = [aws_autoscaling_policy.scale_up.arn]
280}
281```
282 
283## Cost Optimization Checklist
284 
285- [ ] Implement cost allocation tags
286- [ ] Delete unused resources (EBS, EIPs, snapshots)
287- [ ] Right-size instances based on utilization
288- [ ] Use reserved capacity for steady workloads
289- [ ] Implement auto-scaling
290- [ ] Optimize storage classes
291- [ ] Use lifecycle policies
292- [ ] Enable cost anomaly detection
293- [ ] Set budget alerts
294- [ ] Review costs weekly
295- [ ] Use spot/preemptible instances
296- [ ] Optimize data transfer costs
297- [ ] Implement caching layers
298- [ ] Use managed services
299- [ ] Monitor and optimize continuously
300 
301## Tools
302 
303- **AWS:** Cost Explorer, Cost Anomaly Detection, Compute Optimizer
304- **Azure:** Cost Management, Advisor
305- **GCP:** Cost Management, Recommender
306- **OCI:** Cost Analysis, Budgets, Cloud Advisor
307- **Multi-cloud:** CloudHealth, Cloudability, Kubecost
308 
309 
310## Related Skills
311 
312- `terraform-module-library` - For resource provisioning
313- `multi-cloud-architecture` - For cloud selection
314 
View all files on GitHub →

Details

Updated
Sep 21, 2026
License
MIT
Stars on the repo
★ 39,857
Checked
Source
wshobson/agents ↗
Creator
wshobson · 179 listings
View creator

Similar skills

See all →
SkillFrom a business idea, app ideaAzure app onboardmicrosoft/skills · by microsoftEnd-to-end orchestrator: from a business idea, app idea, or existing app to running Azure deployment with cost estimates and pre-deploy approval. Analyzes your app, auto-detects the right Azure services, scaffolds infrastructure code, and deploys — tailored to your app, not a template. Handles moving existing apps to Azure without rewriting or with minimal changes. WHEN: bring your app to Azure, plan my app, cost to run, is my code ready to deploy, deploy my app to the cloud, deploy all my services, what Azure services do I need, plan my Azure deployment, deploy my new app to Azure, one-click deploy, I have an app and want it on Azure, migrate my app to Azure, help me get started, build an app, no code yet, starter project. DO NOT USE FOR: use azd for deployment(use azure-deploy), optimizing existing costs (use cost-optimization), code readiness checks only (use azure-app-onboard-prereq).★ 3.1k GitHub starsSkillAssess whether source code is ready to deploy to AzureAzure App Onboard Prereq — Repository Evaluationmicrosoft/skills · by microsoftAssess whether source code is ready to deploy to Azure — the check BEFORE infrastructure work. Evaluates build health, app completeness, dependencies and local services, stack compatibility, and deployment feasibility. Answers questions about what your app needs before it can be deployed — frameworks, dependencies, and configuration. Checks whether dependencies are compatible and identifies deployment blockers and unsupported frameworks. WHEN: "evaluate my repo", "is my app ready to deploy", "what does my app need to deploy", "what do I need before deploying", "does my app need", "can I ship this to Azure", "scan my repo for issues", "is this app deployable", "check if my app is ready for Azure", "do I need a Dockerfile", "what's blocking my deployment", "are there any blockers", "are my dependencies compatible", "does Azure support my framework", "what needs to change before deploying", "check my app configuration".★ 3.1k GitHub starsSkillConfigure Azure API Management as an AI Gateway for AIAzure aigatewaymicrosoft/azure-skills · by microsoftConfigure Azure API Management as an AI Gateway for AI models, MCP tools, and agents. WHEN: semantic caching, token limit, content safety, load balancing, AI model governance, MCP rate limiting, jailbreak detection, add Azure OpenAI backend, add AI Foundry model, test AI gateway, LLM policies, configure AI backend, token metrics, AI cost control, convert API to MCP, import OpenAPI to gateway.★ 1.6k GitHub starsSkillQuery and analyze data in Azure Data Explorer using KQLAzure Data Explorer (Kusto) Query & Analyticsmicrosoft/azure-skills · by microsoftQuery and analyze data in Azure Data Explorer (Kusto/ADX) using KQL for log analytics, telemetry, and time series analysis. WHEN: KQL queries, Kusto database queries, Azure Data Explorer, ADX clusters, log analytics, time series data, IoT telemetry, anomaly detection.★ 1.6k GitHub starsMCPRun any server from the Docker MCP Catalog in its ownDocker MCP gatewaydocker/mcp-gateway · by dockerDocker's own CLI plugin: run any server from the Docker MCP Catalog in its own container, behind one connection, with secrets kept out of env vars.★ 1.6k GitHub starsMCPOpen infrastructure for AI agents to discover and pay eachElisymelisymlabs/elisym · by elisymlabsOpen infrastructure for AI agents to discover and pay each other★ 17 GitHub stars

More from wshobson

SkillMaster C/.NET backend development patterns for buildingwshobson/agents · by wshobsonMaster C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.★ 39.9k GitHub starsSkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliancewshobson/agents · by wshobsonImplement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.★ 39.9k GitHub starsSkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Designwshobson/agents · by wshobsonMaster Material Design 3 and Jetpack Compose patterns for building native Android apps. Use when designing Android interfaces, implementing Compose UI, or following Google's Material Design guidelines.★ 39.9k GitHub starsSkillMigrate from AngularJS to Angular using hybrid modeAngular migrationwshobson/agents · by wshobsonMigrate from AngularJS to Angular using hybrid mode, incremental component rewriting, and dependency injection updates. Use when upgrading AngularJS applications, planning framework migrations, or modernizing legacy Angular code.★ 39.9k GitHub starsSkillUnderstand anti-reversing, obfuscationAnti reversing techniqueswshobson/agents · by wshobsonUnderstand anti-reversing, obfuscation, and protection techniques encountered during software analysis. Use this skill when analyzing malware evasion techniques, when implementing anti-debugging protections for CTF challenges, when reverse engineering packed binaries, or when building security research tools that need to detect virtualized environments.★ 39.9k GitHub starsSkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patternswshobson/agents · by wshobsonBuild production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workflows, or scheduling batch jobs.★ 39.9k GitHub stars