runbooks 0.7.0__py3-none-any.whl → 0.7.6__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 (132) hide show
  1. runbooks/__init__.py +87 -37
  2. runbooks/cfat/README.md +300 -49
  3. runbooks/cfat/__init__.py +2 -2
  4. runbooks/finops/__init__.py +1 -1
  5. runbooks/finops/cli.py +1 -1
  6. runbooks/inventory/collectors/__init__.py +8 -0
  7. runbooks/inventory/collectors/aws_management.py +791 -0
  8. runbooks/inventory/collectors/aws_networking.py +3 -3
  9. runbooks/main.py +3389 -782
  10. runbooks/operate/__init__.py +207 -0
  11. runbooks/operate/base.py +311 -0
  12. runbooks/operate/cloudformation_operations.py +619 -0
  13. runbooks/operate/cloudwatch_operations.py +496 -0
  14. runbooks/operate/dynamodb_operations.py +812 -0
  15. runbooks/operate/ec2_operations.py +926 -0
  16. runbooks/operate/iam_operations.py +569 -0
  17. runbooks/operate/s3_operations.py +1211 -0
  18. runbooks/operate/tagging_operations.py +655 -0
  19. runbooks/remediation/CLAUDE.md +100 -0
  20. runbooks/remediation/DOME9.md +218 -0
  21. runbooks/remediation/README.md +26 -0
  22. runbooks/remediation/Tests/__init__.py +0 -0
  23. runbooks/remediation/Tests/update_policy.py +74 -0
  24. runbooks/remediation/__init__.py +95 -0
  25. runbooks/remediation/acm_cert_expired_unused.py +98 -0
  26. runbooks/remediation/acm_remediation.py +875 -0
  27. runbooks/remediation/api_gateway_list.py +167 -0
  28. runbooks/remediation/base.py +643 -0
  29. runbooks/remediation/cloudtrail_remediation.py +908 -0
  30. runbooks/remediation/cloudtrail_s3_modifications.py +296 -0
  31. runbooks/remediation/cognito_active_users.py +78 -0
  32. runbooks/remediation/cognito_remediation.py +856 -0
  33. runbooks/remediation/cognito_user_password_reset.py +163 -0
  34. runbooks/remediation/commons.py +455 -0
  35. runbooks/remediation/dynamodb_optimize.py +155 -0
  36. runbooks/remediation/dynamodb_remediation.py +744 -0
  37. runbooks/remediation/dynamodb_server_side_encryption.py +108 -0
  38. runbooks/remediation/ec2_public_ips.py +134 -0
  39. runbooks/remediation/ec2_remediation.py +892 -0
  40. runbooks/remediation/ec2_subnet_disable_auto_ip_assignment.py +72 -0
  41. runbooks/remediation/ec2_unattached_ebs_volumes.py +448 -0
  42. runbooks/remediation/ec2_unused_security_groups.py +202 -0
  43. runbooks/remediation/kms_enable_key_rotation.py +651 -0
  44. runbooks/remediation/kms_remediation.py +717 -0
  45. runbooks/remediation/lambda_list.py +243 -0
  46. runbooks/remediation/lambda_remediation.py +971 -0
  47. runbooks/remediation/multi_account.py +569 -0
  48. runbooks/remediation/rds_instance_list.py +199 -0
  49. runbooks/remediation/rds_remediation.py +873 -0
  50. runbooks/remediation/rds_snapshot_list.py +192 -0
  51. runbooks/remediation/requirements.txt +118 -0
  52. runbooks/remediation/s3_block_public_access.py +159 -0
  53. runbooks/remediation/s3_bucket_public_access.py +143 -0
  54. runbooks/remediation/s3_disable_static_website_hosting.py +74 -0
  55. runbooks/remediation/s3_downloader.py +215 -0
  56. runbooks/remediation/s3_enable_access_logging.py +562 -0
  57. runbooks/remediation/s3_encryption.py +526 -0
  58. runbooks/remediation/s3_force_ssl_secure_policy.py +143 -0
  59. runbooks/remediation/s3_list.py +141 -0
  60. runbooks/remediation/s3_object_search.py +201 -0
  61. runbooks/remediation/s3_remediation.py +816 -0
  62. runbooks/remediation/scan_for_phrase.py +425 -0
  63. runbooks/remediation/workspaces_list.py +220 -0
  64. runbooks/security/__init__.py +9 -10
  65. runbooks/security/security_baseline_tester.py +4 -2
  66. runbooks-0.7.6.dist-info/METADATA +608 -0
  67. {runbooks-0.7.0.dist-info → runbooks-0.7.6.dist-info}/RECORD +84 -76
  68. {runbooks-0.7.0.dist-info → runbooks-0.7.6.dist-info}/entry_points.txt +0 -1
  69. {runbooks-0.7.0.dist-info → runbooks-0.7.6.dist-info}/top_level.txt +0 -1
  70. jupyter-agent/.env +0 -2
  71. jupyter-agent/.env.template +0 -2
  72. jupyter-agent/.gitattributes +0 -35
  73. jupyter-agent/.gradio/certificate.pem +0 -31
  74. jupyter-agent/README.md +0 -16
  75. jupyter-agent/__main__.log +0 -8
  76. jupyter-agent/app.py +0 -256
  77. jupyter-agent/cloudops-agent.png +0 -0
  78. jupyter-agent/ds-system-prompt.txt +0 -154
  79. jupyter-agent/jupyter-agent.png +0 -0
  80. jupyter-agent/llama3_template.jinja +0 -123
  81. jupyter-agent/requirements.txt +0 -9
  82. jupyter-agent/tmp/4ojbs8a02ir/jupyter-agent.ipynb +0 -68
  83. jupyter-agent/tmp/cm5iasgpm3p/jupyter-agent.ipynb +0 -91
  84. jupyter-agent/tmp/crqbsseag5/jupyter-agent.ipynb +0 -91
  85. jupyter-agent/tmp/hohanq1u097/jupyter-agent.ipynb +0 -57
  86. jupyter-agent/tmp/jns1sam29wm/jupyter-agent.ipynb +0 -53
  87. jupyter-agent/tmp/jupyter-agent.ipynb +0 -27
  88. jupyter-agent/utils.py +0 -409
  89. runbooks/aws/__init__.py +0 -58
  90. runbooks/aws/dynamodb_operations.py +0 -231
  91. runbooks/aws/ec2_copy_image_cross-region.py +0 -195
  92. runbooks/aws/ec2_describe_instances.py +0 -202
  93. runbooks/aws/ec2_ebs_snapshots_delete.py +0 -186
  94. runbooks/aws/ec2_run_instances.py +0 -213
  95. runbooks/aws/ec2_start_stop_instances.py +0 -212
  96. runbooks/aws/ec2_terminate_instances.py +0 -143
  97. runbooks/aws/ec2_unused_eips.py +0 -196
  98. runbooks/aws/ec2_unused_volumes.py +0 -188
  99. runbooks/aws/s3_create_bucket.py +0 -142
  100. runbooks/aws/s3_list_buckets.py +0 -152
  101. runbooks/aws/s3_list_objects.py +0 -156
  102. runbooks/aws/s3_object_operations.py +0 -183
  103. runbooks/aws/tagging_lambda_handler.py +0 -183
  104. runbooks/inventory/FAILED_SCRIPTS_TROUBLESHOOTING.md +0 -619
  105. runbooks/inventory/PASSED_SCRIPTS_GUIDE.md +0 -738
  106. runbooks/inventory/aws_organization.png +0 -0
  107. runbooks/inventory/cfn_move_stack_instances.py +0 -1526
  108. runbooks/inventory/delete_s3_buckets_objects.py +0 -169
  109. runbooks/inventory/lockdown_cfn_stackset_role.py +0 -224
  110. runbooks/inventory/update_aws_actions.py +0 -173
  111. runbooks/inventory/update_cfn_stacksets.py +0 -1215
  112. runbooks/inventory/update_cloudwatch_logs_retention_policy.py +0 -294
  113. runbooks/inventory/update_iam_roles_cross_accounts.py +0 -478
  114. runbooks/inventory/update_s3_public_access_block.py +0 -539
  115. runbooks/organizations/__init__.py +0 -12
  116. runbooks/organizations/manager.py +0 -374
  117. runbooks-0.7.0.dist-info/METADATA +0 -375
  118. /runbooks/inventory/{tests → Tests}/common_test_data.py +0 -0
  119. /runbooks/inventory/{tests → Tests}/common_test_functions.py +0 -0
  120. /runbooks/inventory/{tests → Tests}/script_test_data.py +0 -0
  121. /runbooks/inventory/{tests → Tests}/setup.py +0 -0
  122. /runbooks/inventory/{tests → Tests}/src.py +0 -0
  123. /runbooks/inventory/{tests/test_inventory_modules.py → Tests/test_Inventory_Modules.py} +0 -0
  124. /runbooks/inventory/{tests → Tests}/test_cfn_describe_stacks.py +0 -0
  125. /runbooks/inventory/{tests → Tests}/test_ec2_describe_instances.py +0 -0
  126. /runbooks/inventory/{tests → Tests}/test_lambda_list_functions.py +0 -0
  127. /runbooks/inventory/{tests → Tests}/test_moto_integration_example.py +0 -0
  128. /runbooks/inventory/{tests → Tests}/test_org_list_accounts.py +0 -0
  129. /runbooks/inventory/{Inventory_Modules.py → inventory_modules.py} +0 -0
  130. /runbooks/{aws → operate}/tags.json +0 -0
  131. {runbooks-0.7.0.dist-info → runbooks-0.7.6.dist-info}/WHEEL +0 -0
  132. {runbooks-0.7.0.dist-info → runbooks-0.7.6.dist-info}/licenses/LICENSE +0 -0
