cdk-cost-analyzer 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/.cdk-cost-analyzer-cache/metadata.json +12 -0
  2. package/.gitlab-ci.yml +214 -0
  3. package/.husky/pre-commit +12 -0
  4. package/.kiro/hooks/accessibility-audit.kiro.hook +18 -0
  5. package/.kiro/hooks/api-schema-validation.kiro.hook +21 -0
  6. package/.kiro/hooks/auto-test-on-save.kiro.hook +19 -0
  7. package/.kiro/hooks/cdk-synth-on-change.kiro.hook +20 -0
  8. package/.kiro/hooks/code-coverage-check.kiro.hook +14 -0
  9. package/.kiro/hooks/commit-message-helper.kiro.hook +14 -0
  10. package/.kiro/hooks/dependency-update-check.kiro.hook +14 -0
  11. package/.kiro/hooks/env-file-validation.kiro.hook +18 -0
  12. package/.kiro/hooks/lint-and-format-on-save.kiro.hook +21 -0
  13. package/.kiro/hooks/mcp-config-validation.kiro.hook +17 -0
  14. package/.kiro/hooks/mcp-server-test.kiro.hook +14 -0
  15. package/.kiro/hooks/performance-analysis.kiro.hook +14 -0
  16. package/.kiro/hooks/readme-spell-check.kiro.hook +14 -0
  17. package/.kiro/hooks/security-scan-on-dependency-change.kiro.hook +21 -0
  18. package/.kiro/hooks/translation-update.kiro.hook +18 -0
  19. package/.kiro/hooks/update-documentation.kiro.hook +18 -0
  20. package/.kiro/settings/mcp.json +20 -0
  21. package/.kiro/specs/cdk-cost-analyzer/design.md +620 -0
  22. package/.kiro/specs/cdk-cost-analyzer/requirements.md +183 -0
  23. package/.kiro/specs/cdk-cost-analyzer/tasks.md +357 -0
  24. package/.kiro/specs/github-actions-ci/design.md +281 -0
  25. package/.kiro/specs/github-actions-ci/requirements.md +86 -0
  26. package/.kiro/specs/github-actions-ci/tasks.md +115 -0
  27. package/.kiro/specs/nlb-calculator-test-coverage/design.md +190 -0
  28. package/.kiro/specs/nlb-calculator-test-coverage/requirements.md +84 -0
  29. package/.kiro/specs/nlb-calculator-test-coverage/tasks.md +150 -0
  30. package/.kiro/specs/production-readiness/design.md +1213 -0
  31. package/.kiro/specs/production-readiness/requirements.md +312 -0
  32. package/.kiro/specs/production-readiness/tasks.md +269 -0
  33. package/.kiro/specs/repository-cleanup/design.md +283 -0
  34. package/.kiro/specs/repository-cleanup/requirements.md +74 -0
  35. package/.kiro/specs/repository-cleanup/tasks.md +64 -0
  36. package/.kiro/steering/aws-cli-best-practices.md +41 -0
  37. package/.kiro/steering/cdk-best-practices.md +49 -0
  38. package/.kiro/steering/development-standards.md +54 -0
  39. package/.kiro/steering/docker-best-practices.md +34 -0
  40. package/.kiro/steering/documentation-style.md +151 -0
  41. package/.kiro/steering/git-best-practices.md +37 -0
  42. package/.kiro/steering/mcp-best-practices.md +95 -0
  43. package/.kiro/steering/python-best-practices.md +48 -0
  44. package/.kiro/steering/react-best-practices.md +44 -0
  45. package/.kiro/steering/security-best-practices.md +41 -0
  46. package/.kiro/steering/testing-best-practices.md +59 -0
  47. package/.kiro/steering/typescript-best-practices.md +40 -0
  48. package/CHANGELOG.md +49 -0
  49. package/CONTRIBUTING.md +258 -0
  50. package/LICENSE +19 -0
  51. package/README.md +480 -0
  52. package/SECURITY.md +117 -0
  53. package/dist/api/index.d.ts +11 -0
  54. package/dist/api/index.js +65 -0
  55. package/dist/api/types.d.ts +15 -0
  56. package/dist/api/types.js +3 -0
  57. package/dist/cli/index.d.ts +2 -0
  58. package/dist/cli/index.js +262 -0
  59. package/dist/config/ConfigManager.d.ts +40 -0
  60. package/dist/config/ConfigManager.js +238 -0
  61. package/dist/config/index.d.ts +2 -0
  62. package/dist/config/index.js +19 -0
  63. package/dist/config/types.d.ts +72 -0
  64. package/dist/config/types.js +15 -0
  65. package/dist/diff/DiffEngine.d.ts +7 -0
  66. package/dist/diff/DiffEngine.js +73 -0
  67. package/dist/diff/index.d.ts +2 -0
  68. package/dist/diff/index.js +21 -0
  69. package/dist/diff/types.d.ts +20 -0
  70. package/dist/diff/types.js +3 -0
  71. package/dist/integrations/GitLabIntegration.d.ts +7 -0
  72. package/dist/integrations/GitLabIntegration.js +45 -0
  73. package/dist/integrations/index.d.ts +2 -0
  74. package/dist/integrations/index.js +21 -0
  75. package/dist/integrations/types.d.ts +11 -0
  76. package/dist/integrations/types.js +13 -0
  77. package/dist/parser/TemplateParser.d.ts +8 -0
  78. package/dist/parser/TemplateParser.js +75 -0
  79. package/dist/parser/index.d.ts +2 -0
  80. package/dist/parser/index.js +22 -0
  81. package/dist/parser/types.d.ts +30 -0
  82. package/dist/parser/types.js +3 -0
  83. package/dist/pipeline/PipelineOrchestrator.d.ts +23 -0
  84. package/dist/pipeline/PipelineOrchestrator.js +191 -0
  85. package/dist/pipeline/index.d.ts +2 -0
  86. package/dist/pipeline/index.js +19 -0
  87. package/dist/pipeline/types.d.ts +41 -0
  88. package/dist/pipeline/types.js +13 -0
  89. package/dist/pricing/CacheManager.d.ts +75 -0
  90. package/dist/pricing/CacheManager.js +195 -0
  91. package/dist/pricing/PricingClient.d.ts +17 -0
  92. package/dist/pricing/PricingClient.js +122 -0
  93. package/dist/pricing/PricingService.d.ts +16 -0
  94. package/dist/pricing/PricingService.js +149 -0
  95. package/dist/pricing/calculators/ALBCalculator.d.ts +16 -0
  96. package/dist/pricing/calculators/ALBCalculator.js +163 -0
  97. package/dist/pricing/calculators/APIGatewayCalculator.d.ts +10 -0
  98. package/dist/pricing/calculators/APIGatewayCalculator.js +177 -0
  99. package/dist/pricing/calculators/CloudFrontCalculator.d.ts +59 -0
  100. package/dist/pricing/calculators/CloudFrontCalculator.js +151 -0
  101. package/dist/pricing/calculators/DynamoDBCalculator.d.ts +9 -0
  102. package/dist/pricing/calculators/DynamoDBCalculator.js +146 -0
  103. package/dist/pricing/calculators/EC2Calculator.d.ts +7 -0
  104. package/dist/pricing/calculators/EC2Calculator.js +80 -0
  105. package/dist/pricing/calculators/ECSCalculator.d.ts +9 -0
  106. package/dist/pricing/calculators/ECSCalculator.js +116 -0
  107. package/dist/pricing/calculators/ElastiCacheCalculator.d.ts +8 -0
  108. package/dist/pricing/calculators/ElastiCacheCalculator.js +106 -0
  109. package/dist/pricing/calculators/LambdaCalculator.d.ts +13 -0
  110. package/dist/pricing/calculators/LambdaCalculator.js +111 -0
  111. package/dist/pricing/calculators/NLBCalculator.d.ts +16 -0
  112. package/dist/pricing/calculators/NLBCalculator.js +138 -0
  113. package/dist/pricing/calculators/NatGatewayCalculator.d.ts +12 -0
  114. package/dist/pricing/calculators/NatGatewayCalculator.js +116 -0
  115. package/dist/pricing/calculators/RDSCalculator.d.ts +9 -0
  116. package/dist/pricing/calculators/RDSCalculator.js +103 -0
  117. package/dist/pricing/calculators/S3Calculator.d.ts +8 -0
  118. package/dist/pricing/calculators/S3Calculator.js +68 -0
  119. package/dist/pricing/calculators/VPCEndpointCalculator.d.ts +12 -0
  120. package/dist/pricing/calculators/VPCEndpointCalculator.js +129 -0
  121. package/dist/pricing/index.d.ts +10 -0
  122. package/dist/pricing/index.js +37 -0
  123. package/dist/pricing/types.d.ts +53 -0
  124. package/dist/pricing/types.js +22 -0
  125. package/dist/releasetag.txt +1 -0
  126. package/dist/reporter/Reporter.d.ts +18 -0
  127. package/dist/reporter/Reporter.js +412 -0
  128. package/dist/reporter/index.d.ts +2 -0
  129. package/dist/reporter/index.js +21 -0
  130. package/dist/reporter/types.d.ts +72 -0
  131. package/dist/reporter/types.js +3 -0
  132. package/dist/synthesis/SynthesisOrchestrator.d.ts +26 -0
  133. package/dist/synthesis/SynthesisOrchestrator.js +243 -0
  134. package/dist/synthesis/index.d.ts +2 -0
  135. package/dist/synthesis/index.js +19 -0
  136. package/dist/synthesis/types.d.ts +17 -0
  137. package/dist/synthesis/types.js +13 -0
  138. package/dist/threshold/ThresholdEnforcer.d.ts +29 -0
  139. package/dist/threshold/ThresholdEnforcer.js +143 -0
  140. package/dist/threshold/index.d.ts +2 -0
  141. package/dist/threshold/index.js +19 -0
  142. package/dist/threshold/types.d.ts +15 -0
  143. package/dist/threshold/types.js +17 -0
  144. package/docs/CALCULATORS.md +820 -0
  145. package/docs/CI_CD.md +608 -0
  146. package/docs/CONFIGURATION.md +407 -0
  147. package/docs/DEVELOPMENT.md +387 -0
  148. package/docs/RELEASE.md +223 -0
  149. package/docs/TROUBLESHOOTING.md +847 -0
  150. package/examples/.cdk-cost-analyzer.yml +85 -0
  151. package/examples/.gitlab-ci.yml +125 -0
  152. package/examples/api-usage.js +26 -0
  153. package/examples/complex/base.json +16 -0
  154. package/examples/complex/target.json +29 -0
  155. package/examples/monorepo/.gitlab-ci.yml +251 -0
  156. package/examples/monorepo/README.md +341 -0
  157. package/examples/monorepo/package.json +27 -0
  158. package/examples/monorepo/packages/backend-infra/.cdk-cost-analyzer.yml +34 -0
  159. package/examples/monorepo/packages/backend-infra/bin/app.ts +16 -0
  160. package/examples/monorepo/packages/backend-infra/cdk.json +7 -0
  161. package/examples/monorepo/packages/backend-infra/lib/backend-stack.ts +128 -0
  162. package/examples/monorepo/packages/backend-infra/package.json +30 -0
  163. package/examples/monorepo/packages/backend-infra/tsconfig.json +11 -0
  164. package/examples/monorepo/packages/data-infra/.cdk-cost-analyzer.yml +38 -0
  165. package/examples/monorepo/packages/data-infra/bin/app.ts +16 -0
  166. package/examples/monorepo/packages/data-infra/cdk.json +7 -0
  167. package/examples/monorepo/packages/data-infra/lib/data-stack.ts +121 -0
  168. package/examples/monorepo/packages/data-infra/package.json +30 -0
  169. package/examples/monorepo/packages/data-infra/tsconfig.json +11 -0
  170. package/examples/monorepo/packages/frontend-infra/.cdk-cost-analyzer.yml +31 -0
  171. package/examples/monorepo/packages/frontend-infra/bin/app.ts +16 -0
  172. package/examples/monorepo/packages/frontend-infra/cdk.json +7 -0
  173. package/examples/monorepo/packages/frontend-infra/lib/frontend-stack.ts +60 -0
  174. package/examples/monorepo/packages/frontend-infra/package.json +30 -0
  175. package/examples/monorepo/packages/frontend-infra/tsconfig.json +11 -0
  176. package/examples/monorepo/tsconfig.json +35 -0
  177. package/examples/multi-stack/.cdk-cost-analyzer.yml +72 -0
  178. package/examples/multi-stack/.gitlab-ci.yml +184 -0
  179. package/examples/multi-stack/README.md +279 -0
  180. package/examples/multi-stack/bin/app.ts +36 -0
  181. package/examples/multi-stack/cdk.json +72 -0
  182. package/examples/multi-stack/lib/compute-stack.ts +128 -0
  183. package/examples/multi-stack/lib/networking-stack.ts +69 -0
  184. package/examples/multi-stack/lib/storage-stack.ts +141 -0
  185. package/examples/multi-stack/package-lock.json +4437 -0
  186. package/examples/multi-stack/package.json +42 -0
  187. package/examples/multi-stack/tsconfig.json +34 -0
  188. package/examples/simple/base.json +8 -0
  189. package/examples/simple/target.json +14 -0
  190. package/examples/single-stack/.NVP +0 -0
  191. package/examples/single-stack/.cdk-cost-analyzer.yml +52 -0
  192. package/examples/single-stack/.gitlab-ci.yml +126 -0
  193. package/examples/single-stack/README.md +184 -0
  194. package/examples/single-stack/UeK +0 -0
  195. package/examples/single-stack/bin/app.ts +16 -0
  196. package/examples/single-stack/cdk.json +72 -0
  197. package/examples/single-stack/lib/infrastructure-stack.ts +119 -0
  198. package/examples/single-stack/package-lock.json +4443 -0
  199. package/examples/single-stack/package.json +38 -0
  200. package/examples/single-stack/tsconfig.json +34 -0
  201. package/package.json +139 -0
  202. package/test-cdk-project/README-COMPUTE.md +141 -0
  203. package/test-cdk-project/README.md +95 -0
  204. package/test-cdk-project/app-with-compute.js +102 -0
  205. package/test-cdk-project/app.js +81 -0
  206. package/test-cdk-project/cdk-compute.json +3 -0
  207. package/test-cdk-project/cdk.context.json +7 -0
  208. package/test-cdk-project/cdk.json +3 -0
  209. package/test-cdk-project/cdk.out/TestStack.assets.json +21 -0
  210. package/test-cdk-project/cdk.out/TestStack.template.json +115 -0
  211. package/test-cdk-project/cdk.out/cdk.out +1 -0
  212. package/test-cdk-project/cdk.out/manifest.json +503 -0
  213. package/test-cdk-project/cdk.out/tree.json +1 -0
  214. package/test-cdk-project/cdk.out.base/TestStack.assets.json +21 -0
  215. package/test-cdk-project/cdk.out.base/TestStack.template.json +115 -0
  216. package/test-cdk-project/cdk.out.base/cdk.out +1 -0
  217. package/test-cdk-project/cdk.out.base/manifest.json +503 -0
  218. package/test-cdk-project/cdk.out.base/tree.json +1 -0
  219. package/test-cdk-project/cdk.out.target/TestStack.assets.json +21 -0
  220. package/test-cdk-project/cdk.out.target/TestStack.template.json +183 -0
  221. package/test-cdk-project/cdk.out.target/cdk.out +1 -0
  222. package/test-cdk-project/cdk.out.target/manifest.json +521 -0
  223. package/test-cdk-project/cdk.out.target/tree.json +1 -0
  224. package/test-cdk-project/package-lock.json +422 -0
  225. package/test-cdk-project/package.json +17 -0
  226. package/tools/workflows/README.md +102 -0
  227. package/tools/workflows/validate-workflows.js +109 -0
  228. package/tools/workflows/workflow-utils.ts +181 -0
