runbooks 0.7.9__py3-none-any.whl → 0.9.0__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 (95) 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/runner.py +42 -34
  5. runbooks/cfat/models.py +1 -1
  6. runbooks/common/__init__.py +152 -0
  7. runbooks/common/accuracy_validator.py +1039 -0
  8. runbooks/common/context_logger.py +440 -0
  9. runbooks/common/cross_module_integration.py +594 -0
  10. runbooks/common/enhanced_exception_handler.py +1108 -0
  11. runbooks/common/enterprise_audit_integration.py +634 -0
  12. runbooks/common/mcp_integration.py +539 -0
  13. runbooks/common/performance_monitor.py +387 -0
  14. runbooks/common/profile_utils.py +216 -0
  15. runbooks/common/rich_utils.py +171 -0
  16. runbooks/feedback/user_feedback_collector.py +440 -0
  17. runbooks/finops/README.md +339 -451
  18. runbooks/finops/__init__.py +4 -21
  19. runbooks/finops/account_resolver.py +279 -0
  20. runbooks/finops/accuracy_cross_validator.py +638 -0
  21. runbooks/finops/aws_client.py +721 -36
  22. runbooks/finops/budget_integration.py +313 -0
  23. runbooks/finops/cli.py +59 -5
  24. runbooks/finops/cost_processor.py +211 -37
  25. runbooks/finops/dashboard_router.py +900 -0
  26. runbooks/finops/dashboard_runner.py +990 -232
  27. runbooks/finops/embedded_mcp_validator.py +288 -0
  28. runbooks/finops/enhanced_dashboard_runner.py +8 -7
  29. runbooks/finops/enhanced_progress.py +327 -0
  30. runbooks/finops/enhanced_trend_visualization.py +423 -0
  31. runbooks/finops/finops_dashboard.py +29 -1880
  32. runbooks/finops/helpers.py +509 -196
  33. runbooks/finops/iam_guidance.py +400 -0
  34. runbooks/finops/markdown_exporter.py +466 -0
  35. runbooks/finops/multi_dashboard.py +1502 -0
  36. runbooks/finops/optimizer.py +15 -15
  37. runbooks/finops/profile_processor.py +2 -2
  38. runbooks/finops/runbooks.inventory.organizations_discovery.log +0 -0
  39. runbooks/finops/runbooks.security.report_generator.log +0 -0
  40. runbooks/finops/runbooks.security.run_script.log +0 -0
  41. runbooks/finops/runbooks.security.security_export.log +0 -0
  42. runbooks/finops/service_mapping.py +195 -0
  43. runbooks/finops/single_dashboard.py +710 -0
  44. runbooks/finops/tests/test_reference_images_validation.py +1 -1
  45. runbooks/inventory/README.md +12 -1
  46. runbooks/inventory/core/collector.py +157 -29
  47. runbooks/inventory/list_ec2_instances.py +9 -6
  48. runbooks/inventory/list_ssm_parameters.py +10 -10
  49. runbooks/inventory/organizations_discovery.py +210 -164
  50. runbooks/inventory/rich_inventory_display.py +74 -107
  51. runbooks/inventory/run_on_multi_accounts.py +13 -13
  52. runbooks/main.py +740 -134
  53. runbooks/metrics/dora_metrics_engine.py +711 -17
  54. runbooks/monitoring/performance_monitor.py +433 -0
  55. runbooks/operate/README.md +394 -0
  56. runbooks/operate/base.py +215 -47
  57. runbooks/operate/ec2_operations.py +7 -5
  58. runbooks/operate/privatelink_operations.py +1 -1
  59. runbooks/operate/vpc_endpoints.py +1 -1
  60. runbooks/remediation/README.md +489 -13
  61. runbooks/remediation/commons.py +8 -4
  62. runbooks/security/ENTERPRISE_SECURITY_FRAMEWORK.md +506 -0
  63. runbooks/security/README.md +12 -1
  64. runbooks/security/__init__.py +164 -33
  65. runbooks/security/compliance_automation.py +12 -10
  66. runbooks/security/compliance_automation_engine.py +1021 -0
  67. runbooks/security/enterprise_security_framework.py +931 -0
  68. runbooks/security/enterprise_security_policies.json +293 -0
  69. runbooks/security/integration_test_enterprise_security.py +879 -0
  70. runbooks/security/module_security_integrator.py +641 -0
  71. runbooks/security/report_generator.py +1 -1
  72. runbooks/security/run_script.py +4 -8
  73. runbooks/security/security_baseline_tester.py +36 -49
  74. runbooks/security/security_export.py +99 -120
  75. runbooks/sre/README.md +472 -0
  76. runbooks/sre/__init__.py +33 -0
  77. runbooks/sre/mcp_reliability_engine.py +1049 -0
  78. runbooks/sre/performance_optimization_engine.py +1032 -0
  79. runbooks/sre/reliability_monitoring_framework.py +1011 -0
  80. runbooks/validation/__init__.py +2 -2
  81. runbooks/validation/benchmark.py +154 -149
  82. runbooks/validation/cli.py +159 -147
  83. runbooks/validation/mcp_validator.py +265 -236
  84. runbooks/vpc/README.md +478 -0
  85. runbooks/vpc/__init__.py +2 -2
  86. runbooks/vpc/manager_interface.py +366 -351
  87. runbooks/vpc/networking_wrapper.py +62 -33
  88. runbooks/vpc/rich_formatters.py +22 -8
  89. {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/METADATA +136 -54
  90. {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/RECORD +94 -55
  91. {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/entry_points.txt +1 -1
  92. runbooks/finops/cross_validation.py +0 -375
  93. {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/WHEEL +0 -0
  94. {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/licenses/LICENSE +0 -0
  95. {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,394 @@
1
+ # AWS Resource Operations (CLI)
2
+
3
+ The AWS Resource Operations module is an enterprise-grade command-line tool for AWS resource lifecycle management. Built with the Rich library for beautiful terminal output, it provides safe, automated operations across EC2, S3, DynamoDB, and CloudFormation resources with comprehensive safety controls and professional reporting.
4
+
5
+ ## 📈 *operate-runbooks*.md Enterprise Rollout
6
+
7
+ Following proven **99/100 manager score** success patterns established in FinOps:
8
+
9
+ ### **Rollout Strategy**: Progressive *-runbooks*.md standardization
10
+ - **Phase 2**: Operate rollout with *operate-runbooks*.md framework ✅
11
+ - **Phase 3**: Security rollout with *security-runbooks*.md standards (Next)
12
+ - **Phase 4**: VPC rollout with *vpc-runbooks*.md patterns (Planned)
13
+
14
+ ## Why AWS Resource Operations?
15
+
16
+ Managing AWS resources safely across multiple accounts and environments requires enterprise-grade tooling with built-in safety controls. The AWS Resource Operations CLI aims to provide controlled, auditable resource management with comprehensive logging and rollback capabilities.
17
+
18
+ Key features include:
19
+ - **Unified Interface**: Consolidated resource operations from EC2 to CloudFormation
20
+ - **Safety First**: Default dry-run mode with explicit approval gates
21
+ - **Rich Console Output**: Beautiful terminal UI with progress indicators and status displays
22
+ - **Multi-Account Support**: Cross-account operations with role-based authentication
23
+ - **Comprehensive Logging**: Full audit trails and operation history
24
+
25
+ ## Table of Contents
26
+
27
+ - [Features](#features)
28
+ - [Prerequisites](#prerequisites)
29
+ - [Installation](#installation)
30
+ - [AWS CLI Profile Setup](#aws-cli-profile-setup)
31
+ - [Command Line Usage](#command-line-usage)
32
+ - [Options](#command-line-options)
33
+ - [Examples](#examples)
34
+ - [Resource Operations](#resource-operations)
35
+ - [EC2 Instance Management](#ec2-instance-management)
36
+ - [S3 Bucket Operations](#s3-bucket-operations)
37
+ - [DynamoDB Management](#dynamodb-management)
38
+ - [CloudFormation Operations](#cloudformation-operations)
39
+ - [Safety Controls](#safety-controls)
40
+ - [Export Formats](#export-formats)
41
+ - [Contributing](#contributing)
42
+ - [License](#license)
43
+
44
+ ---
45
+
46
+ ## Features
47
+
48
+ - **EC2 Instance Operations**:
49
+ - Start, stop, reboot instances with safety checks
50
+ - Batch operations with progress tracking
51
+ - Instance state validation and reporting
52
+ - **S3 Bucket Management**:
53
+ - Bucket lifecycle operations with confirmation prompts
54
+ - Object-level operations with versioning support
55
+ - Public access validation and remediation
56
+ - **DynamoDB Operations**:
57
+ - Table management with backup validation
58
+ - Point-in-time recovery operations
59
+ - Capacity scaling with safety limits
60
+ - **CloudFormation Management**:
61
+ - Stack deployments with rollback capabilities
62
+ - Template validation and drift detection
63
+ - Cross-account stack operations
64
+ - **Safety Controls**:
65
+ - Default dry-run mode for all destructive operations
66
+ - Explicit approval gates for production environments
67
+ - Comprehensive audit logging with rollback capabilities
68
+ - Multi-factor authentication support for critical operations
69
+ - **Profile Management**:
70
+ - Automatic profile detection
71
+ - Cross-account role assumption
72
+ - AWS SSO integration
73
+ - Multi-profile batch operations
74
+ - **Rich Terminal UI**: Styled with the Rich library for professional experience
75
+ - **Export Options**:
76
+ - JSON export for automation integration
77
+ - CSV export for reporting and analysis
78
+ - HTML reports for stakeholder communication
79
+
80
+ ---
81
+
82
+ ## Prerequisites
83
+
84
+ - **Python 3.8 or later**: Ensure you have the required Python version installed
85
+ - **AWS CLI configured with named profiles**: Set up your AWS CLI profiles for seamless integration
86
+ - **AWS credentials with permissions**:
87
+ - `ec2:*` (for EC2 operations)
88
+ - `s3:*` (for S3 operations)
89
+ - `dynamodb:*` (for DynamoDB operations)
90
+ - `cloudformation:*` (for CloudFormation operations)
91
+ - `sts:AssumeRole` (for cross-account operations)
92
+ - `sts:GetCallerIdentity` (for identity validation)
93
+
94
+ ---
95
+
96
+ ## Installation
97
+
98
+ There are several ways to install the AWS Resource Operations CLI:
99
+
100
+ ### Option 1: Using uv (Fast Python Package Installer)
101
+ [uv](https://github.com/astral-sh/uv) is a modern Python package installer and resolver that's extremely fast.
102
+
103
+ ```bash
104
+ # Install runbooks with resource operations
105
+ uv pip install runbooks
106
+ ```
107
+
108
+ ### Option 2: Using pip
109
+ ```bash
110
+ # Install runbooks package
111
+ pip install runbooks
112
+ ```
113
+
114
+ ---
115
+
116
+ ## AWS CLI Profile Setup
117
+
118
+ If you haven't already, configure your named profiles using the AWS CLI:
119
+
120
+ ```bash
121
+ aws configure --profile production-ops
122
+ aws configure --profile development-ops
123
+ aws configure --profile staging-ops
124
+ # ... etc ...
125
+ ```
126
+
127
+ For multi-account operations, ensure you have appropriate cross-account roles configured.
128
+
129
+ ---
130
+
131
+ ## Command Line Usage
132
+
133
+ Run resource operations using `runbooks operate` followed by options:
134
+
135
+ ```bash
136
+ runbooks operate [resource-type] [operation] [options]
137
+ ```
138
+
139
+ ### Command Line Options
140
+
141
+ | Flag | Description |
142
+ |---|---|
143
+ | `--profile`, `-p` | AWS profile to use for operations |
144
+ | `--region`, `-r` | AWS region to target (default: us-east-1) |
145
+ | `--dry-run` | Execute in dry-run mode (default: enabled) |
146
+ | `--force` | Disable dry-run mode for actual execution |
147
+ | `--batch-size` | Number of resources to process in parallel |
148
+ | `--timeout` | Operation timeout in seconds |
149
+ | `--output-format` | Output format: table, json, csv |
150
+ | `--log-level` | Logging level: INFO, DEBUG, WARNING, ERROR |
151
+
152
+ ### Examples
153
+
154
+ ```bash
155
+ # EC2 Instance Operations
156
+ runbooks operate ec2 start --instance-ids i-1234567890abcdef0 --profile production
157
+ runbooks operate ec2 stop --instance-ids i-1234567890abcdef0 --dry-run
158
+ runbooks operate ec2 reboot --instance-ids i-1234567890abcdef0 --force
159
+
160
+ # S3 Bucket Operations
161
+ runbooks operate s3 create --bucket-name my-new-bucket --profile development
162
+ runbooks operate s3 delete --bucket-name old-bucket --force --profile development
163
+
164
+ # DynamoDB Operations
165
+ runbooks operate dynamodb backup --table-name users --profile production
166
+ runbooks operate dynamodb restore --table-name users --backup-arn arn:aws:dynamodb:... --profile production
167
+
168
+ # CloudFormation Operations
169
+ runbooks operate cloudformation deploy --stack-name web-app --template-file template.yaml --profile production
170
+ runbooks operate cloudformation delete --stack-name old-stack --force --profile development
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Resource Operations
176
+
177
+ ### EC2 Instance Management
178
+
179
+ **Start Instances**:
180
+ ```bash
181
+ # Start single instance
182
+ runbooks operate ec2 start --instance-ids i-1234567890abcdef0 --profile production
183
+
184
+ # Start multiple instances
185
+ runbooks operate ec2 start --instance-ids i-123,i-456,i-789 --profile production --batch-size 3
186
+
187
+ # Dry-run mode (default)
188
+ runbooks operate ec2 start --instance-ids i-1234567890abcdef0 --dry-run
189
+ ```
190
+
191
+ **Stop Instances**:
192
+ ```bash
193
+ # Stop single instance with confirmation
194
+ runbooks operate ec2 stop --instance-ids i-1234567890abcdef0 --profile production
195
+
196
+ # Force stop without confirmation
197
+ runbooks operate ec2 stop --instance-ids i-1234567890abcdef0 --force --profile production
198
+ ```
199
+
200
+ **Instance Status Monitoring**:
201
+ ```bash
202
+ # Monitor instance status changes
203
+ runbooks operate ec2 status --instance-ids i-1234567890abcdef0 --profile production --watch
204
+ ```
205
+
206
+ ### S3 Bucket Operations
207
+
208
+ **Create Bucket**:
209
+ ```bash
210
+ # Create bucket with versioning
211
+ runbooks operate s3 create --bucket-name my-app-storage --enable-versioning --profile production
212
+
213
+ # Create bucket with encryption
214
+ runbooks operate s3 create --bucket-name secure-storage --enable-encryption --kms-key-id arn:aws:kms:... --profile production
215
+ ```
216
+
217
+ **Delete Bucket**:
218
+ ```bash
219
+ # Delete empty bucket
220
+ runbooks operate s3 delete --bucket-name old-bucket --profile development --dry-run
221
+
222
+ # Force delete bucket with contents (dangerous)
223
+ runbooks operate s3 delete --bucket-name old-bucket --delete-contents --force --profile development
224
+ ```
225
+
226
+ ### DynamoDB Management
227
+
228
+ **Backup Operations**:
229
+ ```bash
230
+ # Create on-demand backup
231
+ runbooks operate dynamodb backup --table-name users --backup-name users-backup-$(date +%Y%m%d) --profile production
232
+
233
+ # List available backups
234
+ runbooks operate dynamodb list-backups --table-name users --profile production
235
+ ```
236
+
237
+ **Restore Operations**:
238
+ ```bash
239
+ # Restore from backup
240
+ runbooks operate dynamodb restore --source-backup-arn arn:aws:dynamodb:... --target-table-name users-restored --profile production
241
+ ```
242
+
243
+ ### CloudFormation Operations
244
+
245
+ **Deploy Stack**:
246
+ ```bash
247
+ # Deploy new stack
248
+ runbooks operate cloudformation deploy --stack-name web-app --template-file infrastructure.yaml --profile production
249
+
250
+ # Deploy with parameters
251
+ runbooks operate cloudformation deploy --stack-name web-app --template-file infrastructure.yaml --parameters EnvironmentName=prod --profile production
252
+
253
+ # Deploy with changeset preview
254
+ runbooks operate cloudformation deploy --stack-name web-app --template-file infrastructure.yaml --create-changeset --profile production
255
+ ```
256
+
257
+ **Delete Stack**:
258
+ ```bash
259
+ # Delete stack with confirmation
260
+ runbooks operate cloudformation delete --stack-name old-stack --profile development
261
+
262
+ # Force delete with retain policy
263
+ runbooks operate cloudformation delete --stack-name old-stack --retain-resources --force --profile development
264
+ ```
265
+
266
+ ---
267
+
268
+ ## Safety Controls
269
+
270
+ ### Default Dry-Run Mode
271
+ All destructive operations default to dry-run mode:
272
+
273
+ ```bash
274
+ # This will NOT actually delete the bucket (dry-run default)
275
+ runbooks operate s3 delete --bucket-name test-bucket --profile development
276
+
277
+ # This will actually delete the bucket (force required)
278
+ runbooks operate s3 delete --bucket-name test-bucket --force --profile development
279
+ ```
280
+
281
+ ### Approval Gates
282
+ Critical operations require explicit confirmation:
283
+
284
+ ```bash
285
+ # Production operations require approval
286
+ runbooks operate ec2 stop --instance-ids i-prod-server --profile production
287
+ > WARNING: This will stop production instance i-prod-server
288
+ > Type 'YES' to confirm: YES
289
+ ```
290
+
291
+ ### Audit Logging
292
+ All operations are logged for compliance:
293
+
294
+ ```json
295
+ {
296
+ "timestamp": "2024-01-15T10:30:00Z",
297
+ "operation": "ec2:stop",
298
+ "resource": "i-1234567890abcdef0",
299
+ "profile": "production",
300
+ "user": "john.doe@company.com",
301
+ "status": "success",
302
+ "dry_run": false
303
+ }
304
+ ```
305
+
306
+ ---
307
+
308
+ ## Export Formats
309
+
310
+ ### JSON Output Format
311
+
312
+ ```bash
313
+ runbooks operate ec2 status --instance-ids i-123 --output-format json --profile production
314
+ ```
315
+
316
+ ```json
317
+ {
318
+ "operation": "ec2:status",
319
+ "timestamp": "2024-01-15T10:30:00Z",
320
+ "resources": [
321
+ {
322
+ "instance_id": "i-1234567890abcdef0",
323
+ "state": "running",
324
+ "instance_type": "t3.medium",
325
+ "availability_zone": "us-east-1a"
326
+ }
327
+ ]
328
+ }
329
+ ```
330
+
331
+ ### CSV Output Format
332
+
333
+ ```bash
334
+ runbooks operate ec2 list --output-format csv --profile production > instances.csv
335
+ ```
336
+
337
+ ### HTML Report Format
338
+
339
+ ```bash
340
+ runbooks operate cloudformation status --stack-name web-app --output-format html --profile production > stack_report.html
341
+ ```
342
+
343
+ ---
344
+
345
+ ## 💰 Operations Cost Awareness
346
+
347
+ ### Cost-Conscious Operations
348
+ The operations module includes cost awareness features:
349
+
350
+ - **Instance Type Recommendations**: Suggests cost-optimal instance types during resize operations
351
+ - **Resource Cleanup**: Identifies unused resources during inventory operations
352
+ - **Cost Impact Warnings**: Shows estimated cost impact before starting expensive operations
353
+
354
+ ### Cost Monitoring Integration
355
+ ```bash
356
+ # Operations with cost monitoring
357
+ runbooks operate ec2 start --instance-ids i-123 --show-cost-impact --profile production
358
+ ```
359
+
360
+ ---
361
+
362
+ ## Contributing
363
+
364
+ We welcome contributions! Please see our [Contributing Guidelines](../../../CONTRIBUTING.md) for details.
365
+
366
+ ### Development Setup
367
+ ```bash
368
+ git clone https://github.com/1xOps/CloudOps-Runbooks.git
369
+ cd CloudOps-Runbooks
370
+ uv sync --all-extras
371
+ uv run python -m runbooks operate --help
372
+ ```
373
+
374
+ ### Running Tests
375
+ ```bash
376
+ uv run pytest tests/operate/ -v
377
+ ```
378
+
379
+ ---
380
+
381
+ ## License
382
+
383
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](../../../LICENSE) file for details.
384
+
385
+ ---
386
+
387
+ ## Enterprise Support
388
+
389
+ For enterprise support, professional services, and custom integrations:
390
+ - **Email**: [info@oceansoft.io](mailto:info@oceansoft.io)
391
+ - **GitHub**: [CloudOps Runbooks Issues](https://github.com/1xOps/CloudOps-Runbooks/issues)
392
+ - **Documentation**: [Enterprise Documentation](https://docs.cloudops-runbooks.io)
393
+
394
+ Let's build reliable, safe AWS operations together. 🚀