@@ -1,738 +0,0 @@
1
- # AWS Cloud Foundations Inventory - PASSED Scripts Usage Guide
2
-
3
- > Deprecated: This guide has been consolidated into the main README. Please use the "Passed Scripts Usage Guide" section in `README.md` instead: [./README.md#passed-scripts-usage-guide](./README.md#passed-scripts-usage-guide). This file will be removed in a future release.
4
-
5
- ## 🎉 **SUCCESS STATUS: 37/46 scripts PASSING (80.4% success rate)**
6
-
7
- This guide provides comprehensive usage examples and parameter documentation for all **37 PASSED scripts** in the AWS Cloud Foundations inventory toolkit.
8
-
9
- ---
10
-
11
- ## **Core Infrastructure Scripts**
12
-
13
- ### 📋 **Initialization & Framework**
14
-
15
- #### `__init__.py` ✅
16
- **Purpose**: Python package initialization
17
- **Usage**: Automatically imported when using the inventory package
18
- **Parameters**: None
19
- **Example**:
20
- ```python
21
- from runbooks.inventory import *
22
- ```
23
-
24
- ---
25
-
26
- ## **🏗️ EC2 & Compute Services**
27
-
28
- ### `list_ec2_instances.py` ✅
29
- **Purpose**: Comprehensive EC2 instance discovery across accounts and regions
30
- **AWS APIs**: `ec2.describe_instances()`
31
-
32
- **Usage Examples**:
33
- ```bash
34
- # List all instances across all accounts and regions
35
- python list_ec2_instances.py --profile ams-admin-ReadOnlyAccess-909135376185
36
-
37
- # List instances in specific regions
38
- python list_ec2_instances.py --profile my-profile --regions us-east-1,us-west-2
39
-
40
- # Filter by account fragment
41
- python list_ec2_instances.py --profile my-profile --accounts prod
42
-
43
- # Export to file
44
- python list_ec2_instances.py --profile my-profile --filename ec2_inventory.json
45
-
46
- # Verbose output with timing
47
- python list_ec2_instances.py --profile my-profile --verbose --timing
48
- ```
49
-
50
- **Key Parameters**:
51
- - `--profile`: AWS profile for authentication
52
- - `--regions`: Comma-separated list of regions or 'all'
53
- - `--accounts`: Account ID or fragment filter
54
- - `--filename`: Export results to JSON file
55
- - `--verbose`: Detailed logging
56
- - `--timing`: Performance metrics
57
-
58
- ### `list_ec2_ebs_volumes.py` ✅
59
- **Purpose**: EBS volume inventory with orphaned volume detection
60
- **AWS APIs**: `ec2.describe_volumes()`
61
-
62
- **Usage Examples**:
63
- ```bash
64
- # List all EBS volumes
65
- python list_ec2_ebs_volumes.py --profile my-profile
66
-
67
- # Find orphaned volumes (not attached to instances)
68
- python list_ec2_ebs_volumes.py --profile my-profile --verbose
69
-
70
- # Cost optimization analysis
71
- python list_ec2_ebs_volumes.py --profile my-profile --filename volumes_cost_analysis.json
72
- ```
73
-
74
- ### `list_ec2_availability_zones.py` ✅
75
- **Purpose**: Availability Zone mapping and regional capacity analysis
76
- **AWS APIs**: `ec2.describe_availability_zones()`
77
-
78
- **Usage Examples**:
79
- ```bash
80
- # Map all availability zones
81
- python list_ec2_availability_zones.py --profile my-profile
82
-
83
- # Regional capacity analysis
84
- python list_ec2_availability_zones.py --profile my-profile --regions all --verbose
85
- ```
86
-
87
- ### `list_ecs_clusters_and_tasks.py` ✅
88
- **Purpose**: ECS cluster and task inventory for container workload management
89
- **AWS APIs**: `ecs.list_clusters()`, `ecs.list_tasks()`
90
-
91
- **Usage Examples**:
92
- ```bash
93
- # List all ECS clusters and tasks
94
- python list_ecs_clusters_and_tasks.py --profile my-profile
95
-
96
- # Container workload analysis
97
- python list_ecs_clusters_and_tasks.py --profile my-profile --verbose --timing
98
- ```
99
-
100
- ### `all_my_instances_wrapper.py` ✅
101
- **Purpose**: Legacy-compatible EC2 instance listing wrapper
102
- **Dependencies**: `list_ec2_instances.py`
103
-
104
- **Usage Examples**:
105
- ```bash
106
- # Legacy interface compatibility
107
- python all_my_instances_wrapper.py --account-id 123456789012 --profile my-profile
108
-
109
- # Regional filtering
110
- python all_my_instances_wrapper.py --account-id 123456789012 --region us-east-1 --profile my-profile
111
-
112
- # JSON output format
113
- python all_my_instances_wrapper.py --account-id 123456789012 --format json --profile my-profile
114
- ```
115
-
116
- ---
117
-
118
- ## **🌐 Networking & VPC**
119
-
120
- ### `list_vpcs.py` ✅
121
- **Purpose**: VPC discovery with default VPC identification and network architecture analysis
122
- **AWS APIs**: `ec2.describe_vpcs()`
123
-
124
- **Usage Examples**:
125
- ```bash
126
- # List all VPCs
127
- python list_vpcs.py --profile my-profile
128
-
129
- # Network architecture analysis
130
- python list_vpcs.py --profile my-profile --verbose
131
-
132
- # Export network topology
133
- python list_vpcs.py --profile my-profile --filename network_topology.json
134
- ```
135
-
136
- ### `list_vpc_subnets.py` ✅
137
- **Purpose**: Subnet inventory with CIDR block analysis and IP address tracking
138
- **AWS APIs**: `ec2.describe_subnets()`
139
-
140
- **Usage Examples**:
141
- ```bash
142
- # List all subnets
143
- python list_vpc_subnets.py --profile my-profile
144
-
145
- # CIDR analysis with IP address tracking
146
- python list_vpc_subnets.py --profile my-profile --verbose
147
- ```
148
-
149
- ### `find_vpc_flow_logs.py` ✅
150
- **Purpose**: VPC Flow Logs configuration analysis and compliance reporting
151
- **AWS APIs**: `ec2.describe_flow_logs()`, `logs.describe_log_groups()`
152
-
153
- **Usage Examples**:
154
- ```bash
155
- # Check VPC Flow Logs compliance
156
- python find_vpc_flow_logs.py --profile my-profile
157
-
158
- # Compliance reporting
159
- python find_vpc_flow_logs.py --profile my-profile --verbose --filename flow_logs_compliance.json
160
- ```
161
-
162
- ### `list_enis_network_interfaces.py` ✅
163
- **Purpose**: Elastic Network Interface inventory for IP address tracking
164
- **AWS APIs**: `ec2.describe_network_interfaces()`
165
-
166
- **Usage Examples**:
167
- ```bash
168
- # List all ENIs
169
- python list_enis_network_interfaces.py --profile my-profile
170
-
171
- # Network troubleshooting
172
- python list_enis_network_interfaces.py --profile my-profile --verbose
173
- ```
174
-
175
- ### `list_elbs_load_balancers.py` ✅
176
- **Purpose**: Classic and Application Load Balancer discovery
177
- **AWS APIs**: `elbv2.describe_load_balancers()`, `elb.describe_load_balancers()`
178
-
179
- **Usage Examples**:
180
- ```bash
181
- # List all load balancers
182
- python list_elbs_load_balancers.py --profile my-profile
183
-
184
- # Load balancer analysis
185
- python list_elbs_load_balancers.py --profile my-profile --verbose
186
- ```
187
-
188
- ---
189
-
190
- ## **🔐 Identity & Access Management**
191
-
192
- ### `list_iam_roles.py` ✅
193
- **Purpose**: Cross-account IAM role discovery for access management
194
- **AWS APIs**: `iam.list_roles()`
195
-
196
- **Usage Examples**:
197
- ```bash
198
- # List all IAM roles
199
- python list_iam_roles.py --profile my-profile
200
-
201
- # Cross-account role analysis
202
- python list_iam_roles.py --profile my-profile --verbose --filename iam_roles_audit.json
203
-
204
- # Filter by role name fragment
205
- python list_iam_roles.py --profile my-profile --fragments Admin
206
- ```
207
-
208
- ### `list_iam_saml_providers.py` ✅
209
- **Purpose**: SAML identity provider inventory with cleanup capabilities
210
- **AWS APIs**: `iam.list_saml_providers()`, `iam.delete_saml_provider()`
211
-
212
- **Usage Examples**:
213
- ```bash
214
- # List SAML providers
215
- python list_iam_saml_providers.py --profile my-profile
216
-
217
- # SAML provider cleanup (with confirmation)
218
- python list_iam_saml_providers.py --profile my-profile +delete
219
- ```
220
-
221
- ---
222
-
223
- ## **🏗️ CloudFormation Management**
224
-
225
- ### `list_cfn_stacks.py` ✅
226
- **Purpose**: Comprehensive CloudFormation stack discovery with fragment-based searching
227
- **AWS APIs**: `cloudformation.describe_stacks()`, `cloudformation.list_stacks()`
228
-
229
- **Usage Examples**:
230
- ```bash
231
- # List all CloudFormation stacks
232
- python list_cfn_stacks.py --profile my-profile
233
-
234
- # Search by stack name fragment
235
- python list_cfn_stacks.py --profile my-profile --fragments "web-"
236
-
237
- # Exact stack name match
238
- python list_cfn_stacks.py --profile my-profile --fragments "web-app-prod" --exact
239
-
240
- # Export stack inventory
241
- python list_cfn_stacks.py --profile my-profile --filename cfn_stacks.json
242
- ```
243
-
244
- ### `list_cfn_stacksets.py` ✅
245
- **Purpose**: CloudFormation StackSet inventory and analysis
246
- **AWS APIs**: `cloudformation.list_stack_sets()`, `cloudformation.describe_stack_set()`
247
-
248
- **Usage Examples**:
249
- ```bash
250
- # List all StackSets
251
- python list_cfn_stacksets.py --profile my-profile
252
-
253
- # StackSet deployment analysis
254
- python list_cfn_stacksets.py --profile my-profile --verbose
255
- ```
256
-
257
- ### `list_cfn_stackset_operations.py` ✅
258
- **Purpose**: Track CloudFormation StackSet operations and status
259
- **AWS APIs**: `cloudformation.list_stack_set_operations()`, `cloudformation.describe_stack_set_operation()`
260
-
261
- **Usage Examples**:
262
- ```bash
263
- # List StackSet operations
264
- python list_cfn_stackset_operations.py --profile my-profile
265
-
266
- # Operation tracking and diagnostics
267
- python list_cfn_stackset_operations.py --profile my-profile --verbose --timing
268
- ```
269
-
270
- ### `list_cfn_stackset_operation_results.py` ✅
271
- **Purpose**: Detailed analysis of CloudFormation StackSet operation results
272
- **AWS APIs**: `cloudformation.list_stack_set_operation_results()`
273
-
274
- **Usage Examples**:
275
- ```bash
276
- # Analyze operation results from files
277
- python list_cfn_stackset_operation_results.py --stacksets_filename stacksets.txt --org_filename orgs.txt
278
-
279
- # Basic analysis without input files (testing mode)
280
- python list_cfn_stackset_operation_results.py --profile my-profile
281
- ```
282
-
283
- ### `find_cfn_stackset_drift.py` ✅
284
- **Purpose**: Detect drift in CloudFormation StackSets
285
- **AWS APIs**: `cloudformation.describe_stack_sets()`, `cloudformation.detect_stack_set_drift()`
286
-
287
- **Usage Examples**:
288
- ```bash
289
- # Detect StackSet drift
290
- python find_cfn_stackset_drift.py --profile my-profile
291
-
292
- # Automated drift detection
293
- python find_cfn_stackset_drift.py --profile my-profile --verbose --timing
294
- ```
295
-
296
- ### `find_cfn_orphaned_stacks.py` ✅
297
- **Purpose**: Identify orphaned CloudFormation stacks
298
- **AWS APIs**: `cloudformation.describe_stacks()`, `cloudformation.list_stack_sets()`
299
-
300
- **Usage Examples**:
301
- ```bash
302
- # Find orphaned stacks
303
- python find_cfn_orphaned_stacks.py --profile my-profile
304
-
305
- # Comprehensive orphan analysis
306
- python find_cfn_orphaned_stacks.py --profile my-profile --verbose --filename orphaned_stacks.json
307
- ```
308
-
309
- ### `find_cfn_drift_detection.py` ✅
310
- **Purpose**: Detect and report configuration drift in CloudFormation stacks
311
- **AWS APIs**: `cloudformation.detect_stack_drift()`, `cloudformation.describe_stack_drift_detection_status()`
312
-
313
- **Usage Examples**:
314
- ```bash
315
- # Detect stack drift (automated mode)
316
- python find_cfn_drift_detection.py --profile my-profile
317
-
318
- # Stack fragment filtering
319
- python find_cfn_drift_detection.py --profile my-profile --stackfrag "web-"
320
-
321
- # Interactive mode for organizational scope
322
- python find_cfn_drift_detection.py --profile my-profile
323
- ```
324
-
325
- ### `update_cfn_stacksets.py` ✅
326
- **Purpose**: CloudFormation StackSet update automation
327
- **AWS APIs**: `cloudformation.update_stack_set()`, `cloudformation.create_stack_instances()`
328
-
329
- **Usage Examples**:
330
- ```bash
331
- # Update StackSets
332
- python update_cfn_stacksets.py --profile my-profile
333
-
334
- # Automated StackSet management
335
- python update_cfn_stacksets.py --profile my-profile --verbose
336
- ```
337
-
338
- ### `recover_cfn_stack_ids.py` ✅
339
- **Purpose**: CloudFormation stack ID recovery for disaster recovery
340
- **AWS APIs**: `cloudformation.describe_stacks()`
341
-
342
- **Usage Examples**:
343
- ```bash
344
- # Recover stack IDs
345
- python recover_cfn_stack_ids.py --profile my-profile
346
-
347
- # Stack recovery with fragment filtering
348
- python recover_cfn_stack_ids.py --profile my-profile --regions us-east-1 --fragments "web-"
349
- ```
350
-
351
- ---
352
-
353
- ## **🏢 AWS Organizations & Governance**
354
-
355
- ### `list_org_accounts.py` ✅
356
- **Purpose**: Comprehensive AWS Organizations account inventory
357
- **AWS APIs**: `organizations.list_accounts()`, `organizations.describe_organization()`
358
-
359
- **Usage Examples**:
360
- ```bash
361
- # List all organization accounts
362
- python list_org_accounts.py --profile my-profile
363
-
364
- # Account governance analysis
365
- python list_org_accounts.py --profile my-profile --verbose --filename org_accounts.json
366
- ```
367
-
368
- ### `list_org_accounts_users.py` ✅
369
- **Purpose**: Cross-account IAM user inventory for governance
370
- **AWS APIs**: `organizations.list_accounts()`, `iam.list_users()`
371
-
372
- **Usage Examples**:
373
- ```bash
374
- # Cross-account user inventory
375
- python list_org_accounts_users.py --profile my-profile
376
-
377
- # Governance and compliance reporting
378
- python list_org_accounts_users.py --profile my-profile --verbose --filename user_audit.json
379
- ```
380
-
381
- ### `draw_org_structure.py` ✅
382
- **Purpose**: Generate GraphViz visualization of AWS Organizations structure
383
- **AWS APIs**: `organizations.describe_organization()`, `organizations.list_organizational_units()`
384
-
385
- **Usage Examples**:
386
- ```bash
387
- # Generate organization chart
388
- python draw_org_structure.py --profile my-profile
389
-
390
- # Visual organization analysis
391
- python draw_org_structure.py --profile my-profile --verbose
392
- ```
393
-
394
- ### `find_landingzone_versions.py` ✅
395
- **Purpose**: Discovery and version analysis of AWS Landing Zone deployments
396
- **AWS APIs**: `organizations.describe_account()`, `cloudformation.describe_stacks()`
397
-
398
- **Usage Examples**:
399
- ```bash
400
- # Find Landing Zone versions
401
- python find_landingzone_versions.py --profile my-profile
402
-
403
- # Version analysis across accounts
404
- python find_landingzone_versions.py --profile my-profile --verbose
405
- ```
406
-
407
- ### `check_landingzone_readiness.py` ✅
408
- **Purpose**: Evaluate accounts for AWS Landing Zone adoption prerequisites
409
- **AWS APIs**: `organizations.describe_account()`, `ec2.describe_vpcs()`
410
-
411
- **Usage Examples**:
412
- ```bash
413
- # Check Landing Zone readiness
414
- python check_landingzone_readiness.py --profile my-profile
415
-
416
- # Account readiness assessment
417
- python check_landingzone_readiness.py --profile my-profile --ChildAccountId 123456789012
418
- ```
419
-
420
- ---
421
-
422
- ## **🔍 Security & Compliance**
423
-
424
- ### `check_cloudtrail_compliance.py` ✅
425
- **Purpose**: Assess CloudTrail compliance across accounts and regions
426
- **AWS APIs**: `cloudtrail.describe_trails()`, `cloudtrail.get_trail_status()`
427
-
428
- **Usage Examples**:
429
- ```bash
430
- # CloudTrail compliance check
431
- python check_cloudtrail_compliance.py --profile my-profile
432
-
433
- # Comprehensive compliance assessment
434
- python check_cloudtrail_compliance.py --profile my-profile --verbose --filename cloudtrail_compliance.json
435
- ```
436
-
437
- ### `list_guardduty_detectors.py` ✅
438
- **Purpose**: GuardDuty detector inventory with cleanup capabilities
439
- **AWS APIs**: `guardduty.list_detectors()`, `guardduty.delete_detector()`
440
-
441
- **Usage Examples**:
442
- ```bash
443
- # List GuardDuty detectors
444
- python list_guardduty_detectors.py --profile my-profile
445
-
446
- # GuardDuty cleanup (with confirmation)
447
- python list_guardduty_detectors.py --profile my-profile +delete
448
- ```
449
-
450
- ### `verify_ec2_security_groups.py` ✅
451
- **Purpose**: Comprehensive security group verification and compliance
452
- **AWS APIs**: `ec2.describe_security_groups()`, `ec2.authorize_security_group_ingress()`
453
-
454
- **Usage Examples**:
455
- ```bash
456
- # Verify security groups
457
- python verify_ec2_security_groups.py --profile my-profile
458
-
459
- # Security compliance assessment
460
- python verify_ec2_security_groups.py --profile my-profile --verbose
461
- ```
462
-
463
- ---
464
-
465
- ## **🗄️ Database & Storage**
466
-
467
- ### `list_rds_db_instances.py` ✅
468
- **Purpose**: RDS database instance inventory with configuration analysis
469
- **AWS APIs**: `rds.describe_db_instances()`
470
-
471
- **Usage Examples**:
472
- ```bash
473
- # List all RDS instances
474
- python list_rds_db_instances.py --profile my-profile
475
-
476
- # Database configuration analysis
477
- python list_rds_db_instances.py --profile my-profile --verbose --filename rds_inventory.json
478
- ```
479
-
480
- ### `update_s3_public_access_block.py` ✅
481
- **Purpose**: S3 Public Access Block enforcement across organizations
482
- **AWS APIs**: `s3.put_public_access_block()`, `s3.get_public_access_block()`
483
-
484
- **Usage Examples**:
485
- ```bash
486
- # Update S3 public access blocks
487
- python update_s3_public_access_block.py --profile my-profile
488
-
489
- # Organization-wide S3 security enforcement
490
- python update_s3_public_access_block.py --profile my-profile --verbose
491
- ```
492
-
493
- ---
494
-
495
- ## **⚡ Serverless & Functions**
496
-
497
- ### `list_lambda_functions.py` ✅
498
- **Purpose**: Lambda function inventory with runtime version management
499
- **AWS APIs**: `lambda.list_functions()`, `lambda.update_function_configuration()`
500
-
501
- **Usage Examples**:
502
- ```bash
503
- # List all Lambda functions
504
- python list_lambda_functions.py --profile my-profile
505
-
506
- # Runtime version analysis
507
- python list_lambda_functions.py --profile my-profile --verbose --filename lambda_inventory.json
508
- ```
509
-
510
- ---
511
-
512
- ## **🌐 DNS & Networking Services**
513
-
514
- ### `list_route53_hosted_zones.py` ✅
515
- **Purpose**: Route53 hosted zone discovery for DNS management
516
- **AWS APIs**: `route53.list_hosted_zones()`
517
-
518
- **Usage Examples**:
519
- ```bash
520
- # List all hosted zones
521
- python list_route53_hosted_zones.py --profile my-profile
522
-
523
- # DNS management analysis
524
- python list_route53_hosted_zones.py --profile my-profile --verbose
525
- ```
526
-
527
- ---
528
-
529
- ## **🏗️ Service Catalog & Configuration**
530
-
531
- ### `list_servicecatalog_provisioned_products.py` ✅
532
- **Purpose**: Service Catalog provisioned product management
533
- **AWS APIs**: `servicecatalog.search_provisioned_products()`, `servicecatalog.terminate_provisioned_product()`
534
-
535
- **Usage Examples**:
536
- ```bash
537
- # List provisioned products
538
- python list_servicecatalog_provisioned_products.py --profile my-profile
539
-
540
- # Product lifecycle management
541
- python list_servicecatalog_provisioned_products.py --profile my-profile --verbose
542
- ```
543
-
544
- ### `list_config_recorders_delivery_channels.py` ✅
545
- **Purpose**: Config Recorder and Delivery Channel inventory
546
- **AWS APIs**: `config.describe_configuration_recorders()`, `config.describe_delivery_channels()`
547
-
548
- **Usage Examples**:
549
- ```bash
550
- # List Config recorders and delivery channels
551
- python list_config_recorders_delivery_channels.py --profile my-profile
552
-
553
- # Configuration compliance assessment
554
- python list_config_recorders_delivery_channels.py --profile my-profile --verbose
555
- ```
556
-
557
- ---
558
-
559
- ## **📂 Directory Services**
560
-
561
- ### `list_ds_directories.py` ✅
562
- **Purpose**: Directory Service inventory for identity management
563
- **AWS APIs**: `ds.describe_directories()`
564
-
565
- **Usage Examples**:
566
- ```bash
567
- # List directory services
568
- python list_ds_directories.py --profile my-profile
569
-
570
- # Identity management cleanup
571
- python list_ds_directories.py --profile my-profile --verbose
572
- ```
573
-
574
- ---
575
-
576
- ## **📨 Messaging Services**
577
-
578
- ### `list_sns_topics.py` ✅
579
- **Purpose**: SNS topic inventory across accounts and regions
580
- **AWS APIs**: `sns.list_topics()`
581
-
582
- **Usage Examples**:
583
- ```bash
584
- # List all SNS topics
585
- python list_sns_topics.py --profile my-profile
586
-
587
- # Messaging service analysis
588
- python list_sns_topics.py --profile my-profile --verbose --filename sns_topics.json
589
- ```
590
-
591
- ---
592
-
593
- ## **📊 Monitoring & Logging**
594
-
595
- ### `update_cloudwatch_logs_retention_policy.py` ✅
596
- **Purpose**: CloudWatch Logs retention policy management
597
- **AWS APIs**: `logs.describe_log_groups()`, `logs.put_retention_policy()`
598
-
599
- **Usage Examples**:
600
- ```bash
601
- # Update log retention policies
602
- python update_cloudwatch_logs_retention_policy.py --profile my-profile
603
-
604
- # Cost optimization through retention management
605
- python update_cloudwatch_logs_retention_policy.py --profile my-profile --verbose
606
- ```
607
-
608
- ---
609
-
610
- ## **🔧 Common Parameters Across All Scripts**
611
-
612
- ### **Authentication Parameters**
613
- - `--profile`: AWS profile name for authentication
614
- - `--profiles`: Multiple profiles for cross-account operations
615
-
616
- ### **Regional Parameters**
617
- - `--regions` / `--region`: Target AWS regions ('all' for all regions)
618
- - `--regions-fragment`: Region fragment matching (e.g., 'us-east')
619
-
620
- ### **Filtering Parameters**
621
- - `--fragments` / `--fragment`: Resource name fragment filtering
622
- - `--accounts`: Account ID or fragment filtering
623
- - `--exact`: Exact string matching (no fragments)
624
-
625
- ### **Output Parameters**
626
- - `--filename`: Export results to file (JSON format)
627
- - `--verbose` / `-v`: Detailed logging output
628
- - `--timing`: Performance timing information
629
-
630
- ### **Safety Parameters**
631
- - `--skipprofile`: Profiles to exclude from operations
632
- - `--skipaccount`: Accounts to exclude from operations
633
- - `+delete`: Enable destructive operations (requires confirmation)
634
-
635
- ---
636
-
637
- ## **🚀 Best Practices for Usage**
638
-
639
- ### **1. Authentication Setup**
640
- ```bash
641
- # Configure AWS SSO
642
- aws configure sso --profile ams-admin-ReadOnlyAccess-909135376185
643
-
644
- # Verify credentials
645
- aws sts get-caller-identity --profile ams-admin-ReadOnlyAccess-909135376185
646
- ```
647
-
648
- ### **2. Regional Operations**
649
- ```bash
650
- # All regions
651
- --regions all
652
-
653
- # Specific regions
654
- --regions us-east-1,us-west-2,eu-west-1
655
-
656
- # Regional fragments
657
- --regions us-
658
- ```
659
-
660
- ### **3. Cross-Account Operations**
661
- ```bash
662
- # All organization accounts
663
- --profile management-account-profile
664
-
665
- # Specific account filtering
666
- --accounts prod
667
-
668
- # Skip specific accounts
669
- --skipaccount 123456789012,987654321098
670
- ```
671
-
672
- ### **4. Output and Reporting**
673
- ```bash
674
- # Export to file
675
- --filename inventory_$(date +%Y%m%d).json
676
-
677
- # Verbose logging with timing
678
- --verbose --timing
679
-
680
- # Structured output
681
- python script.py --profile my-profile --filename results.json --verbose
682
- ```
683
-
684
- ### **5. Performance Optimization**
685
- ```bash
686
- # Regional targeting
687
- --regions us-east-1
688
-
689
- # Account filtering
690
- --accounts prod
691
-
692
- # Fragment-based filtering
693
- --fragments web-
694
- ```
695
-
696
- ---
697
-
698
- ## **📋 Quick Reference Commands**
699
-
700
- ### **Infrastructure Inventory**
701
- ```bash
702
- # Complete EC2 inventory
703
- python list_ec2_instances.py --profile my-profile --regions all --filename ec2_complete.json
704
-
705
- # Network topology
706
- python list_vpcs.py --profile my-profile --verbose --filename network_topology.json
707
-
708
- # Security assessment
709
- python check_cloudtrail_compliance.py --profile my-profile --filename security_compliance.json
710
- ```
711
-
712
- ### **Governance & Compliance**
713
- ```bash
714
- # Organization overview
715
- python list_org_accounts.py --profile my-profile --filename org_structure.json
716
-
717
- # IAM audit
718
- python list_iam_roles.py --profile my-profile --verbose --filename iam_audit.json
719
-
720
- # CloudFormation inventory
721
- python list_cfn_stacks.py --profile my-profile --regions all --filename cfn_inventory.json
722
- ```
723
-
724
- ### **Cost Optimization**
725
- ```bash
726
- # EBS volume analysis
727
- python list_ec2_ebs_volumes.py --profile my-profile --filename volume_cost_analysis.json
728
-
729
- # Lambda function optimization
730
- python list_lambda_functions.py --profile my-profile --filename lambda_optimization.json
731
-
732
- # Log retention optimization
733
- python update_cloudwatch_logs_retention_policy.py --profile my-profile --verbose
734
- ```
735
-
736
- ---
737
-
738
- **Total PASSED Scripts: 37/46 (80.4% success rate) ✅**