runbooks 0.7.9__py3-none-any.whl → 0.9.1__py3-none-any.whl

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 (122) hide show
  1. runbooks/__init__.py +1 -1
  2. runbooks/cfat/README.md +12 -1
  3. runbooks/cfat/__init__.py +1 -1
  4. runbooks/cfat/assessment/compliance.py +4 -1
  5. runbooks/cfat/assessment/runner.py +42 -34
  6. runbooks/cfat/models.py +1 -1
  7. runbooks/cloudops/__init__.py +123 -0
  8. runbooks/cloudops/base.py +385 -0
  9. runbooks/cloudops/cost_optimizer.py +811 -0
  10. runbooks/cloudops/infrastructure_optimizer.py +29 -0
  11. runbooks/cloudops/interfaces.py +828 -0
  12. runbooks/cloudops/lifecycle_manager.py +29 -0
  13. runbooks/cloudops/mcp_cost_validation.py +678 -0
  14. runbooks/cloudops/models.py +251 -0
  15. runbooks/cloudops/monitoring_automation.py +29 -0
  16. runbooks/cloudops/notebook_framework.py +676 -0
  17. runbooks/cloudops/security_enforcer.py +449 -0
  18. runbooks/common/__init__.py +152 -0
  19. runbooks/common/accuracy_validator.py +1039 -0
  20. runbooks/common/context_logger.py +440 -0
  21. runbooks/common/cross_module_integration.py +594 -0
  22. runbooks/common/enhanced_exception_handler.py +1108 -0
  23. runbooks/common/enterprise_audit_integration.py +634 -0
  24. runbooks/common/mcp_cost_explorer_integration.py +900 -0
  25. runbooks/common/mcp_integration.py +548 -0
  26. runbooks/common/performance_monitor.py +387 -0
  27. runbooks/common/profile_utils.py +216 -0
  28. runbooks/common/rich_utils.py +172 -1
  29. runbooks/feedback/user_feedback_collector.py +440 -0
  30. runbooks/finops/README.md +377 -458
  31. runbooks/finops/__init__.py +4 -21
  32. runbooks/finops/account_resolver.py +279 -0
  33. runbooks/finops/accuracy_cross_validator.py +638 -0
  34. runbooks/finops/aws_client.py +721 -36
  35. runbooks/finops/budget_integration.py +313 -0
  36. runbooks/finops/cli.py +59 -5
  37. runbooks/finops/cost_optimizer.py +1340 -0
  38. runbooks/finops/cost_processor.py +211 -37
  39. runbooks/finops/dashboard_router.py +900 -0
  40. runbooks/finops/dashboard_runner.py +990 -232
  41. runbooks/finops/embedded_mcp_validator.py +288 -0
  42. runbooks/finops/enhanced_dashboard_runner.py +8 -7
  43. runbooks/finops/enhanced_progress.py +327 -0
  44. runbooks/finops/enhanced_trend_visualization.py +423 -0
  45. runbooks/finops/finops_dashboard.py +184 -1829
  46. runbooks/finops/helpers.py +509 -196
  47. runbooks/finops/iam_guidance.py +400 -0
  48. runbooks/finops/markdown_exporter.py +466 -0
  49. runbooks/finops/multi_dashboard.py +1502 -0
  50. runbooks/finops/optimizer.py +15 -15
  51. runbooks/finops/profile_processor.py +2 -2
  52. runbooks/finops/runbooks.inventory.organizations_discovery.log +0 -0
  53. runbooks/finops/runbooks.security.report_generator.log +0 -0
  54. runbooks/finops/runbooks.security.run_script.log +0 -0
  55. runbooks/finops/runbooks.security.security_export.log +0 -0
  56. runbooks/finops/schemas.py +589 -0
  57. runbooks/finops/service_mapping.py +195 -0
  58. runbooks/finops/single_dashboard.py +710 -0
  59. runbooks/finops/tests/test_reference_images_validation.py +1 -1
  60. runbooks/inventory/README.md +12 -1
  61. runbooks/inventory/core/collector.py +157 -29
  62. runbooks/inventory/list_ec2_instances.py +9 -6
  63. runbooks/inventory/list_ssm_parameters.py +10 -10
  64. runbooks/inventory/organizations_discovery.py +210 -164
  65. runbooks/inventory/rich_inventory_display.py +74 -107
  66. runbooks/inventory/run_on_multi_accounts.py +13 -13
  67. runbooks/inventory/runbooks.inventory.organizations_discovery.log +0 -0
  68. runbooks/inventory/runbooks.security.security_export.log +0 -0
  69. runbooks/main.py +1371 -240
  70. runbooks/metrics/dora_metrics_engine.py +711 -17
  71. runbooks/monitoring/performance_monitor.py +433 -0
  72. runbooks/operate/README.md +394 -0
  73. runbooks/operate/base.py +215 -47
  74. runbooks/operate/ec2_operations.py +435 -5
  75. runbooks/operate/iam_operations.py +598 -3
  76. runbooks/operate/privatelink_operations.py +1 -1
  77. runbooks/operate/rds_operations.py +508 -0
  78. runbooks/operate/s3_operations.py +508 -0
  79. runbooks/operate/vpc_endpoints.py +1 -1
  80. runbooks/remediation/README.md +489 -13
  81. runbooks/remediation/base.py +5 -3
  82. runbooks/remediation/commons.py +8 -4
  83. runbooks/security/ENTERPRISE_SECURITY_FRAMEWORK.md +506 -0
  84. runbooks/security/README.md +12 -1
  85. runbooks/security/__init__.py +265 -33
  86. runbooks/security/cloudops_automation_security_validator.py +1164 -0
  87. runbooks/security/compliance_automation.py +12 -10
  88. runbooks/security/compliance_automation_engine.py +1021 -0
  89. runbooks/security/enterprise_security_framework.py +930 -0
  90. runbooks/security/enterprise_security_policies.json +293 -0
  91. runbooks/security/executive_security_dashboard.py +1247 -0
  92. runbooks/security/integration_test_enterprise_security.py +879 -0
  93. runbooks/security/module_security_integrator.py +641 -0
  94. runbooks/security/multi_account_security_controls.py +2254 -0
  95. runbooks/security/real_time_security_monitor.py +1196 -0
  96. runbooks/security/report_generator.py +1 -1
  97. runbooks/security/run_script.py +4 -8
  98. runbooks/security/security_baseline_tester.py +39 -52
  99. runbooks/security/security_export.py +99 -120
  100. runbooks/sre/README.md +472 -0
  101. runbooks/sre/__init__.py +33 -0
  102. runbooks/sre/mcp_reliability_engine.py +1049 -0
  103. runbooks/sre/performance_optimization_engine.py +1032 -0
  104. runbooks/sre/production_monitoring_framework.py +584 -0
  105. runbooks/sre/reliability_monitoring_framework.py +1011 -0
  106. runbooks/validation/__init__.py +2 -2
  107. runbooks/validation/benchmark.py +154 -149
  108. runbooks/validation/cli.py +159 -147
  109. runbooks/validation/mcp_validator.py +291 -248
  110. runbooks/vpc/README.md +478 -0
  111. runbooks/vpc/__init__.py +2 -2
  112. runbooks/vpc/manager_interface.py +366 -351
  113. runbooks/vpc/networking_wrapper.py +68 -36
  114. runbooks/vpc/rich_formatters.py +22 -8
  115. runbooks-0.9.1.dist-info/METADATA +308 -0
  116. {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/RECORD +120 -59
  117. {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/entry_points.txt +1 -1
  118. runbooks/finops/cross_validation.py +0 -375
  119. runbooks-0.7.9.dist-info/METADATA +0 -636
  120. {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/WHEEL +0 -0
  121. {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/licenses/LICENSE +0 -0
  122. {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/top_level.txt +0 -0
runbooks/finops/README.md CHANGED
@@ -1,564 +1,483 @@
1
- # CloudOps Runbooks FinOps Platform - Enterprise FAANG SDLC
2
-
3
- **Executive Summary**: Enterprise-grade multi-account AWS cost optimization platform built for FAANG-scale agile development with Claude Code Subagents + MCP Servers + 2×3 tmux orchestration. Designed for both technical teams and business stakeholders through dual interfaces: programmatic CLI and executive-friendly Jupyter notebooks.
4
-
5
- ![Enterprise Architecture](https://img.shields.io/badge/Architecture-Enterprise%20FAANG%20SDLC-blue)
6
- ![AI Integration](https://img.shields.io/badge/AI-Claude%20Code%20Subagents-green)
7
- ![Real-time](https://img.shields.io/badge/Integration-MCP%20Servers-orange)
8
- ![Orchestration](https://img.shields.io/badge/Workflow-2×3%20tmux-purple)
9
-
10
- ---
11
-
12
- ## Why Enterprise FAANG SDLC FinOps?
13
-
14
- Traditional AWS cost management tools fail at enterprise scale. The CloudOps Runbooks FinOps Platform solves this with:
15
-
16
- ### 🎯 **Dual Interface Architecture**
17
- - **Technical Interface**: CLI for DevOps teams, SREs, and cloud engineers
18
- - **Business Interface**: Jupyter notebooks for managers, CFOs, and financial teams
19
- - **Real-time Integration**: MCP servers for live AWS API validation
20
- - **AI-Native Development**: Claude Code Subagents for parallel workflow execution
21
-
22
- ### 🏗️ **Enterprise FAANG SDLC Integration**
23
- - **2×3 tmux Orchestration**: Parallel development across 6 specialized terminals
24
- - **Quality Gates**: 90%+ test pass rate requirements
25
- - **Human-in-the-Loop**: Strategic approval gates for critical decisions
26
- - **Production Safety**: Canary deployment with automated rollback
27
-
28
- ### 💰 **Proven Business Impact**
29
- - **25-50% Cost Reduction**: Real savings identification through optimization
30
- - **60% Efficiency Gain**: Automated analysis vs manual cost review
31
- - **99.9% Reliability**: Enterprise-grade uptime for cost analysis functions
32
- - **100% Audit Compliance**: Complete audit trails for financial reporting
33
-
34
- ---
1
+ # AWS FinOps Dashboard (CLI)
2
+
3
+ The AWS FinOps Dashboard is an open-source, Python-based command-line tool (built with the Rich library) for AWS cost monitoring. It provides multi-account cost summaries by time period, service, and cost allocation tags; budget limits vs. actuals; EC2 instance status; six‑month cost trend charts; and "FinOps audit" reports (e.g. untagged or idle resources). It can export data to CSV/JSON/PDF.
4
+
5
+ ## Expected Deliverable Categories
6
+
7
+ 1. Technical Deliverables
8
+
9
+ - [ ] Runbooks: Implementation-ready automation scripts
10
+ - [ ] Jupyter Notebooks: Interactive analysis with MCP validation
11
+ - [ ] HTML Reports: Professional presentation of notebook outputs
12
+ - [ ] Technical Documentation: Implementation guides, API references, troubleshooting
13
+
14
+ 2. Executive Deliverables
15
+
16
+ - [ ] Strategic Analysis: Business case alignment and gap assessment
17
+ - [ ] Financial Reports: ROI analysis, cost projections, budget impact
18
+ - [ ] Executive Presentations: CTO/CFO ready summaries with key metrics
19
+ - [ ] Implementation Roadmaps: Timeline, resource requirements, risk mitigation
20
+
21
+ 3. DoD Evidence Package
22
+
23
+ - [ ] Validation Reports: MCP cross-validation evidence
24
+ - [ ] Performance Benchmarks: Actual vs target metrics
25
+ - [ ] Audit Trails: Complete evidence chain for compliance
26
+ - [ ] Test Results: Comprehensive testing documentation
27
+
28
+ > Success Criteria
29
+
30
+ - [ ] Complete inventory of all existing deliverables
31
+ - [ ] Clear identification of gaps requiring immediate attention
32
+ - [ ] Prioritized creation plan for missing deliverables
33
+ - [ ] Quality enhancement roadmap for existing materials
34
+ - [ ] Final deliverables package ready for stakeholder presentation
35
+
36
+ ## 📈 *finops-runbooks*.md Enterprise Rollout
37
+
38
+ Following proven **99/100 manager score** success patterns across 61 enterprise accounts:
39
+
40
+ ### **Rollout Strategy**: Progressive *-runbooks*.md standardization
41
+ - **Phase 1**: FinOps rollout proven ✅ (99.9996% accuracy, 280% ROI)
42
+ - **Phase 2**: Inventory rollout with *inventory-runbooks*.md patterns
43
+ - **Phase 3**: Operate rollout with *operate-runbooks*.md framework
44
+ - **Phase 4**: Security rollout with *security-runbooks*.md standards
45
+
46
+ ## Why AWS FinOps Dashboard?
47
+
48
+ Managing and understanding your AWS expenditure, especially across multiple accounts and services, can be complex. The AWS FinOps Dashboard CLI aims to simplify this by providing a clear, concise, and actionable view of your AWS costs and operational hygiene directly in your terminal.
49
+
50
+ Key features include:
51
+ * **Unified View:** Consolidate cost and resource data from multiple AWS accounts.
52
+ ![alt text](runbooks finops-dashboard-v2.2.3.png)
53
+ * **Cost Trend Analysis:** View how your AWS costs have been for the past six months.
54
+ ![alt text](runbooks finops-dashboard_trend.png)
55
+ * **Audit Your AWS Accounts:** Quickly identify spending patterns, untagged resources, underutilised resources and potential savings.
56
+ ![alt text](audit_report.png)
57
+ * **Generate Cost & Audit Reports:** You can generate Cost, Trend and Audit Reports in PDF, CSV & JSON formats for further analysis and reporting purposes.
58
+ ![alt text](audit_report_pdf.png)
59
+ ![alt text](cost_report_pdf.png)
35
60
 
36
61
  ## Table of Contents
37
62
 
38
- - [Enterprise Architecture Overview](#enterprise-architecture-overview)
39
- - [Dual Interface Design](#dual-interface-design)
40
- - [FAANG SDLC Workflows](#faang-sdlc-workflows)
41
- - [Claude Code Subagents Integration](#claude-code-subagents-integration)
42
- - [MCP Server Configuration](#mcp-server-configuration)
43
- - [Business Interface (Jupyter Notebooks)](#business-interface-jupyter-notebooks)
44
- - [Technical Interface (CLI)](#technical-interface-cli)
45
- - [5 Core Use Cases](#5-core-use-cases)
46
- - [Installation & Setup](#installation--setup)
47
- - [Production Deployment](#production-deployment)
48
- - [Quality Gates & Testing](#quality-gates--testing)
63
+ - [Features](#features)
64
+ - [Prerequisites](#prerequisites)
65
+ - [Installation](#installation)
66
+ - [AWS CLI Profile Setup](#aws-cli-profile-setup)
67
+ - [Command Line Usage](#command-line-usage)
68
+ - [Options](#command-line-options)
69
+ - [Examples](#examples)
70
+ - [Using a Configuration File](#using-a-configuration-file)
71
+ - [TOML Configuration Example (`config.toml`)](#toml-configuration-example-configtoml)
72
+ - [YAML Configuration Example (`config.yaml` or `config.yml`)](#yaml-configuration-example-configyaml-or-configyml)
73
+ - [JSON Configuration Example (`config.json`)](#json-configuration-example-configjson)
74
+ - [Export Formats](#export-formats)
75
+ - [Cost For Every Run](#cost-for-every-run)
49
76
  - [Contributing](#contributing)
77
+ - [License](#license)
50
78
 
51
79
  ---
52
80
 
53
- ## Enterprise Architecture Overview
54
-
55
- ### 🏗️ **Separation of Concerns (50%+ Code Reduction)**
56
- ```
57
- ┌─────────────────────────────────────────────────────────────┐
58
- │ PRESENTATION LAYER │
59
- ├─────────────────────┬───────────────────────────────────────┤
60
- CLI Interface │ Jupyter Notebook Interface │
61
- (Technical Teams) │ (Business Teams) │
62
- ├─────────────────────┴───────────────────────────────────────┤
63
- │ UTILITIES MODULE │
64
- │ (finops_notebook_utils.py) │
65
- ├─────────────────────────────────────────────────────────────┤
66
- │ BUSINESS LOGIC │
67
- │ (finops_dashboard.py v0.7.8) │
68
- ├─────────────────────────────────────────────────────────────┤
69
- │ AWS INTEGRATION LAYER │
70
- │ (Cost Explorer, EC2, RDS, Lambda, S3) │
71
- └─────────────────────────────────────────────────────────────┘
72
- ```
81
+ ## Features
82
+
83
+ - **Cost Analysis by Time Period**:
84
+ - View current & previous month's spend by default
85
+ - Set custom time ranges (e.g., 7, 30, 90 days) with `--time-range` option
86
+ - **Cost by AWS Service**: Sorted by highest cost for better insights
87
+ - **Cost by Tag**: Get the cost data by one or more tags with `--tag`(cost allocation tags must be enabled)
88
+ - **AWS Budgets Information**: Displays budget limits and actual spend
89
+ - **EC2 Instance Status**: Detailed state information across specified/accessible regions
90
+ - **Cost Trend Analysis**: View detailed cost trends in bar charts for the last 6 months across AWS profiles
91
+ - **FinOps Audit**: View untagged resources, unused or stopped resources, and Budget breaches across AWS profiles.
92
+ - **Profile Management**:
93
+ - Automatic profile detection
94
+ - Specific profile selection with `--profiles`
95
+ - Use all available profiles with `--all`
96
+ - Combine profiles from the same AWS account with `--combine`
97
+ - **Region Control**: Specify regions for EC2 discovery using `--regions`
98
+ - **Export Options**:
99
+ - CSV export with `--report-name` and `--report-type csv`
100
+ - JSON export with `--report-name` and `--report-type json`
101
+ - PDF export with `--report-name` and `--report-type pdf`
102
+ - Export to both CSV and JSON formats with `--report-name` and `--report-type csv json`
103
+ - Specify output directory using `--dir`
104
+ - **Note**: Trend reports (generated via `--trend`) currently only support JSON export. Other formats specified in `--report-type` will be ignored for these reports.
105
+ - **Improved Error Handling**: Resilient and user-friendly error messages
106
+ - **Beautiful Terminal UI**: Styled with the Rich library for a visually appealing experience
73
107
 
74
- ### 🎯 **FAANG Agile SDLC Benefits**
75
- - **Parallel Development**: 6 Claude Code Subagents across 2×3 tmux terminals
76
- - **Real-time Validation**: MCP servers with ±15% cross-validation tolerance
77
- - **Quality Assurance**: 90%+ test pass rate gates
78
- - **Production Safety**: Human approval gates with rollback capability
108
+ ---
79
109
 
110
+ ## Prerequisites
111
+
112
+ - **Python 3.8 or later**: Ensure you have the required Python version installed
113
+ - **AWS CLI configured with named profiles**: Set up your AWS CLI profiles for seamless integration
114
+ - **AWS credentials with permissions**:
115
+ - `ce:GetCostAndUsage`
116
+ - `budgets:ViewBudget`
117
+ - `ec2:DescribeInstances`
118
+ - `ec2:DescribeRegions`
119
+ - `sts:GetCallerIdentity`
120
+ - `ec2:DescribeInstances`
121
+ - `ec2:DescribeVolumes`
122
+ - `ec2:DescribeAddresses`
123
+ - `rds:DescribeDBInstances`
124
+ - `rds:ListTagsForResource`
125
+ - `lambda:ListFunctions`
126
+ - `lambda:ListTags`
127
+ - `elbv2:DescribeLoadBalancers`
128
+ - `elbv2:DescribeTags`
129
+
80
130
  ---
81
131
 
82
- ## Dual Interface Design
132
+ ## Installation
83
133
 
84
- ### 👨‍💻 **Technical Interface (CLI)**
85
- **Target Audience**: DevOps, SRE, Cloud Engineers
86
- ```bash
87
- # Multi-account cost dashboard
88
- python -m runbooks.finops
134
+ There are several ways to install the AWS FinOps Dashboard:
89
135
 
90
- # Cost trend analysis (6-month historical)
91
- python -m runbooks.finops --trend
92
136
 
93
- # Resource audit and compliance
94
- python -m runbooks.finops --audit
137
+ ### Option 3: Using uv (Fast Python Package Installer)
138
+ [uv](https://github.com/astral-sh/uv) is a modern Python package installer and resolver that's extremely fast.
95
139
 
96
- # Export in multiple formats
97
- python -m runbooks.finops --report-type csv json pdf
140
+ ```bash
141
+ # Install runbooks aws finops dashboard
142
+ uv pip install runbooks
98
143
  ```
99
144
 
100
- ### 👩‍💼 **Business Interface (Jupyter Notebooks)**
101
- **Target Audience**: Managers, CFOs, Financial Teams
102
-
103
- **Multi-Account Executive Dashboard**: `notebooks/finops/finops-dashboard.ipynb`
104
- - Executive cost summaries with drill-down capability
105
- - Budget compliance dashboards with red/yellow/green indicators
106
- - Resource optimization recommendations with ROI analysis
107
-
108
- **Single Account Analysis**: `notebooks/finops/finops-dashboard-single.ipynb`
109
- - Focused single account deep-dive analysis
110
- - Simplified presentation layer (50%+ code reduction achieved)
111
- - Real-time AWS data integration for account `499201730520`
112
-
113
145
  ---
114
146
 
115
- ## FAANG SDLC Workflows
147
+ ## AWS CLI Profile Setup
116
148
 
117
- ### 🖥️ **2×3 tmux Orchestration Layout**
118
- ```
119
- ┌─────────────────┬─────────────────┬─────────────────┐
120
- │ 0: Management │ 1: Development │ 2: Architecture │
121
- │ (HITL Approval) │ (MCP + Coding) │ (Security+Arch) │
122
- ├─────────────────┼─────────────────┼─────────────────┤
123
- │ 3: Testing │ 4: Cost/Ops │ 5: Deployment │
124
- │ (90%+ Gate) │ (FinOps+Bills) │ (Canary+Rollbk) │
125
- └─────────────────┴─────────────────┴─────────────────┘
126
- ```
149
+ If you haven't already, configure your named profiles using the AWS CLI:
127
150
 
128
- ### 🚀 **Launch FAANG Workflow**
129
151
  ```bash
130
- # Setup 2×3 tmux orchestration
131
- ./scripts/setup_faang_tmux.sh
132
-
133
- # Each terminal is pre-configured with:
134
- # - Environment variables (BILLING_PROFILE, MANAGEMENT_PROFILE)
135
- # - Claude Code Subagents coordination
136
- # - MCP server integration
137
- # - Real-time AWS API access
152
+ aws configure --profile profile1-name
153
+ aws configure --profile profile2-name
154
+ # ... etc ...
138
155
  ```
139
156
 
140
- ### 📋 **Terminal Responsibilities**
141
- - **Terminal 0 (Management)**: Human-in-the-Loop approval gates, strategic oversight
142
- - **Terminal 1 (Development)**: Core implementation with MCP validation
143
- - **Terminal 2 (Architecture)**: Security and multi-account patterns
144
- - **Terminal 3 (Testing)**: Quality assurance with 90%+ pass rate gate
145
- - **Terminal 4 (Cost/Ops)**: FinOps analysis and billing integration
146
- - **Terminal 5 (Deployment)**: Production rollout with canary safety
157
+ Single AWS profile, centralised-ops, billing, ... multi-account LZ
158
+
159
+ Repeat this for all the profiles you want the dashboard to potentially access.
147
160
 
148
161
  ---
149
162
 
150
- ## Claude Code Subagents Integration
163
+ ## Command Line Usage
151
164
 
152
- ### 🤖 **6 Specialized Agents**
153
- **Agent Assignment to 2×3 tmux Layout**:
165
+ Run the script using `runbooks finops` followed by options:
154
166
 
155
167
  ```bash
156
- # Terminal 0: enterprise-product-owner
157
- # - Strategic HITL coordination
158
- # - Business approval workflows
159
- # - Stakeholder communication
160
-
161
- # Terminal 1: python-runbooks-engineer
162
- # - Core development with MCP integration
163
- # - AWS API automation
164
- # - Business logic implementation
165
-
166
- # Terminal 2: cloudops-architect
167
- # - Multi-account architecture design
168
- # - Security validation
169
- # - Infrastructure patterns
170
-
171
- # Terminal 3: qa-testing-specialist
172
- # - 90%+ quality gate validation
173
- # - Automated testing execution
174
- # - Quality assurance
175
-
176
- # Terminal 4: cost-finops-agent
177
- # - Cost optimization analysis
178
- # - Billing profile integration
179
- # - Financial governance
180
-
181
- # Terminal 5: sre-automation-specialist
182
- # - Production deployment safety
183
- # - Canary rollout management
184
- # - Automated rollback capability
168
+ runbooks finops [options]
185
169
  ```
186
170
 
187
- ### 🔄 **Parallel Execution Workflow**
188
- 1. **Planning Phase**: Enterprise-product-owner coordinates requirements
189
- 2. **Parallel Development**: Multiple agents execute simultaneously
190
- 3. **Quality Gate**: 90%+ test pass rate validation
191
- 4. **Human Approval**: Strategic review and business approval
192
- 5. **Deployment**: Canary rollout with safety controls
171
+ ### Command Line Options
172
+
173
+ | Flag | Description |
174
+ |---|---|
175
+ | `--config-file`, `-C` | Path to a TOML, YAML, or JSON configuration file. Command-line arguments will override settings from the config file. |
176
+ | `--profiles`, `-p` | Specific AWS profiles to use (space-separated). If omitted, uses 'default' profile if available, otherwise all profiles. |
177
+ | `--regions`, `-r` | Specific AWS regions to check for EC2 instances (space-separated). If omitted, attempts to check all accessible regions. |
178
+ | `--all`, `-a` | Use all available AWS profiles found in your config. |
179
+ | `--combine`, `-c` | Combine profiles from the same AWS account into single rows. |
180
+ | `--tag`, `-g` | Filter cost data by one or more cost allocation tags in `Key=Value` format. Example: `--tag Team=DevOps Env=Prod` |
181
+ | `--report-name`, `-n` | Specify the base name for the report file (without extension). |
182
+ | `--report-type`, `-y` | Specify report types (space-separated): 'csv', 'json', 'pdf'. For reports generated with `--audit`, only 'pdf' is applicable and other types will be ignored. |
183
+ | `--dir`, `-d` | Directory to save the report file(s) (default: current directory). |
184
+ | `--time-range`, `-t` | Time range for cost data in days (default: current month). Examples: 7, 30, 90. |
185
+ | `--trend` | View cost trend analysis for the last 6 months. |
186
+ | `--audit` | View list of untagged, unused resoruces and budget breaches. |
187
+
188
+ ### Examples
193
189
 
194
- ---
190
+ ```bash
191
+ # Use default profile, show output in terminal only
192
+ runbooks finops
195
193
 
196
- ## MCP Server Configuration
194
+ # Use specific profiles 'dev' and 'prod'
195
+ runbooks finops --profiles dev prod
197
196
 
198
- ### 🔗 **Real-time AWS API Validation**
199
- **MCP Integration Manager**: `notebooks/mcp_integration.py`
200
- ```python
201
- from mcp_integration import (
202
- create_mcp_manager_for_single_account,
203
- CrossValidationEngine
204
- )
197
+ # Use all available profiles
198
+ runbooks finops --all
205
199
 
206
- # Initialize MCP manager for real-time validation
207
- mcp_manager = create_mcp_manager_for_single_account()
200
+ # Combine profiles from the same AWS account
201
+ runbooks finops --all --combine
208
202
 
209
- # Cross-validation with ±15% tolerance for production safety
210
- validator = CrossValidationEngine(tolerance_percent=15.0)
211
- ```
203
+ # Specify custom regions to check for EC2 instances
204
+ runbooks finops --regions us-east-1 eu-west-1 ap-southeast-2
212
205
 
213
- ### 📊 **Cross-Validation Features**
214
- - **Real-time Data Validation**: Live AWS API cross-checking
215
- - **Tolerance Thresholds**: ±15% variance tolerance for production safety
216
- - **Automatic Drift Detection**: Alert on significant data discrepancies
217
- - **Audit Trail Generation**: Complete validation logging
206
+ # View cost data for the last 30 days instead of current month
207
+ runbooks finops --time-range 30
218
208
 
219
- ### ⚙️ **MCP Server Setup**
220
- ```bash
221
- # Environment configuration
222
- export BILLING_PROFILE="ams-admin-Billing-ReadOnlyAccess-909135376185"
223
- export MANAGEMENT_PROFILE="ams-admin-ReadOnlyAccess-909135376185"
224
- export SINGLE_AWS_PROFILE="ams-shared-services-non-prod-ReadOnlyAccess-499201730520"
209
+ # View cost data only for a specific tag (e.g., Team=DevOps)
210
+ runbooks finops --tag Team=DevOps
225
211
 
226
- # MCP validation ready
227
- python -c "from notebooks.mcp_integration import *; print('✅ MCP servers operational')"
228
- ```
212
+ # View cost data for multiple tags (e.g., Team=DevOps and Env=Prod)
213
+ runbooks finops --tag Team=Devops Env=Prod
229
214
 
230
- ---
215
+ # Export data to CSV only
216
+ runbooks finops --all --report-name aws_dashboard_data --report-type csv
231
217
 
232
- ## Business Interface (Jupyter Notebooks)
233
-
234
- ### 📊 **Executive Dashboard Features**
235
- **Multi-Account Executive Interface**: `notebooks/finops/finops-dashboard.ipynb`
236
- - **Cost Trend Visualization**: Interactive charts with drill-down capability
237
- - **Budget Compliance Dashboard**: Red/yellow/green status indicators
238
- - **Resource Optimization Recommendations**: Actionable cost savings opportunities
239
- - **Executive Summary Reports**: One-page summaries for C-level stakeholders
240
- - **Export Capabilities**: PDF, Excel, PowerPoint-ready formats
241
-
242
- ### 🎯 **Single Account Focused Analysis**: `notebooks/finops/finops-dashboard-single.ipynb`
243
- **Target Account**: `ams-shared-services-non-prod-ReadOnlyAccess-499201730520`
244
- - **Simplified Architecture**: Presentation layer only (50%+ code reduction)
245
- - **Business Logic Delegation**: Core functionality in `notebooks/finops_notebook_utils.py`
246
- - **Real AWS Integration**: Live Cost Explorer and billing data
247
- - **5 Reference Outputs**: CLI-style results matching enterprise standards
248
-
249
- ### 🏗️ **Enterprise Notebook Utilities**
250
- **Business Logic Module**: `notebooks/finops_notebook_utils.py`
251
- ```python
252
- from finops_notebook_utils import (
253
- SingleAccountNotebookConfig,
254
- MultiAccountNotebookConfig,
255
- NotebookCostTrendAnalyzer,
256
- NotebookDiscoveryRunner,
257
- NotebookExportEngine,
258
- generate_reference_outputs
259
- )
260
-
261
- # Simplified configuration for single account
262
- config = SingleAccountNotebookConfig()
263
-
264
- # Delegate complex analysis to utilities
265
- analyzer = NotebookCostTrendAnalyzer(config)
266
- results = analyzer.analyze_and_display()
267
- ```
218
+ # Export data to JSON only
219
+ runbooks finops --all --report-name aws_dashboard_data --report-type json
268
220
 
269
- ---
221
+ # Export data to both CSV and JSON formats simultaneously
222
+ runbooks finops --all --report-name aws_dashboard_data --report-type csv json
270
223
 
271
- ## Technical Interface (CLI)
224
+ # Export combined data for 'dev' and 'prod' profiles to a specific directory
225
+ runbooks finops --profiles dev prod --combine --report-name report --report-type csv --dir output_reports
272
226
 
273
- ### 🛠️ **Core CLI Commands**
274
- ```bash
275
- # Primary FinOps dashboard (Use Case 1)
276
- runbooks finops [--profiles PROFILE1 PROFILE2] [--all] [--combine]
227
+ # View cost trend analysis as bar charts for profile 'dev' and 'prod'
228
+ runbooks finops --profiles dev prod -r us-east-1 --trend
277
229
 
278
- # Cost trend analysis (Use Case 2)
279
- runbooks finops --trend [--time-range DAYS]
230
+ # View cost trend analysis for all cli profiles for a specific cost tag 'Team=DevOps'
231
+ runbooks finops --all --trend --tag Team=DevOps
280
232
 
281
- # Resource audit (Use Cases 3 & 4)
282
- runbooks finops --audit [--regions REGION1 REGION2]
233
+ # View audit report for profile 'dev' in region 'us-east-1'
234
+ runbooks finops -p dev -r us-east-1 --audit
283
235
 
284
- # Export and reporting
285
- runbooks finops --report-type csv json pdf --report-name FILENAME
236
+ # View audit report for profile 'dev' in region 'us-east-1' and export it as a pdf file to current working dir with file name 'Dev_Audit_Report'
237
+ runbooks finops -p dev -r us-east-1 --audit -n Dev_Audit_Report -y pdf
238
+
239
+ # Use a configuration file for settings
240
+ runbooks finops --config-file path/to/your_config.toml
241
+ # or
242
+ runbooks finops -C path/to/your_config.yaml
286
243
  ```
287
244
 
288
- ### 📋 **Advanced Options**
289
- | Flag | Description | FAANG Integration |
290
- |------|------------|------------------|
291
- | `--profiles`, `-p` | Specific AWS profiles | Compatible with MCP validation |
292
- | `--all`, `-a` | Use all available profiles | Multi-account architecture support |
293
- | `--combine`, `-c` | Merge same-account profiles | Optimized for enterprise landing zones |
294
- | `--regions`, `-r` | Specify EC2 discovery regions | Multi-region scanning |
295
- | `--trend` | 6-month cost trend analysis | Terminal 4 (Cost/Ops) integration |
296
- | `--audit` | Resource compliance audit | Security validation integration |
297
- | `--tag`, `-g` | Filter by cost allocation tags | Cost governance support |
298
- | `--time-range`, `-t` | Custom analysis period | Flexible reporting periods |
299
-
300
- ### 🔄 **Export Contract Enforcement**
301
- - **Cost Trend**: JSON-only export (other formats ignored)
302
- - **Audit Report**: PDF-only export (other formats ignored)
303
- - **Dashboard**: All formats supported (CSV, JSON, PDF)
245
+ You'll see a live-updating table of your AWS account cost and usage details in the terminal. If export options are specified, a report file will also be generated upon completion.
304
246
 
305
247
  ---
306
248
 
307
- ## 5 Core Use Cases
308
-
309
- ### 1️⃣ **Multi-Account Cost Dashboard**
310
- **Business Value**: Unified view across AWS Organizations
311
- - **Output**: Terminal table with cost breakdown, budget status, EC2 summary
312
- - **CLI**: `runbooks finops --all --combine`
313
- - **Notebook**: `finops-dashboard.ipynb` cells 1-8
314
- - **Validation**: Service costs reconciliation (Σ = total ± $0.01)
315
-
316
- ### 2️⃣ **Cost Trend Analysis (6-Month)**
317
- **Business Value**: Historical cost patterns and forecasting
318
- - **Output**: Colored bar visualization with MoM percentage changes
319
- - **CLI**: `runbooks finops --trend`
320
- - **Notebook**: `finops-dashboard-single.ipynb` cells 8-10
321
- - **Export**: JSON-only format enforced
322
-
323
- ### 3️⃣ **Resource Audit (Terminal)**
324
- **Business Value**: Operational hygiene and compliance
325
- - **Output**: Untagged resources, stopped instances, unused volumes/EIPs
326
- - **CLI**: `runbooks finops --audit --regions us-east-1 us-west-2`
327
- - **Notebook**: `finops-dashboard-single.ipynb` cells 11-12
328
- - **Scope**: EC2, RDS, Lambda, ELBv2 across specified regions
329
-
330
- ### 4️⃣ **Executive Audit Report (PDF)**
331
- **Business Value**: Print-ready compliance documentation
332
- - **Output**: Professional PDF layout for executive review
333
- - **CLI**: `runbooks finops --audit --report-type pdf`
334
- - **Export**: PDF-only format enforced
335
- - **Features**: Footer notes, timestamp, executive formatting
336
-
337
- ### 5️⃣ **Cost Comparison Report (PDF)**
338
- **Business Value**: Period-to-period financial analysis
339
- - **Output**: Side-by-side period comparison with service breakdown
340
- - **CLI**: `runbooks finops --report-type pdf`
341
- - **Features**: Budget integration, EC2 counts, executive summary
249
+ ## Using a Configuration File
342
250
 
343
- ---
251
+ Instead of passing all options via the command line, you can use a configuration file in TOML, YAML, or JSON format. Use the `--config-file` or `-C` option to specify the path to your configuration file.
344
252
 
345
- ## Installation & Setup
253
+ Command-line arguments will always take precedence over settings defined in the configuration file.
346
254
 
347
- ### 🚀 **Quick Start (Production Ready)**
348
- ```bash
349
- # Install CloudOps Runbooks
350
- pip install runbooks
351
- # or
352
- uv add runbooks
255
+ Below are examples of how to structure your configuration file.
353
256
 
354
- # Verify installation
355
- runbooks finops --version
257
+ ### TOML Configuration Example (`config.toml`)
356
258
 
357
- # Setup FAANG SDLC orchestration
358
- ./scripts/setup_faang_tmux.sh
259
+ ```toml
260
+ # config.toml
261
+ profiles = ["dev-profile", "prod-profile"]
262
+ regions = ["us-east-1", "eu-west-2"]
263
+ combine = true
264
+ report_name = "monthly_finops_summary"
265
+ report_type = ["csv", "pdf"] # For cost dashboard. For audit, only PDF is used.
266
+ dir = "./reports/runbooks finops" # Defaults to present working directory
267
+ time_range = 30 # Defaults to 30 days
268
+ tag = ["CostCenter=Alpha", "Project=Phoenix"] # Optional
269
+ audit = false # Set to true to run audit report by default
270
+ trend = false # Set to true to run trend report by default
359
271
  ```
360
272
 
361
- ### 🔧 **Enterprise Configuration**
362
- ```bash
363
- # AWS Profile Configuration
364
- export BILLING_PROFILE="ams-admin-Billing-ReadOnlyAccess-909135376185"
365
- export MANAGEMENT_PROFILE="ams-admin-ReadOnlyAccess-909135376185"
366
- export SINGLE_AWS_PROFILE="ams-shared-services-non-prod-ReadOnlyAccess-499201730520"
367
-
368
- # Environment Setup
369
- export PYTHONPATH="/path/to/CloudOps-Runbooks/src:/path/to/CloudOps-Runbooks/notebooks"
370
-
371
- # Verify MCP integration
372
- python -c "from notebooks.mcp_integration import *; print('✅ MCP operational')"
373
-
374
- # Verify notebook utilities
375
- python -c "from notebooks.finops_notebook_utils import *; print('✅ Utilities ready')"
273
+ ### YAML Configuration Example (`config.yaml` or `config.yml`)
274
+
275
+ ```yaml
276
+ # config.yaml
277
+ profiles:
278
+ - dev-profile
279
+ - prod-profile
280
+ regions:
281
+ - us-east-1
282
+ - eu-west-2
283
+ combine: true
284
+ report_name: "monthly_finops_summary"
285
+ report_type:
286
+ - csv
287
+ - pdf # For cost dashboard. For audit, only PDF is used.
288
+ dir: "./reports/runbooks finops"
289
+ time_range: 30
290
+ tag:
291
+ - "CostCenter=Alpha"
292
+ - "Project=Phoenix"
293
+ audit: false # Set to true to run audit report by default
294
+ trend: false # Set to true to run trend report by default
376
295
  ```
377
296
 
378
- ### 📋 **Required AWS Permissions**
297
+ ### JSON Configuration Example (`config.json`)
298
+
379
299
  ```json
380
300
  {
381
- "Version": "2012-10-17",
382
- "Statement": [
383
- {"Effect":"Allow","Action":["ce:GetCostAndUsage"],"Resource":"*"},
384
- {"Effect":"Allow","Action":["budgets:ViewBudget"],"Resource":"*"},
385
- {"Effect":"Allow","Action":["ec2:DescribeRegions","ec2:DescribeInstances","ec2:DescribeVolumes","ec2:DescribeAddresses"],"Resource":"*"},
386
- {"Effect":"Allow","Action":["rds:DescribeDBInstances","rds:ListTagsForResource"],"Resource":"*"},
387
- {"Effect":"Allow","Action":["lambda:ListFunctions","lambda:ListTags"],"Resource":"*"},
388
- {"Effect":"Allow","Action":["elbv2:DescribeLoadBalancers","elbv2:DescribeTags"],"Resource":"*"},
389
- {"Effect":"Allow","Action":["sts:GetCallerIdentity"],"Resource":"*"}
390
- ]
301
+ "profiles": ["dev-profile", "prod-profile"],
302
+ "regions": ["us-east-1", "eu-west-2"],
303
+ "combine": true,
304
+ "report_name": "monthly_finops_summary",
305
+ "report_type": ["csv", "pdf"], /* For cost dashboard. For audit, only PDF is used. */
306
+ "dir": "./reports/runbooks finops",
307
+ "time_range": 30,
308
+ "tag": ["CostCenter=Alpha", "Project=Phoenix"],
309
+ "audit": false, /* Set to true to run audit report by default */
310
+ "trend": false /* Set to true to run trend report by default */
391
311
  }
392
312
  ```
393
-
394
313
  ---
395
314
 
396
- ## Production Deployment
315
+ ## Export Formats
397
316
 
398
- ### 🎯 **Quality Gates (FAANG SDLC)**
399
- ```bash
400
- # 90%+ Test Pass Rate Gate
401
- pytest tests/finops/ -v --tb=short
317
+ ### CSV Output Format
402
318
 
403
- # Code Quality Gate
404
- task code_quality # Format, lint, type check
319
+ When exporting to CSV, a file is generated with the following columns:
405
320
 
406
- # MCP Cross-Validation Gate
407
- python -c "from notebooks.mcp_integration import CrossValidationEngine; print('✅ Validation ready')"
321
+ - `CLI Profile`
322
+ - `AWS Account ID`
323
+ - `Last Month Cost` (or previous period based on time range)
324
+ - `Current Month Cost` (or current period based on time range)
325
+ - `Cost By Service` (Each service and its cost appears on a new line within the cell)
326
+ - `Budget Status` (Each budget's limit and actual spend appears on a new line within the cell)
327
+ - `EC2 Instances` (Each instance state and its count appears on a new line within the cell)
408
328
 
409
- # Integration Test Gate
410
- python -c "from notebooks.finops_notebook_utils import *; config = SingleAccountNotebookConfig(); print('✅ Integration ready')"
411
- ```
329
+ **Note:** Due to the multi-line formatting in some cells, it's best viewed in spreadsheet software (like Excel, Google Sheets, LibreOffice Calc) rather than plain text editors.
330
+
331
+ ### JSON Output Format
332
+
333
+ When exporting to JSON, a structured file is generated that includes all dashboard data in a format that's easy to parse programmatically.
334
+
335
+ ### PDF Output Format (for Audit Report)
412
336
 
413
- ### 🚀 **Deployment Workflow**
414
- 1. **Development**: Code implementation in Terminal 1 (Development)
415
- 2. **Testing**: Quality validation in Terminal 3 (Testing)
416
- 3. **Architecture Review**: Security validation in Terminal 2 (Architecture)
417
- 4. **Business Approval**: Human-in-the-Loop in Terminal 0 (Management)
418
- 5. **Deployment**: Canary rollout in Terminal 5 (Deployment)
419
-
420
- ### 📊 **Production Monitoring**
421
- - **Cost Trend Monitoring**: Automated anomaly detection
422
- - **Resource Drift Alerts**: Configuration change notifications
423
- - **Budget Threshold Monitoring**: Proactive overspend prevention
424
- - **API Rate Limit Management**: Intelligent request throttling
425
- - **Cross-Validation Logging**: Complete audit trail for compliance
426
-
427
- ### ↩️ **Rollback Capability**
428
- - **Configuration Backup**: Multi-profile setup preservation
429
- - **State Preservation**: Complete rollback to previous working state
430
- - **Data Export Redundancy**: Multiple format generation for reliability
431
- - **Automated Rollback**: Triggered by validation failures
337
+ When exporting to PDF, a file is generated with the following columns:
338
+
339
+ - `Profile`
340
+ - `Account ID`
341
+ - `Untagged Resources`
342
+ - `Stopped EC2 Instances`
343
+ - `Unused Volumes`
344
+ - `Unused EIPs`
345
+ - `Budget Alerts`
432
346
 
433
347
  ---
434
348
 
435
- ## Quality Gates & Testing
349
+ ## Cost For Every Run
436
350
 
437
- ### 🧪 **Test Coverage (87% Success Rate)**
438
- **Integration Test Suite**: `tests/finops/test_notebook_integration.py`
439
- - **Current Status**: 13/15 tests passing
440
- - **Coverage Areas**: Notebook utilities, MCP integration, business logic separation
441
- - **FAANG Requirement**: 90%+ pass rate for deployment approval
351
+ This script makes API calls to AWS, primarily to Cost Explorer, Budgets, EC2, and STS. AWS may charge for Cost Explorer API calls (typically `$0.01` for each API call, check current pricing).
442
352
 
443
- ### 🔍 **Validation Layers**
444
- ```python
445
- # Layer 1: Unit Tests (Business Logic)
446
- pytest src/runbooks/finops/tests/ -v
353
+ The number of API calls depends heavily on the options used:
447
354
 
448
- # Layer 2: Integration Tests (Notebook Utilities)
449
- pytest tests/finops/test_notebook_integration.py -v
355
+ - **Default dashboard when `--audit` or `--trend` flags not used**:
356
+ - It costs you $0.06 for one AWS Profile and $0.03 extra for each AWS profile queried.
357
+ - **Cost Trend dashboard when `--trend` flag is used**:
358
+ - It costs you $0.03 for each AWS profile queried.
359
+ - **Audit Dashboard when `--audit` flag is used**:
360
+ - Free
450
361
 
451
- # Layer 3: MCP Validation (Cross-Validation)
452
- python -c "from notebooks.mcp_integration import CrossValidationEngine; validator = CrossValidationEngine(); print('✅ MCP validation ready')"
362
+ **To minimize API calls and potential costs:**
453
363
 
454
- # Layer 4: End-to-End (Complete Workflow)
455
- BILLING_PROFILE="ams-admin-Billing-ReadOnlyAccess-909135376185" python notebooks/finops/test_complete_workflow.py
456
- ```
364
+ - Use the `--profiles` argument to specify only the profiles you need.
365
+ - Consider using the `--combine` option when working with multiple profiles from the same AWS account.
457
366
 
458
- ### 📋 **Quality Metrics**
459
- - **Financial Accuracy**: ±$0.01 cost reconciliation tolerance
460
- - **Data Consistency**: 100% export format consistency
461
- - **Performance**: <2 second CLI response, <5 minute notebook execution
462
- - **Reliability**: 99.9% uptime for core cost analysis functions
463
- - **Security**: Zero security findings in quarterly audits
367
+ The exact cost per run is usually negligible but depends on the scale of your usage and AWS pricing.
464
368
 
465
369
  ---
466
370
 
467
- ## API Costs and Usage
371
+ ### 💰 FinOps Excellence: Cost Analytics & Optimization
468
372
 
469
- ### 💰 **AWS API Cost Structure**
470
- - **Main Dashboard**: $0.06 for one AWS profile + $0.03 per additional profile
471
- - **Cost Trend Analysis**: $0.03 per AWS profile queried
472
- - **Audit Reports**: Free (uses EC2/RDS/Lambda describe APIs)
373
+ **Goal**: Enterprise AWS cost analysis with real-time insights and multi-format reporting
374
+
375
+ #### **AWS Environment Setup (Copy-Paste Ready)**
473
376
 
474
- ### 🎯 **Cost Optimization Strategies**
475
377
  ```bash
476
- # Target specific profiles to minimize costs
477
- runbooks finops --profiles critical-prod-account
378
+ # 🔐 Your Validated AWS SSO Configuration
379
+ export SSO_SESSION="xops-enterprise"
380
+ export AWS_SSO_START_URL="https://xops.awsapps.com/start"
381
+
382
+ # 💰 Multi-Profile Configuration (Enterprise Ready)
383
+ export BILLING_PROFILE="XXX"
384
+ export MANAGEMENT_PROFILE="XXX"
385
+ export CENTRALISED_OPS_PROFILE="XXX"
386
+ export SINGLE_AWS_PROFILE="XXX"
387
+
388
+ # ✅ Authentication Test (Should show your account access)
389
+ aws sts get-caller-identity --profile $BILLING_PROFILE
390
+ aws sts get-caller-identity --profile $SINGLE_AWS_PROFILE
391
+ ```
478
392
 
479
- # Use profile combining for same AWS account
480
- runbooks finops --all --combine
393
+ #### **Core FinOps Commands (Tested & Validated)**
481
394
 
482
- # Cache results for repeated analysis
483
- runbooks finops --report-type json --report-name cached-analysis
395
+ ```bash
396
+ # 🚀 Installation & Quick Test
397
+ uv run runbooks finops --help # Verify CLI accessibility
398
+
399
+ # 📊 1. Cost Dashboard (Real AWS Cost Explorer Data)
400
+ # Shows current month: ~$136K, last month: ~$148K
401
+ uv run runbooks finops --profile $BILLING_PROFILE
402
+ uv run runbooks finops --profile $SINGLE_AWS_PROFILE
403
+
404
+ # 📈 2. Cost Trend Analysis (6-Month Historical Data)
405
+ # Dynamic Auckland timezone - no hardcoded dates
406
+ uv run runbooks finops --trend --profile $BILLING_PROFILE
407
+ uv run runbooks finops --trend --profile $SINGLE_AWS_PROFILE
408
+
409
+ # 🔍 3. Cost Audit Report (9.4s execution)
410
+ # Detailed service breakdown with optimization recommendations
411
+ uv run runbooks finops --audit --profile $BILLING_PROFILE
412
+ uv run runbooks finops --audit --profile $SINGLE_AWS_PROFILE
413
+
414
+ # 📄 4. Multi-Format Export (CSV, JSON, HTML)
415
+ # Manager-ready reports for cost management tools
416
+ uv run runbooks finops --export --profile $BILLING_PROFILE --format csv
417
+ uv run runbooks finops --export --profile $SINGLE_AWS_PROFILE --format json
418
+
419
+ # 📋 5. Executive PDF Report
420
+ # Professional PDF with charts for stakeholder presentation
421
+ uv run runbooks finops --pdf --profile $BILLING_PROFILE
422
+ uv run runbooks finops --pdf --profile $SINGLE_AWS_PROFILE
484
423
  ```
485
424
 
486
- ### 📊 **Real-World ROI**
487
- - **Tool Cost**: ~$0.06-0.15 per analysis run
488
- - **Savings Identified**: $25,000-50,000 annually per enterprise account
489
- - **ROI**: 10,000x+ return on investment
490
- - **Efficiency**: 60% reduction in manual cost analysis time
425
+ #### **Regional Optimization (Sydney/Auckland Context)**
491
426
 
492
- ---
427
+ ```bash
428
+ # 🌏 AP-Southeast-2 (Sydney) Resource Analysis
429
+ export AWS_DEFAULT_REGION="ap-southeast-2"
430
+
431
+ # Combined FinOps + Inventory for regional cost optimization
432
+ uv run runbooks inventory collect --profile $SINGLE_AWS_PROFILE --regions ap-southeast-2
433
+ uv run runbooks finops --audit --profile $SINGLE_AWS_PROFILE
434
+
435
+ # Expected Results:
436
+ # - RDS: ~$20K monthly (identified in your environment)
437
+ # - S3: Multiple buckets for optimization analysis
438
+ # - EC2: Instance rightsizing recommendations
439
+ # - Regional spend concentration analysis
440
+ ```
493
441
 
494
- ## Contributing & Development
442
+ #### **Advanced Enterprise Features**
495
443
 
496
- ### 🛠️ **Development Environment (FAANG SDLC)**
497
444
  ```bash
498
- # Clone and setup
499
- git clone https://github.com/1xOps/CloudOps-Runbooks.git
500
- cd CloudOps-Runbooks
445
+ # 🎯 Organization-Wide Cost Analysis (Management Profile)
446
+ uv run runbooks finops --trend --profile $MANAGEMENT_PROFILE
447
+ uv run runbooks org list-ous --profile $MANAGEMENT_PROFILE
501
448
 
502
- # Install with UV (modern Python package manager)
503
- uv sync
449
+ # 💡 Cost Optimization Recommendations
450
+ # Automated analysis of resource utilization and right-sizing opportunities
451
+ uv run runbooks finops --audit --profile $BILLING_PROFILE --format json > cost-analysis.json
504
452
 
505
- # Setup FAANG development environment
506
- ./scripts/setup_faang_tmux.sh
453
+ # 📊 Business Intelligence Integration
454
+ # Export cost data for integration with BI tools (Tableau, Power BI)
455
+ uv run runbooks finops --export --profile $BILLING_PROFILE --format csv > monthly-costs.csv
507
456
 
508
- # Verify all systems
509
- task validate
457
+ # 🚨 Cost Alerting & Monitoring (Future Feature)
458
+ # Integration with CloudWatch for cost spike detection
459
+ uv run runbooks finops --alert-setup --threshold 150000 --profile $BILLING_PROFILE
510
460
  ```
511
461
 
512
- ### 🤝 **Contribution Workflow**
513
- 1. **Fork & Branch**: Create feature branch from main
514
- 2. **FAANG SDLC**: Use 2×3 tmux orchestration for development
515
- 3. **Quality Gates**: Ensure 90%+ test pass rate
516
- 4. **MCP Validation**: Cross-validate with real AWS APIs
517
- 5. **Human Approval**: Code review with enterprise standards
518
- 6. **Deployment**: Canary merge with automated rollback
519
-
520
- ### 📋 **Development Standards**
521
- - **Code Quality**: Ruff formatting, mypy type checking
522
- - **Testing**: pytest with moto for AWS mocking
523
- - **Documentation**: Comprehensive docstrings and examples
524
- - **Security**: No hardcoded credentials or secrets
525
- - **Performance**: Sub-second CLI responses
526
-
527
- ### 🔍 **Enterprise Support**
528
- - **GitHub Issues**: https://github.com/1xOps/CloudOps-Runbooks/issues
529
- - **Documentation**: Complete guide in `/docs/` directory
530
- - **Enterprise Support**: Available for production deployments
531
- - **Community**: Active development with FAANG SDLC practices
532
-
533
- ---
534
-
535
- ## Success Metrics & Business Value
462
+ #### **Troubleshooting & Validation**
536
463
 
537
- ### 📈 **Financial Impact**
538
- - **Cost Reduction**: 25-50% savings identification through optimization
539
- - **Budget Compliance**: 95%+ accuracy in forecast predictions
540
- - **Resource Utilization**: 80%+ tagged resource compliance
541
- - **Operational Efficiency**: 60% reduction in manual cost analysis time
542
-
543
- ### 🎯 **Technical Excellence**
544
- - **Test Coverage**: 87% automated test success rate (target: 90%+)
545
- - **Performance**: <2 second CLI response, <5 minute notebook execution
546
- - **Reliability**: 99.9% uptime for core cost analysis functions
547
- - **Security**: Zero security findings in enterprise audits
464
+ ```bash
465
+ # 🔧 Common Issues & Solutions
548
466
 
549
- ### 👥 **Business Value**
550
- - **Executive Adoption**: Automated monthly cost review processes
551
- - **Manager Productivity**: Self-service budget monitoring capabilities
552
- - **Developer Experience**: Real-time cost feedback in CI/CD pipelines
553
- - **Compliance**: 100% audit trail coverage for financial reporting
467
+ # Issue 1: "No cost data found"
468
+ # Solution: Ensure Cost Explorer is enabled (already confirmed in your environment)
469
+ aws ce get-cost-and-usage --profile $BILLING_PROFILE --help
554
470
 
555
- ---
471
+ # Issue 2: "Profile not found"
472
+ # Solution: Verify SSO session and profile configuration
473
+ aws sso login --profile $BILLING_PROFILE
474
+ aws configure list-profiles | grep -E "(billing|management|centralised|single)"
556
475
 
557
- **Platform Status**: **Production Ready with Enterprise FAANG SDLC**
558
- - **Architecture**: Dual-interface design for technical and business users
559
- - **Integration**: Claude Code Subagents + MCP + 2×3 tmux orchestration
560
- - **Quality**: 87% test success rate with 90%+ target (13/15 tests passing)
561
- - **Deployment**: Canary rollout with automated rollback capability
562
- - **Business Value**: Proven ROI with 25-50% cost reduction potential
476
+ # Issue 3: "AccessDenied for Cost Explorer"
477
+ # Solution: Verify IAM permissions for ce:GetCostAndUsage
478
+ aws iam simulate-principal-policy --policy-source-arn $(aws sts get-caller-identity --query Arn --output text --profile $BILLING_PROFILE) --action-names ce:GetCostAndUsage
563
479
 
564
- *Powered by CloudOps Runbooks FinOps Platform v0.7.8 with enterprise FAANG SDLC architecture*
480
+ # Validation Test (Should show real cost data)
481
+ uv run runbooks finops --profile $SINGLE_AWS_PROFILE # Should complete without errors
482
+ uv run runbooks finops --trend --profile $BILLING_PROFILE # Should show historical data
483
+ ```