@@ -0,0 +1,407 @@
1
+ # Configuration Guide
2
+
3
+ The CDK Cost Analyzer supports project-specific configuration through a configuration file. This allows you to customize cost thresholds, usage assumptions, resource exclusions, and synthesis settings.
4
+
5
+ ## Configuration File
6
+
7
+ The tool searches for configuration files in the following order:
8
+
9
+ 1. Path specified via `--config` flag
10
+ 2. `.cdk-cost-analyzer.yml` in current directory
11
+ 3. `.cdk-cost-analyzer.yaml` in current directory
12
+ 4. `.cdk-cost-analyzer.json` in current directory
13
+
14
+ ### Complete Example
15
+
16
+ ```yaml
17
+ # .cdk-cost-analyzer.yml
18
+
19
+ # Cost thresholds for pipeline enforcement
20
+ thresholds:
21
+ # Default thresholds for all environments
22
+ default:
23
+ warning: 50 # USD per month - triggers warning but passes
24
+ error: 200 # USD per month - fails pipeline
25
+
26
+ # Environment-specific thresholds
27
+ environments:
28
+ production:
29
+ warning: 25 # Stricter thresholds for production
30
+ error: 100
31
+ development:
32
+ warning: 100 # More lenient for development
33
+ error: 500
34
+
35
+ # Custom usage assumptions for cost estimation
36
+ usageAssumptions:
37
+ s3:
38
+ storageGB: 500
39
+ getRequests: 100000
40
+ putRequests: 10000
41
+
42
+ lambda:
43
+ invocationsPerMonth: 5000000
44
+ averageDurationMs: 500
45
+
46
+ natGateway:
47
+ dataProcessedGB: 500 # Data processed through NAT Gateway per month
48
+
49
+ alb:
50
+ newConnectionsPerSecond: 50
51
+ activeConnectionsPerMinute: 5000
52
+ processedBytesGB: 1000
53
+
54
+ nlb:
55
+ newConnectionsPerSecond: 100
56
+ activeConnectionsPerMinute: 10000
57
+ processedBytesGB: 1000
58
+
59
+ vpcEndpoint:
60
+ dataProcessedGB: 100 # Data processed through interface endpoints
61
+
62
+ cloudFront:
63
+ dataTransferGB: 100 # Data transfer out to internet per month
64
+ requests: 1000000 # HTTP/HTTPS requests per month
65
+
66
+ apiGateway:
67
+ requestsPerMonth: 10000000
68
+
69
+ # CDK synthesis configuration
70
+ synthesis:
71
+ appPath: ./infrastructure
72
+ outputPath: ./cdk.out
73
+ customCommand: npx cdk synth # Optional: custom synthesis command
74
+ context:
75
+ environment: production
76
+ region: eu-central-1
77
+
78
+ # Resource types to exclude from cost analysis
79
+ exclusions:
80
+ resourceTypes:
81
+ - AWS::IAM::Role
82
+ - AWS::IAM::Policy
83
+ - AWS::Logs::LogGroup
84
+
85
+ # Pricing data cache configuration
86
+ cache:
87
+ enabled: true
88
+ durationHours: 24
89
+ ```
90
+
91
+ ## Configuration Options
92
+
93
+ ### Thresholds
94
+
95
+ Cost thresholds control pipeline behavior based on cost deltas:
96
+
97
+ **Warning Threshold**: Cost increases above this value trigger a warning but allow the pipeline to pass. Use this to notify developers of significant cost increases.
98
+
99
+ **Error Threshold**: Cost increases above this value fail the pipeline. Use this to enforce approval gates for expensive changes.
100
+
101
+ **Environment-Specific Thresholds**: Define different thresholds for different environments (production, staging, development).
102
+
103
+ Example:
104
+
105
+ ```yaml
106
+ thresholds:
107
+ default:
108
+ warning: 50
109
+ error: 200
110
+ environments:
111
+ production:
112
+ warning: 25
113
+ error: 100
114
+ ```
115
+
116
+ ### Usage Assumptions
117
+
118
+ Customize default assumptions for usage-based pricing:
119
+
120
+ #### S3
121
+ ```yaml
122
+ usageAssumptions:
123
+ s3:
124
+ storageGB: 500 # GB of standard storage
125
+ getRequests: 100000 # GET requests per month
126
+ putRequests: 10000 # PUT requests per month
127
+ ```
128
+
129
+ #### Lambda
130
+ ```yaml
131
+ usageAssumptions:
132
+ lambda:
133
+ invocationsPerMonth: 5000000 # Function invocations per month
134
+ averageDurationMs: 500 # Average execution duration
135
+ ```
136
+
137
+ #### NAT Gateway
138
+ ```yaml
139
+ usageAssumptions:
140
+ natGateway:
141
+ dataProcessedGB: 500 # Data processed through NAT Gateway
142
+ ```
143
+
144
+ #### Application Load Balancer
145
+ ```yaml
146
+ usageAssumptions:
147
+ alb:
148
+ newConnectionsPerSecond: 50 # New connections per second
149
+ activeConnectionsPerMinute: 5000 # Active connections per minute
150
+ processedBytesGB: 1000 # GB processed per month
151
+ ```
152
+
153
+ #### Network Load Balancer
154
+ ```yaml
155
+ usageAssumptions:
156
+ nlb:
157
+ newConnectionsPerSecond: 100 # New connections per second
158
+ activeConnectionsPerMinute: 10000 # Active connections per minute
159
+ processedBytesGB: 1000 # GB processed per month
160
+ ```
161
+
162
+ #### VPC Endpoint
163
+ ```yaml
164
+ usageAssumptions:
165
+ vpcEndpoint:
166
+ dataProcessedGB: 100 # Data processed through interface endpoints
167
+ ```
168
+
169
+ #### CloudFront
170
+ ```yaml
171
+ usageAssumptions:
172
+ cloudFront:
173
+ dataTransferGB: 100 # Data transfer out to internet per month
174
+ requests: 1000000 # HTTP/HTTPS requests per month
175
+ ```
176
+
177
+ #### API Gateway
178
+ ```yaml
179
+ usageAssumptions:
180
+ apiGateway:
181
+ requestsPerMonth: 10000000 # API requests per month
182
+ ```
183
+
184
+ ### Synthesis Configuration
185
+
186
+ Configure automatic CDK synthesis:
187
+
188
+ ```yaml
189
+ synthesis:
190
+ appPath: ./infrastructure # Path to CDK application
191
+ outputPath: ./cdk.out # CDK output directory
192
+ customCommand: npx cdk synth # Custom synthesis command
193
+ context: # CDK context values
194
+ environment: production
195
+ ```
196
+
197
+ **Timeout Behavior:**
198
+ - CDK synthesis has a built-in 25-second timeout to prevent hanging processes
199
+ - Process receives SIGTERM for graceful termination, followed by SIGKILL after 5 seconds
200
+ - If synthesis requires more time, use a custom command with extended timeout:
201
+ ```yaml
202
+ synthesis:
203
+ customCommand: "timeout 60 npx cdk synth" # 60 second timeout
204
+ ```
205
+
206
+ **Security Notes:**
207
+ - Commands are executed with `shell: false` to prevent injection attacks
208
+ - Arguments are passed as arrays rather than concatenated strings
209
+ region: eu-central-1
210
+ ```
211
+
212
+ ### Resource Exclusions
213
+
214
+ Exclude specific resource types from cost analysis:
215
+
216
+ ```yaml
217
+ exclusions:
218
+ resourceTypes:
219
+ - AWS::IAM::Role
220
+ - AWS::IAM::Policy
221
+ - AWS::Logs::LogGroup
222
+ - AWS::CloudWatch::Alarm
223
+ ```
224
+
225
+ Common exclusions:
226
+ - **IAM Resources**: Roles, policies, users (no direct cost)
227
+ - **Log Groups**: Often minimal cost
228
+ - **CloudWatch Alarms**: Minimal cost
229
+ - **EventBridge Rules**: Minimal cost
230
+
231
+ ### Cache Configuration
232
+
233
+ Configure pricing data caching:
234
+
235
+ ```yaml
236
+ cache:
237
+ enabled: true # Enable caching
238
+ durationHours: 24 # Cache duration in hours
239
+ ```
240
+
241
+ Benefits of caching:
242
+ - Faster analysis (no API calls for cached data)
243
+ - Reduced AWS Pricing API usage
244
+ - Works offline with cached data
245
+
246
+ ## Environment Detection
247
+
248
+ When using environment-specific thresholds, the tool detects the environment from:
249
+
250
+ 1. `--environment` CLI flag
251
+ 2. `CI_ENVIRONMENT_NAME` GitLab CI variable
252
+ 3. Falls back to default thresholds
253
+
254
+ Example in GitLab CI:
255
+
256
+ ```yaml
257
+ cost-analysis:production:
258
+ stage: cost-analysis
259
+ script:
260
+ - cdk-cost-analyzer pipeline --environment production
261
+ only:
262
+ - main
263
+
264
+ cost-analysis:development:
265
+ stage: cost-analysis
266
+ script:
267
+ - cdk-cost-analyzer pipeline --environment development
268
+ only:
269
+ - merge_requests
270
+ ```
271
+
272
+ ## Configuration Validation
273
+
274
+ The tool validates configuration on load:
275
+
276
+ **Errors** (fail immediately):
277
+ - Negative threshold values
278
+ - Negative usage assumption values
279
+ - Invalid cache duration
280
+
281
+ **Warnings** (displayed but continue):
282
+ - Warning threshold exceeds error threshold
283
+ - Missing environment thresholds (uses default)
284
+
285
+ Example validation error:
286
+
287
+ ```
288
+ Error: Invalid configuration
289
+ Validation errors:
290
+ - thresholds.default.warning must be non-negative
291
+ - usageAssumptions.s3.storageGB must be non-negative
292
+ ```
293
+
294
+ ## JSON Configuration
295
+
296
+ You can also use JSON format:
297
+
298
+ ```json
299
+ {
300
+ "thresholds": {
301
+ "default": {
302
+ "warning": 50,
303
+ "error": 200
304
+ }
305
+ },
306
+ "usageAssumptions": {
307
+ "s3": {
308
+ "storageGB": 500
309
+ }
310
+ },
311
+ "cache": {
312
+ "enabled": true,
313
+ "durationHours": 24
314
+ }
315
+ }
316
+ ```
317
+
318
+ ## Best Practices
319
+
320
+ ### Setting Thresholds
321
+
322
+ **Start Conservative**: Begin with low thresholds and adjust based on team needs.
323
+
324
+ **Per-Environment**: Use stricter thresholds for production, lenient for development.
325
+
326
+ **Team Alignment**: Set thresholds that match your FinOps policies and budget constraints.
327
+
328
+ ### Usage Assumptions
329
+
330
+ **Based on Monitoring**: Use actual usage data from CloudWatch metrics.
331
+
332
+ **Conservative Estimates**: Err on the side of over-estimation to avoid surprises.
333
+
334
+ **Document Assumptions**: Add comments explaining your usage assumptions.
335
+
336
+ ### Resource Exclusions
337
+
338
+ **Zero-Cost Resources**: Exclude IAM and other zero-cost resources.
339
+
340
+ **Minimal Cost Resources**: Consider excluding Log Groups if cost is negligible.
341
+
342
+ **Don't Over-Exclude**: Be cautious about excluding potentially expensive resources.
343
+
344
+ ## Configuration Examples
345
+
346
+ ### Small Team / Startup
347
+
348
+ ```yaml
349
+ thresholds:
350
+ default:
351
+ warning: 100
352
+ error: 500
353
+
354
+ usageAssumptions:
355
+ s3:
356
+ storageGB: 50
357
+ lambda:
358
+ invocationsPerMonth: 1000000
359
+
360
+ exclusions:
361
+ resourceTypes:
362
+ - AWS::IAM::Role
363
+ - AWS::IAM::Policy
364
+ - AWS::Logs::LogGroup
365
+ ```
366
+
367
+ ### Enterprise / Production
368
+
369
+ ```yaml
370
+ thresholds:
371
+ default:
372
+ warning: 25
373
+ error: 100
374
+ environments:
375
+ production:
376
+ warning: 10
377
+ error: 50
378
+ staging:
379
+ warning: 50
380
+ error: 200
381
+ development:
382
+ warning: 200
383
+ error: 1000
384
+
385
+ usageAssumptions:
386
+ s3:
387
+ storageGB: 1000
388
+ lambda:
389
+ invocationsPerMonth: 10000000
390
+ natGateway:
391
+ dataProcessedGB: 5000
392
+ alb:
393
+ newConnectionsPerSecond: 100
394
+ activeConnectionsPerMinute: 10000
395
+ processedBytesGB: 5000
396
+
397
+ cache:
398
+ enabled: true
399
+ durationHours: 12
400
+
401
+ exclusions:
402
+ resourceTypes:
403
+ - AWS::IAM::Role
404
+ - AWS::IAM::Policy
405
+ - AWS::Logs::LogGroup
406
+ - AWS::CloudWatch::Alarm
407
+ ```