Skill files2 files

references/

SKILL.md314 lines
1
---
2
name: cost-optimization
3
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.
4
---
5
6
# Cloud Cost Optimization
7
8
Strategies and patterns for optimizing cloud costs across AWS, Azure, GCP, and OCI.
9
10
## Purpose
11
12
Implement 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
```
57
Savings: 30-72% vs On-Demand
58
Term: 1 or 3 years
59
Payment: All/Partial/No upfront
60
Flexibility: Standard or Convertible
61
```
62
63
### Savings Plans
64
65
```
66
Compute Savings Plans: 66% savings
67
EC2 Instance Savings Plans: 72% savings
68
Applies to: EC2, Fargate, Lambda
69
Flexible across: Instance families, regions, OS
70
```
71
72
### Spot Instances
73
74
```
75
Savings: Up to 90% vs On-Demand
76
Best for: Batch jobs, CI/CD, stateless workloads
77
Risk: 2-minute interruption notice
78
Strategy: Mix with On-Demand for resilience
79
```
80
81
### S3 Cost Optimization
82
83
```hcl
84
resource "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
177
locals {
178
common_tags = {
179
Environment = "production"
180
Project = "my-project"
181
CostCenter = "engineering"
182
Owner = "team@example.com"
183
ManagedBy = "terraform"
184
}
185
}
186
187
resource "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
208
resource "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 = ["team@example.com"]
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
```
245
Development: t3.small RDS
246
Staging: t3.large RDS
247
Production: r6g.2xlarge RDS with read replicas
248
```
249
250
### Pattern 3: Multi-Tier Storage
251
252
```
253
Hot data: S3 Standard
254
Warm data: S3 Standard-IA (30 days)
255
Cold data: S3 Glacier (90 days)
256
Archive: S3 Deep Archive (365 days)
257
```
258
259
### Pattern 4: Auto-Scaling
260
261
```hcl
262
resource "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
270
resource "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

© Seth Hobson · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 6,373 prompts

More by @OpenSourceBuffGuy

See all
Website Clone Architect prompt image

Website Clone Architect

Reverse-engineers a website section by section, writes component specs, and hands them to parallel builder agents in git worktrees to rebuild it.

agent-skill, orchestrator, parallel-agents, multi-agent, plan-then-execute, web-development, frontend, codebase-analysis, scaffolding, css, html, nextjs, typescript, git, mcp, claude-code, for-developers, for-designers, long-form, advanced, technical-spec, task-decomposition, structured-output, design-systems, ui-ux, tool-use, checklist, report, vibe-coding

Italian Terrace Cafe Candid Portrait prompt image

Italian Terrace Cafe Candid Portrait

Generates a photorealistic candid shot of a woman in a white corset dress laughing at a sunny hotel terrace cafe, written as detailed JSON.

image-prompt, json-prompt, structured-output, photorealistic, portrait, woman, candid, fashion, cottagecore, natural-light, golden-hour, bokeh, summer, travel, cityscape, mountains, medium-shot, vibrant-colors, for-photographers, nano-banana, fashion-shoot, luxury

Night Street Photo With Leashed Cat prompt image

Night Street Photo With Leashed Cat

Generates a flash-lit night street photo of a blonde woman in a retro track jacket walking a hissing tabby cat on a leash.

image-prompt, json-prompt, nano-banana, structured-output, portrait, woman, animals, pet-portrait, night-scene, street-photography, candid, editorial, fashion, dramatic-lighting, photorealistic, vertical-format, medium-shot, graffiti, for-photographers, for-content-creators

1 view

Reviews

Loading reviews…

Discussion

Loading comments…