Skills · Infrastructure & ops

Cloud Cost Optimization

Unverified30/40

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.

Originally by wshobson · MIT

Claude CodePartialHas SKILL.md but declares no allowed-tools — Claude Code will ask for permission each time
CursorPartialPlain prose you can paste in — but no Cursor rules file
CodexPartialPlain prose you can paste in — but no AGENTS.md
Gemini CLIPartialPlain prose you can paste in
CopilotPartialPlain prose you can paste in — but no Copilot instructions file
npx agentalley add cost-optimization

This command does not work yet — the CLI is still being built. Until then, use Raw in the reader below to take the file.

Who is stuck, and on what

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.

The whole source

No sign-in, no blur, nothing truncated
cost-optimization/SKILL.md314 lines6.7 KBRawView on GitHub
Frontmatter — 2 properties
namecost-optimization
descriptionOptimize 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.
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---A5No allowed-tools declared — no way to tell what this skill may touch
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 

Reviews

Installed this one?Write the first review and take the Trailblazer badge.

Reviews only open after a real install, so this is empty — and we leave it empty rather than invent one.

Alternatives

Also in Infrastructure & ops