runbooks 0.2.5__py3-none-any.whl → 0.7.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 (249) hide show
  1. conftest.py +26 -0
  2. jupyter-agent/.env +2 -0
  3. jupyter-agent/.env.template +2 -0
  4. jupyter-agent/.gitattributes +35 -0
  5. jupyter-agent/.gradio/certificate.pem +31 -0
  6. jupyter-agent/README.md +16 -0
  7. jupyter-agent/__main__.log +8 -0
  8. jupyter-agent/app.py +256 -0
  9. jupyter-agent/cloudops-agent.png +0 -0
  10. jupyter-agent/ds-system-prompt.txt +154 -0
  11. jupyter-agent/jupyter-agent.png +0 -0
  12. jupyter-agent/llama3_template.jinja +123 -0
  13. jupyter-agent/requirements.txt +9 -0
  14. jupyter-agent/tmp/4ojbs8a02ir/jupyter-agent.ipynb +68 -0
  15. jupyter-agent/tmp/cm5iasgpm3p/jupyter-agent.ipynb +91 -0
  16. jupyter-agent/tmp/crqbsseag5/jupyter-agent.ipynb +91 -0
  17. jupyter-agent/tmp/hohanq1u097/jupyter-agent.ipynb +57 -0
  18. jupyter-agent/tmp/jns1sam29wm/jupyter-agent.ipynb +53 -0
  19. jupyter-agent/tmp/jupyter-agent.ipynb +27 -0
  20. jupyter-agent/utils.py +409 -0
  21. runbooks/__init__.py +71 -3
  22. runbooks/__main__.py +13 -0
  23. runbooks/aws/ec2_describe_instances.py +1 -1
  24. runbooks/aws/ec2_run_instances.py +8 -2
  25. runbooks/aws/ec2_start_stop_instances.py +17 -4
  26. runbooks/aws/ec2_unused_volumes.py +5 -1
  27. runbooks/aws/s3_create_bucket.py +4 -2
  28. runbooks/aws/s3_list_objects.py +6 -1
  29. runbooks/aws/tagging_lambda_handler.py +13 -2
  30. runbooks/aws/tags.json +12 -0
  31. runbooks/base.py +353 -0
  32. runbooks/cfat/README.md +49 -0
  33. runbooks/cfat/__init__.py +74 -0
  34. runbooks/cfat/app.ts +644 -0
  35. runbooks/cfat/assessment/__init__.py +40 -0
  36. runbooks/cfat/assessment/asana-import.csv +39 -0
  37. runbooks/cfat/assessment/cfat-checks.csv +31 -0
  38. runbooks/cfat/assessment/cfat.txt +520 -0
  39. runbooks/cfat/assessment/collectors.py +200 -0
  40. runbooks/cfat/assessment/jira-import.csv +39 -0
  41. runbooks/cfat/assessment/runner.py +387 -0
  42. runbooks/cfat/assessment/validators.py +290 -0
  43. runbooks/cfat/cli.py +103 -0
  44. runbooks/cfat/docs/asana-import.csv +24 -0
  45. runbooks/cfat/docs/cfat-checks.csv +31 -0
  46. runbooks/cfat/docs/cfat.txt +335 -0
  47. runbooks/cfat/docs/checks-output.png +0 -0
  48. runbooks/cfat/docs/cloudshell-console-run.png +0 -0
  49. runbooks/cfat/docs/cloudshell-download.png +0 -0
  50. runbooks/cfat/docs/cloudshell-output.png +0 -0
  51. runbooks/cfat/docs/downloadfile.png +0 -0
  52. runbooks/cfat/docs/jira-import.csv +24 -0
  53. runbooks/cfat/docs/open-cloudshell.png +0 -0
  54. runbooks/cfat/docs/report-header.png +0 -0
  55. runbooks/cfat/models.py +1026 -0
  56. runbooks/cfat/package-lock.json +5116 -0
  57. runbooks/cfat/package.json +38 -0
  58. runbooks/cfat/report.py +496 -0
  59. runbooks/cfat/reporting/__init__.py +46 -0
  60. runbooks/cfat/reporting/exporters.py +337 -0
  61. runbooks/cfat/reporting/formatters.py +496 -0
  62. runbooks/cfat/reporting/templates.py +135 -0
  63. runbooks/cfat/run-assessment.sh +23 -0
  64. runbooks/cfat/runner.py +69 -0
  65. runbooks/cfat/src/actions/check-cloudtrail-existence.ts +43 -0
  66. runbooks/cfat/src/actions/check-config-existence.ts +37 -0
  67. runbooks/cfat/src/actions/check-control-tower.ts +37 -0
  68. runbooks/cfat/src/actions/check-ec2-existence.ts +46 -0
  69. runbooks/cfat/src/actions/check-iam-users.ts +50 -0
  70. runbooks/cfat/src/actions/check-legacy-cur.ts +30 -0
  71. runbooks/cfat/src/actions/check-org-cloudformation.ts +30 -0
  72. runbooks/cfat/src/actions/check-vpc-existence.ts +43 -0
  73. runbooks/cfat/src/actions/create-asanaimport.ts +14 -0
  74. runbooks/cfat/src/actions/create-backlog.ts +372 -0
  75. runbooks/cfat/src/actions/create-jiraimport.ts +15 -0
  76. runbooks/cfat/src/actions/create-report.ts +616 -0
  77. runbooks/cfat/src/actions/define-account-type.ts +51 -0
  78. runbooks/cfat/src/actions/get-enabled-org-policy-types.ts +40 -0
  79. runbooks/cfat/src/actions/get-enabled-org-services.ts +26 -0
  80. runbooks/cfat/src/actions/get-idc-info.ts +34 -0
  81. runbooks/cfat/src/actions/get-org-da-accounts.ts +34 -0
  82. runbooks/cfat/src/actions/get-org-details.ts +35 -0
  83. runbooks/cfat/src/actions/get-org-member-accounts.ts +44 -0
  84. runbooks/cfat/src/actions/get-org-ous.ts +35 -0
  85. runbooks/cfat/src/actions/get-regions.ts +22 -0
  86. runbooks/cfat/src/actions/zip-assessment.ts +27 -0
  87. runbooks/cfat/src/types/index.d.ts +147 -0
  88. runbooks/cfat/tests/__init__.py +141 -0
  89. runbooks/cfat/tests/test_cli.py +340 -0
  90. runbooks/cfat/tests/test_integration.py +290 -0
  91. runbooks/cfat/tests/test_models.py +505 -0
  92. runbooks/cfat/tests/test_reporting.py +354 -0
  93. runbooks/cfat/tsconfig.json +16 -0
  94. runbooks/cfat/webpack.config.cjs +27 -0
  95. runbooks/config.py +260 -0
  96. runbooks/finops/README.md +337 -0
  97. runbooks/finops/__init__.py +86 -0
  98. runbooks/finops/aws_client.py +245 -0
  99. runbooks/finops/cli.py +151 -0
  100. runbooks/finops/cost_processor.py +410 -0
  101. runbooks/finops/dashboard_runner.py +448 -0
  102. runbooks/finops/helpers.py +355 -0
  103. runbooks/finops/main.py +14 -0
  104. runbooks/finops/profile_processor.py +174 -0
  105. runbooks/finops/types.py +66 -0
  106. runbooks/finops/visualisations.py +80 -0
  107. runbooks/inventory/.gitignore +354 -0
  108. runbooks/inventory/ArgumentsClass.py +261 -0
  109. runbooks/inventory/FAILED_SCRIPTS_TROUBLESHOOTING.md +619 -0
  110. runbooks/inventory/Inventory_Modules.py +6130 -0
  111. runbooks/inventory/LandingZone/delete_lz.py +1075 -0
  112. runbooks/inventory/PASSED_SCRIPTS_GUIDE.md +738 -0
  113. runbooks/inventory/README.md +1320 -0
  114. runbooks/inventory/__init__.py +62 -0
  115. runbooks/inventory/account_class.py +532 -0
  116. runbooks/inventory/all_my_instances_wrapper.py +123 -0
  117. runbooks/inventory/aws_decorators.py +201 -0
  118. runbooks/inventory/aws_organization.png +0 -0
  119. runbooks/inventory/cfn_move_stack_instances.py +1526 -0
  120. runbooks/inventory/check_cloudtrail_compliance.py +614 -0
  121. runbooks/inventory/check_controltower_readiness.py +1107 -0
  122. runbooks/inventory/check_landingzone_readiness.py +711 -0
  123. runbooks/inventory/cloudtrail.md +727 -0
  124. runbooks/inventory/collectors/__init__.py +20 -0
  125. runbooks/inventory/collectors/aws_compute.py +518 -0
  126. runbooks/inventory/collectors/aws_networking.py +275 -0
  127. runbooks/inventory/collectors/base.py +222 -0
  128. runbooks/inventory/core/__init__.py +19 -0
  129. runbooks/inventory/core/collector.py +303 -0
  130. runbooks/inventory/core/formatter.py +296 -0
  131. runbooks/inventory/delete_s3_buckets_objects.py +169 -0
  132. runbooks/inventory/discovery.md +81 -0
  133. runbooks/inventory/draw_org_structure.py +748 -0
  134. runbooks/inventory/ec2_vpc_utils.py +341 -0
  135. runbooks/inventory/find_cfn_drift_detection.py +272 -0
  136. runbooks/inventory/find_cfn_orphaned_stacks.py +719 -0
  137. runbooks/inventory/find_cfn_stackset_drift.py +733 -0
  138. runbooks/inventory/find_ec2_security_groups.py +669 -0
  139. runbooks/inventory/find_landingzone_versions.py +201 -0
  140. runbooks/inventory/find_vpc_flow_logs.py +1221 -0
  141. runbooks/inventory/inventory.sh +659 -0
  142. runbooks/inventory/list_cfn_stacks.py +558 -0
  143. runbooks/inventory/list_cfn_stackset_operation_results.py +252 -0
  144. runbooks/inventory/list_cfn_stackset_operations.py +734 -0
  145. runbooks/inventory/list_cfn_stacksets.py +453 -0
  146. runbooks/inventory/list_config_recorders_delivery_channels.py +681 -0
  147. runbooks/inventory/list_ds_directories.py +354 -0
  148. runbooks/inventory/list_ec2_availability_zones.py +286 -0
  149. runbooks/inventory/list_ec2_ebs_volumes.py +244 -0
  150. runbooks/inventory/list_ec2_instances.py +425 -0
  151. runbooks/inventory/list_ecs_clusters_and_tasks.py +562 -0
  152. runbooks/inventory/list_elbs_load_balancers.py +411 -0
  153. runbooks/inventory/list_enis_network_interfaces.py +526 -0
  154. runbooks/inventory/list_guardduty_detectors.py +568 -0
  155. runbooks/inventory/list_iam_policies.py +404 -0
  156. runbooks/inventory/list_iam_roles.py +518 -0
  157. runbooks/inventory/list_iam_saml_providers.py +359 -0
  158. runbooks/inventory/list_lambda_functions.py +882 -0
  159. runbooks/inventory/list_org_accounts.py +446 -0
  160. runbooks/inventory/list_org_accounts_users.py +354 -0
  161. runbooks/inventory/list_rds_db_instances.py +406 -0
  162. runbooks/inventory/list_route53_hosted_zones.py +318 -0
  163. runbooks/inventory/list_servicecatalog_provisioned_products.py +575 -0
  164. runbooks/inventory/list_sns_topics.py +360 -0
  165. runbooks/inventory/list_ssm_parameters.py +402 -0
  166. runbooks/inventory/list_vpc_subnets.py +433 -0
  167. runbooks/inventory/list_vpcs.py +422 -0
  168. runbooks/inventory/lockdown_cfn_stackset_role.py +224 -0
  169. runbooks/inventory/models/__init__.py +24 -0
  170. runbooks/inventory/models/account.py +192 -0
  171. runbooks/inventory/models/inventory.py +309 -0
  172. runbooks/inventory/models/resource.py +247 -0
  173. runbooks/inventory/recover_cfn_stack_ids.py +205 -0
  174. runbooks/inventory/requirements.txt +12 -0
  175. runbooks/inventory/run_on_multi_accounts.py +211 -0
  176. runbooks/inventory/tests/common_test_data.py +3661 -0
  177. runbooks/inventory/tests/common_test_functions.py +204 -0
  178. runbooks/inventory/tests/setup.py +24 -0
  179. runbooks/inventory/tests/src.py +18 -0
  180. runbooks/inventory/tests/test_cfn_describe_stacks.py +208 -0
  181. runbooks/inventory/tests/test_ec2_describe_instances.py +162 -0
  182. runbooks/inventory/tests/test_inventory_modules.py +55 -0
  183. runbooks/inventory/tests/test_lambda_list_functions.py +86 -0
  184. runbooks/inventory/tests/test_moto_integration_example.py +273 -0
  185. runbooks/inventory/tests/test_org_list_accounts.py +49 -0
  186. runbooks/inventory/update_aws_actions.py +173 -0
  187. runbooks/inventory/update_cfn_stacksets.py +1215 -0
  188. runbooks/inventory/update_cloudwatch_logs_retention_policy.py +294 -0
  189. runbooks/inventory/update_iam_roles_cross_accounts.py +478 -0
  190. runbooks/inventory/update_s3_public_access_block.py +539 -0
  191. runbooks/inventory/utils/__init__.py +23 -0
  192. runbooks/inventory/utils/aws_helpers.py +510 -0
  193. runbooks/inventory/utils/threading_utils.py +493 -0
  194. runbooks/inventory/utils/validation.py +682 -0
  195. runbooks/inventory/verify_ec2_security_groups.py +1430 -0
  196. runbooks/main.py +1004 -0
  197. runbooks/organizations/__init__.py +12 -0
  198. runbooks/organizations/manager.py +374 -0
  199. runbooks/security/README.md +447 -0
  200. runbooks/security/__init__.py +71 -0
  201. runbooks/{security_baseline → security}/checklist/alternate_contacts.py +8 -1
  202. runbooks/{security_baseline → security}/checklist/bucket_public_access.py +4 -1
  203. runbooks/{security_baseline → security}/checklist/cloudwatch_alarm_configuration.py +9 -2
  204. runbooks/{security_baseline → security}/checklist/guardduty_enabled.py +9 -2
  205. runbooks/{security_baseline → security}/checklist/multi_region_instance_usage.py +5 -1
  206. runbooks/{security_baseline → security}/checklist/root_access_key.py +6 -1
  207. runbooks/{security_baseline → security}/config-origin.json +1 -1
  208. runbooks/{security_baseline → security}/config.json +1 -1
  209. runbooks/{security_baseline → security}/permission.json +1 -1
  210. runbooks/{security_baseline → security}/report_generator.py +10 -2
  211. runbooks/{security_baseline → security}/report_template_en.html +7 -7
  212. runbooks/{security_baseline → security}/report_template_jp.html +7 -7
  213. runbooks/{security_baseline → security}/report_template_kr.html +12 -12
  214. runbooks/{security_baseline → security}/report_template_vn.html +7 -7
  215. runbooks/{security_baseline → security}/run_script.py +8 -2
  216. runbooks/{security_baseline → security}/security_baseline_tester.py +12 -4
  217. runbooks/{security_baseline → security}/utils/common.py +5 -1
  218. runbooks/utils/__init__.py +204 -0
  219. runbooks-0.7.0.dist-info/METADATA +375 -0
  220. runbooks-0.7.0.dist-info/RECORD +249 -0
  221. {runbooks-0.2.5.dist-info → runbooks-0.7.0.dist-info}/WHEEL +1 -1
  222. runbooks-0.7.0.dist-info/entry_points.txt +7 -0
  223. runbooks-0.7.0.dist-info/licenses/LICENSE +201 -0
  224. runbooks-0.7.0.dist-info/top_level.txt +3 -0
  225. runbooks/python101/calculator.py +0 -34
  226. runbooks/python101/config.py +0 -1
  227. runbooks/python101/exceptions.py +0 -16
  228. runbooks/python101/file_manager.py +0 -218
  229. runbooks/python101/toolkit.py +0 -153
  230. runbooks-0.2.5.dist-info/METADATA +0 -439
  231. runbooks-0.2.5.dist-info/RECORD +0 -61
  232. runbooks-0.2.5.dist-info/entry_points.txt +0 -3
  233. runbooks-0.2.5.dist-info/top_level.txt +0 -1
  234. /runbooks/{security_baseline/__init__.py → inventory/tests/script_test_data.py} +0 -0
  235. /runbooks/{security_baseline → security}/checklist/__init__.py +0 -0
  236. /runbooks/{security_baseline → security}/checklist/account_level_bucket_public_access.py +0 -0
  237. /runbooks/{security_baseline → security}/checklist/direct_attached_policy.py +0 -0
  238. /runbooks/{security_baseline → security}/checklist/iam_password_policy.py +0 -0
  239. /runbooks/{security_baseline → security}/checklist/iam_user_mfa.py +0 -0
  240. /runbooks/{security_baseline → security}/checklist/multi_region_trail.py +0 -0
  241. /runbooks/{security_baseline → security}/checklist/root_mfa.py +0 -0
  242. /runbooks/{security_baseline → security}/checklist/root_usage.py +0 -0
  243. /runbooks/{security_baseline → security}/checklist/trail_enabled.py +0 -0
  244. /runbooks/{security_baseline → security}/checklist/trusted_advisor.py +0 -0
  245. /runbooks/{security_baseline → security}/utils/__init__.py +0 -0
  246. /runbooks/{security_baseline → security}/utils/enums.py +0 -0
  247. /runbooks/{security_baseline → security}/utils/language.py +0 -0
  248. /runbooks/{security_baseline → security}/utils/level_const.py +0 -0
  249. /runbooks/{security_baseline → security}/utils/permission_list.py +0 -0
@@ -0,0 +1,1320 @@
1
+ # AWS Cloud Foundations Inventory Scripts
2
+
3
+ ## ✅ **Current Success Rate (v0.6.1): 37/46 scripts (80.4%)**
4
+
5
+ Recent improvements implemented following FAANG agility and KISS/DRY principles:
6
+
7
+ ### **Critical Fixes**
8
+ - **SSO Credential Management**: Fixed region inconsistency in `Inventory_Modules.py:2323`
9
+ - **Queue Processing**: Fixed tuple unpacking in `find_ec2_security_groups.py:427`
10
+ - **Parameter Automation**: Added special cases for autonomous testing
11
+ - **Framework Optimization**: Excluded utility scripts, added timeout controls
12
+
13
+ **Result**: 37/46 scripts passing (80.4%) with reduced maintenance overhead.
14
+
15
+ ## Project Overview
16
+
17
+ This collection provides comprehensive AWS inventory and management scripts following boto3-aligned naming conventions. The scripts are organized by AWS service and functionality, designed for Cloud Foundations teams managing multi-account AWS environments.
18
+
19
+ **Architecture**: Multi-threaded, cross-account inventory collection with enterprise-grade error handling and reporting.
20
+
21
+ **Target Users**: Cloud Architects, DevOps Engineers, SRE Teams, AWS Organization Administrators.
22
+
23
+ >**Note:** Scripts support both profile-based and federated authentication models. Enhanced SSO credential handling implemented.
24
+
25
+ ## Common Parameters
26
+
27
+ > ***Note***: *The `verbose` and `debugging` options consistent across all the scripts to best effort.*
28
+
29
+ | Param | Description |
30
+ |-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
31
+ | -v | For those times when I decided to show less information on screen, to keep the output neat - you could use this level of logging to get what an interested user might want to see. |
32
+ | -vv | You could use this level of logging to get what a developer might want to see. |
33
+ | -vvv | This is generally the lowest level I would recommend anyone use. I started changing most scripts over from "-d" for INFO, to "-vvv" to align with standard practices. This is generally the lowest level I would recommend anyone use. |
34
+ | -d | I've updated the DEBUG to be the -d. Beware - this is a crazy amount of debugging, and it includes a lot of the open-source libraries that I use, since I don't disable all of that functionality within my scripts. |
35
+ | -h | Provide "-h" or "--help" on the command line and get a nicely formatted screen that describes all possible parameters. |
36
+ | -p | To specify the profile which the script will work with. In most cases, this could/ should be a Master Profile, but doesn't always have to be. Additionally - in many scripts, this parameter takes more than one possible profile AND ALSO allows you to specify a fragment of a profile, so it you have 3 profiles all with the same fragment, it will include all 3. |
37
+ | -r | To specify the single region for the script to work in. Most scripts take "all" as a valid parameter. Most scripts also assume "us-east-1" as a default if nothing is specified. |
38
+ | -rs | In many of the scripts, you can specify a fragment - so you can specify "us-east" and get both "us-east-1" and "us-east-2". Specify "us-" and you'll get all four "us-" regions. |
39
+ | -f | String fragment - some scripts (specifically ones dealing with CFN stacks and stacksets) take a parameter that allows you to specify a fragment of the stack name, so you can find that stack you can't quite remember the whole name of. |
40
+
41
+ ## Less used common parameters
42
+
43
+ | Param | Description |
44
+ | --- | --- |
45
+ | --exact | It's possible that some fragments will exist both as a stackname, as well as part of other stacknames (think "xxx" and "xxx-global"). In these cases, you can use the "--exact" parameter, and it will only use the string you've entered. *Note that this means you must enter the entire string, and not just a fragment anymore.* |
46
+ | --skipprofile | Sometimes you want to specify a fragment of a profile, and you want 5 of the 6 profiles that fragment shows up in, but not the 6th. You can use this parameter to exclude that 6th profile (space delimited). |
47
+ | --skipaccount | Sometimes you want to exclude the production accounts from any script you're running. You can use this parameter to exclude a list of accounts (space delimited). |
48
+ | --filename | This parameter (hasn't been added to all the scripts yet) is my attempt to produce output suitable for use in an Excel sheet, or other analysis tooling. Eventually I'll come up with the Analysis tooling myself, but until then - the least I could do is output this data in a suitable format. You'll have to run the help (-h) to find out for each script if it supports this parameter / output yet or not. |
49
+ | +delete | I've tried to make it difficult to **accidentally** delete any resources, so that's why it's a "+" instead of a "-". |
50
+
51
+ ## AWS Service-Organized Scripts
52
+
53
+ ### CloudFormation (CFN) Scripts
54
+
55
+ CloudFormation stack and StackSet management and analysis.
56
+
57
+ #### [cfn_move_stack_instances.py](./cfn_move_stack_instances.py)
58
+
59
+ **AWS API Mapping**: `cloudformation.describe_stack_sets()`, `cloudformation.create_stack_instances()`
60
+
61
+ Migrates CloudFormation stack instances between StackSets, commonly used for ALZ to Control Tower migrations.
62
+
63
+ #### [find_cfn_drift_detection.py](./find_cfn_drift_detection.py)
64
+
65
+ **AWS API Mapping**: `cloudformation.detect_stack_drift()`, `cloudformation.describe_stack_drift_detection_status()`
66
+
67
+ Detects and reports configuration drift in CloudFormation stacks across accounts and regions.
68
+
69
+ #### [find_cfn_orphaned_stacks.py](./find_cfn_orphaned_stacks.py)
70
+
71
+ **AWS API Mapping**: `cloudformation.describe_stacks()`, `cloudformation.list_stack_sets()`
72
+
73
+ Identifies CloudFormation stacks that exist in child accounts but are not visible from management account StackSets.
74
+
75
+ #### [find_cfn_stackset_drift.py](./find_cfn_stackset_drift.py)
76
+
77
+ **AWS API Mapping**: `cloudformation.describe_stack_sets()`, `cloudformation.detect_stack_set_drift()`
78
+
79
+ Detects drift in CloudFormation StackSets and provides drift detection automation.
80
+
81
+ #### [list_cfn_stacks.py](./list_cfn_stacks.py)
82
+
83
+ **AWS API Mapping**: `cloudformation.describe_stacks()`, `cloudformation.list_stacks()`
84
+
85
+ Comprehensive CloudFormation stack discovery across accounts and regions with fragment-based searching.
86
+
87
+ #### [list_cfn_stacksets.py](./list_cfn_stacksets.py)
88
+
89
+ **AWS API Mapping**: `cloudformation.list_stack_sets()`, `cloudformation.describe_stack_set()`
90
+
91
+ Inventory and analysis of CloudFormation StackSets across management accounts.
92
+
93
+ #### [list_cfn_stackset_operations.py](./list_cfn_stackset_operations.py)
94
+
95
+ **AWS API Mapping**: `cloudformation.list_stack_set_operations()`, `cloudformation.describe_stack_set_operation()`
96
+
97
+ Tracks CloudFormation StackSet operations and their status across deployments.
98
+
99
+ #### [list_cfn_stackset_operation_results.py](./list_cfn_stackset_operation_results.py)
100
+
101
+ **AWS API Mapping**: `cloudformation.list_stack_set_operation_results()`
102
+
103
+ Detailed analysis of CloudFormation StackSet operation results and failure diagnostics.
104
+
105
+ ### Organizations (ORG) Scripts
106
+
107
+ AWS Organizations structure analysis and account management.
108
+
109
+ #### [check_controltower_readiness.py](./check_controltower_readiness.py)
110
+
111
+ **AWS API Mapping**: `organizations.describe_account()`, `config.describe_configuration_recorders()`
112
+
113
+ Assesses account readiness for AWS Control Tower adoption and remediation.
114
+
115
+ #### [check_landingzone_readiness.py](./check_landingzone_readiness.py)
116
+
117
+ **AWS API Mapping**: `organizations.describe_account()`, `ec2.describe_vpcs()`
118
+
119
+ Evaluates accounts for AWS Landing Zone adoption prerequisites and automated remediation.
120
+
121
+ #### [draw_org_structure.py](./draw_org_structure.py)
122
+
123
+ **AWS API Mapping**: `organizations.describe_organization()`, `organizations.list_organizational_units()`
124
+
125
+ Generates GraphViz visualization of AWS Organizations structure with OUs, accounts, and policies.
126
+
127
+ #### [find_landingzone_versions.py](./find_landingzone_versions.py)
128
+
129
+ **AWS API Mapping**: `organizations.describe_account()`, `cloudformation.describe_stacks()`
130
+
131
+ Discovery and version analysis of AWS Landing Zone deployments across management accounts.
132
+
133
+ #### [list_org_accounts.py](./list_org_accounts.py)
134
+
135
+ **AWS API Mapping**: `organizations.list_accounts()`, `organizations.describe_organization()`
136
+
137
+ Comprehensive AWS Organizations account inventory with management account detection.
138
+
139
+ #### [list_org_accounts_users.py](./list_org_accounts_users.py)
140
+
141
+ **AWS API Mapping**: `organizations.list_accounts()`, `iam.list_users()`
142
+
143
+ Cross-account IAM user inventory for governance and compliance reporting.
144
+
145
+
146
+ ### EC2 and VPC Scripts
147
+
148
+ EC2 compute resources and VPC networking inventory.
149
+
150
+ #### [list_ec2_instances.py](./list_ec2_instances.py)
151
+
152
+ **AWS API Mapping**: `ec2.describe_instances()`
153
+
154
+ Comprehensive EC2 instance discovery across accounts and regions with detailed metadata.
155
+
156
+ #### [list_ec2_ebs_volumes.py](./list_ec2_ebs_volumes.py)
157
+
158
+ **AWS API Mapping**: `ec2.describe_volumes()`
159
+
160
+ EBS volume inventory with orphaned volume detection and cost optimization insights.
161
+
162
+ #### [list_ec2_availability_zones.py](./list_ec2_availability_zones.py)
163
+
164
+ **AWS API Mapping**: `ec2.describe_availability_zones()`
165
+
166
+ Availability Zone mapping and regional capacity analysis.
167
+
168
+ #### [list_vpcs.py](./list_vpcs.py)
169
+
170
+ **AWS API Mapping**: `ec2.describe_vpcs()`
171
+
172
+ VPC discovery with default VPC identification and network architecture analysis.
173
+
174
+ #### [list_vpc_subnets.py](./list_vpc_subnets.py)
175
+
176
+ **AWS API Mapping**: `ec2.describe_subnets()`
177
+
178
+ Subnet inventory with CIDR block analysis and IP address location capabilities.
179
+
180
+ #### [find_ec2_security_groups.py](./find_ec2_security_groups.py)
181
+
182
+ **AWS API Mapping**: `ec2.describe_security_groups()`
183
+
184
+ Security group analysis with rule evaluation and compliance assessment.
185
+
186
+ #### [find_vpc_flow_logs.py](./find_vpc_flow_logs.py)
187
+
188
+ **AWS API Mapping**: `ec2.describe_flow_logs()`, `logs.describe_log_groups()`
189
+
190
+ VPC Flow Logs configuration analysis and compliance reporting.
191
+
192
+ #### [list_enis_network_interfaces.py](./list_enis_network_interfaces.py)
193
+
194
+ **AWS API Mapping**: `ec2.describe_network_interfaces()`
195
+
196
+ Elastic Network Interface inventory for IP address tracking and network troubleshooting.
197
+
198
+ ### IAM Scripts
199
+
200
+ Identity and Access Management resource inventory.
201
+
202
+ #### [list_iam_roles.py](./list_iam_roles.py)
203
+
204
+ **AWS API Mapping**: `iam.list_roles()`
205
+
206
+ Cross-account IAM role discovery for access management and governance.
207
+
208
+ #### [list_iam_policies.py](./list_iam_policies.py)
209
+
210
+ **AWS API Mapping**: `iam.list_policies()`
211
+
212
+ Comprehensive IAM policy inventory across accounts and policy types.
213
+
214
+ #### [list_iam_saml_providers.py](./list_iam_saml_providers.py)
215
+
216
+ **AWS API Mapping**: `iam.list_saml_providers()`, `iam.delete_saml_provider()`
217
+
218
+ SAML identity provider inventory with optional cleanup capabilities.
219
+
220
+ #### [update_iam_roles_cross_accounts.py](./update_iam_roles_cross_accounts.py)
221
+
222
+ **AWS API Mapping**: `iam.create_role()`, `iam.attach_role_policy()`
223
+
224
+ Cross-account IAM role management for Control Tower migration scenarios.
225
+
226
+ ### CloudTrail and Compliance Scripts
227
+
228
+ CloudTrail logging and compliance assessment.
229
+
230
+ #### [check_cloudtrail_compliance.py](./check_cloudtrail_compliance.py)
231
+
232
+ **AWS API Mapping**: `cloudtrail.describe_trails()`, `cloudtrail.get_trail_status()`
233
+
234
+ Assesses CloudTrail compliance across accounts and regions, identifying gaps in logging coverage.
235
+
236
+ ### AWS Config Scripts
237
+
238
+ AWS Config service configuration and compliance.
239
+
240
+ #### [list_config_recorders_delivery_channels.py](./list_config_recorders_delivery_channels.py)
241
+
242
+ **AWS API Mapping**: `config.describe_configuration_recorders()`, `config.describe_delivery_channels()`
243
+
244
+ Config Recorder and Delivery Channel inventory for compliance and governance assessment.
245
+
246
+ ### Storage and Data Scripts
247
+
248
+ S3 and storage service management.
249
+
250
+ #### [delete_s3_buckets_objects.py](./delete_s3_buckets_objects.py)
251
+
252
+ **AWS API Mapping**: `s3.delete_objects()`, `s3.delete_bucket()`
253
+
254
+ S3 bucket and object deletion utility with safety checks and confirmation prompts.
255
+
256
+ #### [update_s3_public_access_block.py](./update_s3_public_access_block.py)
257
+
258
+ **AWS API Mapping**: `s3.put_public_access_block()`, `s3.get_public_access_block()`
259
+
260
+ S3 Public Access Block enforcement across organizations with dry-run capabilities and safety checks.
261
+
262
+ ### Lambda and Compute Scripts
263
+
264
+ Serverless and compute service inventory.
265
+
266
+ #### [list_lambda_functions.py](./list_lambda_functions.py)
267
+
268
+ **AWS API Mapping**: `lambda.list_functions()`, `lambda.update_function_configuration()`
269
+
270
+ Lambda function inventory with runtime version management and update capabilities.
271
+
272
+ #### [list_ecs_clusters_and_tasks.py](./list_ecs_clusters_and_tasks.py)
273
+
274
+ **AWS API Mapping**: `ecs.list_clusters()`, `ecs.list_tasks()`
275
+
276
+ ECS cluster and task inventory for container workload management.
277
+
278
+ ### Network and Load Balancing Scripts
279
+
280
+ Networking and load balancing service inventory.
281
+
282
+ #### [list_elbs_load_balancers.py](./list_elbs_load_balancers.py)
283
+
284
+ **AWS API Mapping**: `elbv2.describe_load_balancers()`, `elb.describe_load_balancers()`
285
+
286
+ Classic and Application Load Balancer discovery across accounts and regions.
287
+
288
+ ### Database Scripts
289
+
290
+ Database service inventory and management.
291
+
292
+ #### [list_rds_db_instances.py](./list_rds_db_instances.py)
293
+
294
+ **AWS API Mapping**: `rds.describe_db_instances()`
295
+
296
+ RDS database instance inventory with configuration analysis.
297
+
298
+ ### Security and Monitoring Scripts
299
+
300
+ Security and monitoring service inventory.
301
+
302
+ #### [list_guardduty_detectors.py](./list_guardduty_detectors.py)
303
+
304
+ **AWS API Mapping**: `guardduty.list_detectors()`, `guardduty.delete_detector()`
305
+
306
+ GuardDuty detector inventory with optional cleanup capabilities.
307
+
308
+ ### DNS and Networking Scripts
309
+
310
+ DNS and networking service management.
311
+
312
+ #### [list_route53_hosted_zones.py](./list_route53_hosted_zones.py)
313
+
314
+ **AWS API Mapping**: `route53.list_hosted_zones()`
315
+
316
+ Route53 hosted zone discovery for DNS management and cross-account functionality.
317
+
318
+ ### Directory Services Scripts
319
+
320
+ Directory and identity service management.
321
+
322
+ #### [list_ds_directories.py](./list_ds_directories.py)
323
+
324
+ **AWS API Mapping**: `ds.describe_directories()`
325
+
326
+ Directory Service inventory for identity management cleanup.
327
+
328
+ ### Messaging Scripts
329
+
330
+ Messaging service inventory.
331
+
332
+ #### [list_sns_topics.py](./list_sns_topics.py)
333
+
334
+ **AWS API Mapping**: `sns.list_topics()`
335
+
336
+ SNS topic inventory across accounts and regions.
337
+
338
+ ### Systems Manager Scripts
339
+
340
+ Systems Manager service inventory.
341
+
342
+ #### [list_ssm_parameters.py](./list_ssm_parameters.py)
343
+
344
+ **AWS API Mapping**: `ssm.describe_parameters()`, `ssm.delete_parameter()`
345
+
346
+ SSM Parameter Store inventory with ALZ cleanup capabilities.
347
+
348
+ ### CloudWatch Scripts
349
+
350
+ CloudWatch logging and monitoring management.
351
+
352
+ #### [update_cloudwatch_logs_retention_policy.py](./update_cloudwatch_logs_retention_policy.py)
353
+
354
+ **AWS API Mapping**: `logs.describe_log_groups()`, `logs.put_retention_policy()`
355
+
356
+ CloudWatch Logs retention policy management with cost optimization analysis.
357
+
358
+ ### Service Catalog Scripts
359
+
360
+ Service Catalog inventory and management.
361
+
362
+ #### [list_servicecatalog_provisioned_products.py](./list_servicecatalog_provisioned_products.py)
363
+
364
+ **AWS API Mapping**: `servicecatalog.search_provisioned_products()`, `servicecatalog.terminate_provisioned_product()`
365
+
366
+ Service Catalog provisioned product management with error state cleanup.
367
+
368
+ ### Multi-Account Management Scripts
369
+
370
+ Cross-account automation and management utilities.
371
+
372
+ #### [run_on_multi_accounts.py](./run_on_multi_accounts.py)
373
+
374
+ **AWS API Mapping**: Various (configurable)
375
+
376
+ Framework for executing commands across multiple AWS accounts with consistent error handling.
377
+
378
+ #### [verify_ec2_security_groups.py](./verify_ec2_security_groups.py)
379
+
380
+ **AWS API Mapping**: `ec2.describe_security_groups()`, `ec2.authorize_security_group_ingress()`
381
+
382
+ Comprehensive security group verification and compliance assessment.
383
+
384
+ #### [update_aws_actions.py](./update_aws_actions.py)
385
+
386
+ **AWS API Mapping**: Various (configurable)
387
+
388
+ General-purpose AWS action automation across accounts and regions.
389
+
390
+ #### [update_cfn_stacksets.py](./update_cfn_stacksets.py)
391
+
392
+ **AWS API Mapping**: `cloudformation.update_stack_set()`, `cloudformation.create_stack_instances()`
393
+
394
+ CloudFormation StackSet update automation with instance management.
395
+
396
+ #### [lockdown_cfn_stackset_role.py](./lockdown_cfn_stackset_role.py)
397
+
398
+ **AWS API Mapping**: `iam.put_role_policy()`, `iam.delete_role_policy()`
399
+
400
+ StackSet role policy management for ALZ and Control Tower scenarios.
401
+
402
+ #### [recover_cfn_stack_ids.py](./recover_cfn_stack_ids.py)
403
+
404
+ **AWS API Mapping**: `cloudformation.describe_stacks()`
405
+
406
+ CloudFormation stack ID recovery for disaster recovery scenarios.
407
+
408
+ ## Framework and Utility Components
409
+
410
+ ### Core Libraries
411
+
412
+ #### [Inventory_Modules.py](./Inventory_Modules.py)
413
+
414
+ Core utility functions and shared components for AWS inventory operations including credential management, multi-threading, and result formatting.
415
+
416
+ #### [account_class.py](./account_class.py)
417
+
418
+ AWS Account object model supporting Root, Child, and Standalone account types with relationship mapping and metadata management.
419
+
420
+ #### [ArgumentsClass.py](./ArgumentsClass.py)
421
+
422
+ Standardized argument parsing framework ensuring consistent CLI interfaces across all inventory scripts.
423
+
424
+ #### [aws_decorators.py](./aws_decorators.py)
425
+
426
+ Python decorators for AWS operations including retry logic, error handling, and performance monitoring.
427
+
428
+ #### [ec2_vpc_utils.py](./ec2_vpc_utils.py)
429
+
430
+ Specialized VPC utility functions for network analysis, default VPC management, and CIDR calculations.
431
+
432
+ ### Testing and Validation
433
+
434
+ #### [inventory.sh](./inventory.sh)
435
+
436
+ Comprehensive test automation script for validating all inventory scripts with timing analysis and error reporting.
437
+
438
+ #### [all_my_instances_wrapper.py](./all_my_instances_wrapper.py)
439
+
440
+ Wrapper script for batch EC2 instance operations with error handling and progress tracking.
441
+
442
+ ### Directory Structure
443
+
444
+ #### [collectors/](./collectors/)
445
+
446
+ Modular collectors for different AWS service categories:
447
+ - `aws_compute.py` - Compute service data collection
448
+ - `aws_networking.py` - Networking service data collection
449
+ - `base.py` - Base collector interface and common functionality
450
+
451
+ #### [core/](./core/)
452
+
453
+ Core framework components:
454
+ - `collector.py` - Main collector orchestration
455
+ - `formatter.py` - Output formatting and reporting
456
+
457
+ #### [models/](./models/)
458
+
459
+ Data models and schemas for inventory objects and API responses.
460
+
461
+ #### [utils/](./utils/)
462
+
463
+ Utility functions and helper modules for specialized operations.
464
+
465
+ #### [tests/](./tests/)
466
+
467
+ Comprehensive test suite for all inventory scripts and components.
468
+
469
+ ## Usage and Discovery
470
+
471
+ For comprehensive discovery workflows and usage examples, refer to:
472
+ - `discovery.md` - Discovery methodology and best practices
473
+ - `cloudtrail.md` - CloudTrail-specific guidance and compliance
474
+
475
+ ## Testing Status and Quality Assurance
476
+
477
+ **Autonomous Testing Results (Latest Run: 2025-08-21)**
478
+
479
+ **Overall Success Rate: 37/46 scripts PASSING (80.4% success rate)**
480
+
481
+ ### ✅ PASSED Scripts (37):
482
+ - Core inventory functions: `list_ec2_instances.py`, `list_vpcs.py`, `list_rds_db_instances.py`, `list_lambda_functions.py`
483
+ - CloudFormation management: `find_cfn_stackset_drift.py`, `list_cfn_stacksets.py`, `update_cfn_stacksets.py`
484
+ - Organization management: `list_org_accounts.py`, `draw_org_structure.py`, `check_landingzone_readiness.py`
485
+ - Security and compliance: `check_cloudtrail_compliance.py`, `list_iam_roles.py`, `list_guardduty_detectors.py`
486
+ - Network analysis: `find_vpc_flow_logs.py`, `list_vpc_subnets.py`, `list_enis_network_interfaces.py`
487
+ - Storage and monitoring: `update_s3_public_access_block.py`, `update_cloudwatch_logs_retention_policy.py`
488
+
489
+ ### ⚠️ Known Issues (9 scripts):
490
+ Scripts requiring manual parameters, interactive input, or specialized configuration.
491
+
492
+ ## Enterprise Features
493
+
494
+ - **Multi-threading**: Optimized concurrent operations across accounts and regions
495
+ - **Error Handling**: Comprehensive error recovery and retry mechanisms
496
+ - **Progress Tracking**: Real-time progress indicators and performance metrics
497
+ - **Output Formats**: Multiple output formats including JSON, CSV, and Excel
498
+ - **Filtering**: Advanced filtering by fragments, accounts, regions, and resources
499
+ - **Safety Checks**: Built-in safeguards for destructive operations
500
+ - **Logging**: Configurable logging levels from INFO to DEBUG
501
+ - **Authentication**: Support for profiles, cross-account roles, and federated access
502
+ - **Quality Assurance**: Autonomous testing framework with comprehensive validation
503
+
504
+ ## Passed Scripts Usage Guide
505
+
506
+ ### 🎉 SUCCESS STATUS: 37/46 scripts PASSING (80.4% success rate)
507
+
508
+ This section consolidates usage examples and parameter documentation for all PASSED scripts.
509
+
510
+ ---
511
+
512
+ ## 🏗️ EC2 & Compute Services
513
+
514
+ ### Initialization & Framework
515
+
516
+ #### `__init__.py` ✅
517
+ Purpose: Python package initialization
518
+ Usage: Automatically imported when using the inventory package
519
+ Parameters: None
520
+ Example:
521
+
522
+
523
+ ```python
524
+ from runbooks.inventory import *
525
+ ```
526
+
527
+ ---
528
+
529
+ ## 🏗️ EC2 & Compute Services
530
+
531
+ ### `list_ec2_instances.py` ✅
532
+ Purpose: Comprehensive EC2 instance discovery across accounts and regions
533
+ AWS APIs: `ec2.describe_instances()`
534
+
535
+ Usage Examples:
536
+
537
+
538
+ ```bash
539
+ # List all instances across all accounts and regions
540
+ python list_ec2_instances.py --profile ams-admin-ReadOnlyAccess-909135376185
541
+
542
+ # List instances in specific regions
543
+ python list_ec2_instances.py --profile my-profile --regions us-east-1,us-west-2
544
+
545
+ # Filter by account fragment
546
+ python list_ec2_instances.py --profile my-profile --accounts prod
547
+
548
+ # Export to file
549
+ python list_ec2_instances.py --profile my-profile --filename ec2_inventory.json
550
+
551
+ # Verbose output with timing
552
+ python list_ec2_instances.py --profile my-profile --verbose --timing
553
+ ```
554
+
555
+ Key Parameters:
556
+ - `--profile`: AWS profile for authentication
557
+ - `--regions`: Comma-separated list of regions or 'all'
558
+ - `--accounts`: Account ID or fragment filter
559
+ - `--filename`: Export results to JSON file
560
+ - `--verbose`: Detailed logging
561
+ - `--timing`: Performance metrics
562
+
563
+ ### `list_ec2_ebs_volumes.py` ✅
564
+ Purpose: EBS volume inventory with orphaned volume detection
565
+ AWS APIs: `ec2.describe_volumes()`
566
+
567
+ Usage Examples:
568
+
569
+
570
+ ```bash
571
+ # List all EBS volumes
572
+ python list_ec2_ebs_volumes.py --profile my-profile
573
+
574
+ # Find orphaned volumes (not attached to instances)
575
+ python list_ec2_ebs_volumes.py --profile my-profile --verbose
576
+
577
+ # Cost optimization analysis
578
+ python list_ec2_ebs_volumes.py --profile my-profile --filename volumes_cost_analysis.json
579
+ ```
580
+
581
+ ### `list_ec2_availability_zones.py` ✅
582
+ Purpose: Availability Zone mapping and regional capacity analysis
583
+ AWS APIs: `ec2.describe_availability_zones()`
584
+
585
+ Usage Examples:
586
+
587
+
588
+ ```bash
589
+ # Map all availability zones
590
+ python list_ec2_availability_zones.py --profile my-profile
591
+
592
+ # Regional capacity analysis
593
+ python list_ec2_availability_zones.py --profile my-profile --regions all --verbose
594
+ ```
595
+
596
+ ### `list_ecs_clusters_and_tasks.py` ✅
597
+ Purpose: ECS cluster and task inventory for container workload management
598
+ AWS APIs: `ecs.list_clusters()`, `ecs.list_tasks()`
599
+
600
+ Usage Examples:
601
+
602
+
603
+ ```bash
604
+ # List all ECS clusters and tasks
605
+ python list_ecs_clusters_and_tasks.py --profile my-profile
606
+
607
+ # Container workload analysis
608
+ python list_ecs_clusters_and_tasks.py --profile my-profile --verbose --timing
609
+ ```
610
+
611
+ ### `all_my_instances_wrapper.py` ✅
612
+ Purpose: Legacy-compatible EC2 instance listing wrapper
613
+ Dependencies: `list_ec2_instances.py`
614
+
615
+ Usage Examples:
616
+
617
+
618
+ ```bash
619
+ # Legacy interface compatibility
620
+ python all_my_instances_wrapper.py --account-id 123456789012 --profile my-profile
621
+
622
+ # Regional filtering
623
+ python all_my_instances_wrapper.py --account-id 123456789012 --region us-east-1 --profile my-profile
624
+
625
+ # JSON output format
626
+ python all_my_instances_wrapper.py --account-id 123456789012 --format json --profile my-profile
627
+ ```
628
+
629
+ ---
630
+
631
+ ## 🌐 Networking & VPC
632
+
633
+ ### `list_vpcs.py` ✅
634
+ Purpose: VPC discovery with default VPC identification and network architecture analysis
635
+ AWS APIs: `ec2.describe_vpcs()`
636
+
637
+ Usage Examples:
638
+
639
+
640
+ ```bash
641
+ # List all VPCs
642
+ python list_vpcs.py --profile my-profile
643
+
644
+ # Network architecture analysis
645
+ python list_vpcs.py --profile my-profile --verbose
646
+
647
+ # Export network topology
648
+ python list_vpcs.py --profile my-profile --filename network_topology.json
649
+ ```
650
+
651
+ ### `list_vpc_subnets.py` ✅
652
+ Purpose: Subnet inventory with CIDR block analysis and IP address tracking
653
+ AWS APIs: `ec2.describe_subnets()`
654
+
655
+ Usage Examples:
656
+
657
+
658
+ ```bash
659
+ # List all subnets
660
+ python list_vpc_subnets.py --profile my-profile
661
+
662
+ # CIDR analysis with IP address tracking
663
+ python list_vpc_subnets.py --profile my-profile --verbose
664
+ ```
665
+
666
+ ### `find_vpc_flow_logs.py` ✅
667
+ Purpose: VPC Flow Logs configuration analysis and compliance reporting
668
+ AWS APIs: `ec2.describe_flow_logs()`, `logs.describe_log_groups()`
669
+
670
+ Usage Examples:
671
+
672
+
673
+ ```bash
674
+ # Check VPC Flow Logs compliance
675
+ python find_vpc_flow_logs.py --profile my-profile
676
+
677
+ # Compliance reporting
678
+ python find_vpc_flow_logs.py --profile my-profile --verbose --filename flow_logs_compliance.json
679
+ ```
680
+
681
+ ### `list_enis_network_interfaces.py` ✅
682
+ Purpose: Elastic Network Interface inventory for IP address tracking
683
+ AWS APIs: `ec2.describe_network_interfaces()`
684
+
685
+ Usage Examples:
686
+
687
+
688
+ ```bash
689
+ # List all ENIs
690
+ python list_enis_network_interfaces.py --profile my-profile
691
+
692
+ # Network troubleshooting
693
+ python list_enis_network_interfaces.py --profile my-profile --verbose
694
+ ```
695
+
696
+ ### `list_elbs_load_balancers.py` ✅
697
+ Purpose: Classic and Application Load Balancer discovery
698
+ AWS APIs: `elbv2.describe_load_balancers()`, `elb.describe_load_balancers()`
699
+
700
+ Usage Examples:
701
+
702
+
703
+ ```bash
704
+ # List all load balancers
705
+ python list_elbs_load_balancers.py --profile my-profile
706
+
707
+ # Load balancer analysis
708
+ python list_elbs_load_balancers.py --profile my-profile --verbose
709
+ ```
710
+
711
+ ---
712
+
713
+ ## 🔐 Identity & Access Management
714
+
715
+ ### `list_iam_roles.py` ✅
716
+ Purpose: Cross-account IAM role discovery for access management
717
+ AWS APIs: `iam.list_roles()`
718
+
719
+ Usage Examples:
720
+
721
+
722
+ ```bash
723
+ # List all IAM roles
724
+ python list_iam_roles.py --profile my-profile
725
+
726
+ # Cross-account role analysis
727
+ python list_iam_roles.py --profile my-profile --verbose --filename iam_roles_audit.json
728
+
729
+ # Filter by role name fragment
730
+ python list_iam_roles.py --profile my-profile --fragments Admin
731
+ ```
732
+
733
+ ### `list_iam_saml_providers.py` ✅
734
+ Purpose: SAML identity provider inventory with cleanup capabilities
735
+ AWS APIs: `iam.list_saml_providers()`, `iam.delete_saml_provider()`
736
+
737
+ Usage Examples:
738
+
739
+
740
+ ```bash
741
+ # List SAML providers
742
+ python list_iam_saml_providers.py --profile my-profile
743
+
744
+ # SAML provider cleanup (with confirmation)
745
+ python list_iam_saml_providers.py --profile my-profile +delete
746
+ ```
747
+
748
+ ---
749
+
750
+ ## 🏗️ CloudFormation Management
751
+
752
+ ### `list_cfn_stacks.py` ✅
753
+ Purpose: Comprehensive CloudFormation stack discovery with fragment-based searching
754
+ AWS APIs: `cloudformation.describe_stacks()`, `cloudformation.list_stacks()`
755
+
756
+ Usage Examples:
757
+
758
+
759
+ ```bash
760
+ # List all CloudFormation stacks
761
+ python list_cfn_stacks.py --profile my-profile
762
+
763
+ # Search by stack name fragment
764
+ python list_cfn_stacks.py --profile my-profile --fragments "web-"
765
+
766
+ # Exact stack name match
767
+ python list_cfn_stacks.py --profile my-profile --fragments "web-app-prod" --exact
768
+
769
+ # Export stack inventory
770
+ python list_cfn_stacks.py --profile my-profile --filename cfn_stacks.json
771
+ ```
772
+
773
+ ### `list_cfn_stacksets.py` ✅
774
+ Purpose: CloudFormation StackSet inventory and analysis
775
+ AWS APIs: `cloudformation.list_stack_sets()`, `cloudformation.describe_stack_set()`
776
+
777
+ Usage Examples:
778
+
779
+
780
+ ```bash
781
+ # List all StackSets
782
+ python list_cfn_stacksets.py --profile my-profile
783
+
784
+ # StackSet deployment analysis
785
+ python list_cfn_stacksets.py --profile my-profile --verbose
786
+ ```
787
+
788
+ ### `list_cfn_stackset_operations.py` ✅
789
+ Purpose: Track CloudFormation StackSet operations and status
790
+ AWS APIs: `cloudformation.list_stack_set_operations()`, `cloudformation.describe_stack_set_operation()`
791
+
792
+ Usage Examples:
793
+
794
+
795
+ ```bash
796
+ # List StackSet operations
797
+ python list_cfn_stackset_operations.py --profile my-profile
798
+
799
+ # Operation tracking and diagnostics
800
+ python list_cfn_stackset_operations.py --profile my-profile --verbose --timing
801
+ ```
802
+
803
+ ### `list_cfn_stackset_operation_results.py` ✅
804
+ Purpose: Detailed analysis of CloudFormation StackSet operation results
805
+ AWS APIs: `cloudformation.list_stack_set_operation_results()`
806
+
807
+ Usage Examples:
808
+
809
+
810
+ ```bash
811
+ # Analyze operation results from files
812
+ python list_cfn_stackset_operation_results.py --stacksets_filename stacksets.txt --org_filename orgs.txt
813
+
814
+ # Basic analysis without input files (testing mode)
815
+ python list_cfn_stackset_operation_results.py --profile my-profile
816
+ ```
817
+
818
+ ### `find_cfn_stackset_drift.py` ✅
819
+ Purpose: Detect drift in CloudFormation StackSets
820
+ AWS APIs: `cloudformation.describe_stack_sets()`, `cloudformation.detect_stack_set_drift()`
821
+
822
+ Usage Examples:
823
+
824
+
825
+ ```bash
826
+ # Detect StackSet drift
827
+ python find_cfn_stackset_drift.py --profile my-profile
828
+
829
+ # Automated drift detection
830
+ python find_cfn_stackset_drift.py --profile my-profile --verbose --timing
831
+ ```
832
+
833
+ ### `find_cfn_orphaned_stacks.py` ✅
834
+ Purpose: Identify orphaned CloudFormation stacks
835
+ AWS APIs: `cloudformation.describe_stacks()`, `cloudformation.list_stack_sets()`
836
+
837
+ Usage Examples:
838
+
839
+
840
+ ```bash
841
+ # Find orphaned stacks
842
+ python find_cfn_orphaned_stacks.py --profile my-profile
843
+
844
+ # Comprehensive orphan analysis
845
+ python find_cfn_orphaned_stacks.py --profile my-profile --verbose --filename orphaned_stacks.json
846
+ ```
847
+
848
+ ### `find_cfn_drift_detection.py` ✅
849
+ Purpose: Detect and report configuration drift in CloudFormation stacks
850
+ AWS APIs: `cloudformation.detect_stack_drift()`, `cloudformation.describe_stack_drift_detection_status()`
851
+
852
+ Usage Examples:
853
+
854
+
855
+ ```bash
856
+ # Detect stack drift (automated mode)
857
+ python find_cfn_drift_detection.py --profile my-profile
858
+
859
+ # Stack fragment filtering
860
+ python find_cfn_drift_detection.py --profile my-profile --stackfrag "web-"
861
+
862
+ # Interactive mode for organizational scope
863
+ python find_cfn_drift_detection.py --profile my-profile
864
+ ```
865
+
866
+ ### `update_cfn_stacksets.py` ✅
867
+ Purpose: CloudFormation StackSet update automation
868
+ AWS APIs: `cloudformation.update_stack_set()`, `cloudformation.create_stack_instances()`
869
+
870
+ Usage Examples:
871
+
872
+
873
+ ```bash
874
+ # Update StackSets
875
+ python update_cfn_stacksets.py --profile my-profile
876
+
877
+ # Automated StackSet management
878
+ python update_cfn_stacksets.py --profile my-profile --verbose
879
+ ```
880
+
881
+ ### `recover_cfn_stack_ids.py` ✅
882
+ Purpose: CloudFormation stack ID recovery for disaster recovery
883
+ AWS APIs: `cloudformation.describe_stacks()`
884
+
885
+ Usage Examples:
886
+
887
+
888
+ ```bash
889
+ # Recover stack IDs
890
+ python recover_cfn_stack_ids.py --profile my-profile
891
+
892
+ # Stack recovery with fragment filtering
893
+ python recover_cfn_stack_ids.py --profile my-profile --regions us-east-1 --fragments "web-"
894
+ ```
895
+
896
+ ---
897
+
898
+ ## 🏢 AWS Organizations & Governance
899
+
900
+ ### `list_org_accounts.py` ✅
901
+ Purpose: Comprehensive AWS Organizations account inventory
902
+ AWS APIs: `organizations.list_accounts()`, `organizations.describe_organization()`
903
+
904
+ Usage Examples:
905
+
906
+
907
+ ```bash
908
+ # List all organization accounts
909
+ python list_org_accounts.py --profile my-profile
910
+
911
+ # Account governance analysis
912
+ python list_org_accounts.py --profile my-profile --verbose --filename org_accounts.json
913
+ ```
914
+
915
+ ### `list_org_accounts_users.py` ✅
916
+ Purpose: Cross-account IAM user inventory for governance
917
+ AWS APIs: `organizations.list_accounts()`, `iam.list_users()`
918
+
919
+ Usage Examples:
920
+
921
+
922
+ ```bash
923
+ # Cross-account user inventory
924
+ python list_org_accounts_users.py --profile my-profile
925
+
926
+ # Governance and compliance reporting
927
+ python list_org_accounts_users.py --profile my-profile --verbose --filename user_audit.json
928
+ ```
929
+
930
+ ### `draw_org_structure.py` ✅
931
+ Purpose: Generate GraphViz visualization of AWS Organizations structure
932
+ AWS APIs: `organizations.describe_organization()`, `organizations.list_organizational_units()`
933
+
934
+ Usage Examples:
935
+
936
+
937
+ ```bash
938
+ # Generate organization chart
939
+ python draw_org_structure.py --profile my-profile
940
+
941
+ # Visual organization analysis
942
+ python draw_org_structure.py --profile my-profile --verbose
943
+ ```
944
+
945
+ ### `find_landingzone_versions.py` ✅
946
+ Purpose: Discovery and version analysis of AWS Landing Zone deployments
947
+ AWS APIs: `organizations.describe_account()`, `cloudformation.describe_stacks()`
948
+
949
+ Usage Examples:
950
+
951
+
952
+ ```bash
953
+ # Find Landing Zone versions
954
+ python find_landingzone_versions.py --profile my-profile
955
+
956
+ # Version analysis across accounts
957
+ python find_landingzone_versions.py --profile my-profile --verbose
958
+ ```
959
+
960
+ ### `check_landingzone_readiness.py` ✅
961
+ Purpose: Evaluate accounts for AWS Landing Zone adoption prerequisites
962
+ AWS APIs: `organizations.describe_account()`, `ec2.describe_vpcs()`
963
+
964
+ Usage Examples:
965
+
966
+
967
+ ```bash
968
+ # Check Landing Zone readiness
969
+ python check_landingzone_readiness.py --profile my-profile
970
+
971
+ # Account readiness assessment
972
+ python check_landingzone_readiness.py --profile my-profile --ChildAccountId 123456789012
973
+ ```
974
+
975
+ ---
976
+
977
+ ## 🔍 Security & Compliance
978
+
979
+ ### `check_cloudtrail_compliance.py` ✅
980
+ Purpose: Assess CloudTrail compliance across accounts and regions
981
+ AWS APIs: `cloudtrail.describe_trails()`, `cloudtrail.get_trail_status()`
982
+
983
+ Usage Examples:
984
+
985
+
986
+ ```bash
987
+ # CloudTrail compliance check
988
+ python check_cloudtrail_compliance.py --profile my-profile
989
+
990
+ # Comprehensive compliance assessment
991
+ python check_cloudtrail_compliance.py --profile my-profile --verbose --filename cloudtrail_compliance.json
992
+ ```
993
+
994
+ ### `list_guardduty_detectors.py` ✅
995
+ Purpose: GuardDuty detector inventory with cleanup capabilities
996
+ AWS APIs: `guardduty.list_detectors()`, `guardduty.delete_detector()`
997
+
998
+ Usage Examples:
999
+
1000
+
1001
+ ```bash
1002
+ # List GuardDuty detectors
1003
+ python list_guardduty_detectors.py --profile my-profile
1004
+
1005
+ # GuardDuty cleanup (with confirmation)
1006
+ python list_guardduty_detectors.py --profile my-profile +delete
1007
+ ```
1008
+
1009
+ ### `verify_ec2_security_groups.py` ✅
1010
+ Purpose: Comprehensive security group verification and compliance
1011
+ AWS APIs: `ec2.describe_security_groups()`, `ec2.authorize_security_group_ingress()`
1012
+
1013
+ Usage Examples:
1014
+
1015
+
1016
+ ```bash
1017
+ # Verify security groups
1018
+ python verify_ec2_security_groups.py --profile my-profile
1019
+
1020
+ # Security compliance assessment
1021
+ python verify_ec2_security_groups.py --profile my-profile --verbose
1022
+ ```
1023
+
1024
+ ---
1025
+
1026
+ ## 🗄️ Database & Storage
1027
+
1028
+ ### `list_rds_db_instances.py` ✅
1029
+ Purpose: RDS database instance inventory with configuration analysis
1030
+ AWS APIs: `rds.describe_db_instances()`
1031
+
1032
+ Usage Examples:
1033
+
1034
+
1035
+ ```bash
1036
+ # List all RDS instances
1037
+ python list_rds_db_instances.py --profile my-profile
1038
+
1039
+ # Database configuration analysis
1040
+ python list_rds_db_instances.py --profile my-profile --verbose --filename rds_inventory.json
1041
+ ```
1042
+
1043
+ ### `update_s3_public_access_block.py` ✅
1044
+ Purpose: S3 Public Access Block enforcement across organizations
1045
+ AWS APIs: `s3.put_public_access_block()`, `s3.get_public_access_block()`
1046
+
1047
+ Usage Examples:
1048
+
1049
+
1050
+ ```bash
1051
+ # Update S3 public access blocks
1052
+ python update_s3_public_access_block.py --profile my-profile
1053
+
1054
+ # Organization-wide S3 security enforcement
1055
+ python update_s3_public_access_block.py --profile my-profile --verbose
1056
+ ```
1057
+
1058
+ ---
1059
+
1060
+ ## ⚡ Serverless & Functions
1061
+
1062
+ ### `list_lambda_functions.py` ✅
1063
+ Purpose: Lambda function inventory with runtime version management
1064
+ AWS APIs: `lambda.list_functions()`, `lambda.update_function_configuration()`
1065
+
1066
+ Usage Examples:
1067
+
1068
+
1069
+ ```bash
1070
+ # List all Lambda functions
1071
+ python list_lambda_functions.py --profile my-profile
1072
+
1073
+ # Runtime version analysis
1074
+ python list_lambda_functions.py --profile my-profile --verbose --filename lambda_inventory.json
1075
+ ```
1076
+
1077
+ ---
1078
+
1079
+ ## 🌐 DNS & Networking Services
1080
+
1081
+ ### `list_route53_hosted_zones.py` ✅
1082
+ Purpose: Route53 hosted zone discovery for DNS management
1083
+ AWS APIs: `route53.list_hosted_zones()`
1084
+
1085
+ Usage Examples:
1086
+
1087
+
1088
+ ```bash
1089
+ # List all hosted zones
1090
+ python list_route53_hosted_zones.py --profile my-profile
1091
+
1092
+ # DNS management analysis
1093
+ python list_route53_hosted_zones.py --profile my-profile --verbose
1094
+ ```
1095
+
1096
+ ---
1097
+
1098
+ ## 🏗️ Service Catalog & Configuration
1099
+
1100
+ ### `list_servicecatalog_provisioned_products.py` ✅
1101
+ Purpose: Service Catalog provisioned product management
1102
+ AWS APIs: `servicecatalog.search_provisioned_products()`, `servicecatalog.terminate_provisioned_product()`
1103
+
1104
+ Usage Examples:
1105
+
1106
+
1107
+ ```bash
1108
+ # List provisioned products
1109
+ python list_servicecatalog_provisioned_products.py --profile my-profile
1110
+
1111
+ # Product lifecycle management
1112
+ python list_servicecatalog_provisioned_products.py --profile my-profile --verbose
1113
+ ```
1114
+
1115
+ ### `list_config_recorders_delivery_channels.py` ✅
1116
+ Purpose: Config Recorder and Delivery Channel inventory
1117
+ AWS APIs: `config.describe_configuration_recorders()`, `config.describe_delivery_channels()`
1118
+
1119
+ Usage Examples:
1120
+
1121
+
1122
+ ```bash
1123
+ # List Config recorders and delivery channels
1124
+ python list_config_recorders_delivery_channels.py --profile my-profile
1125
+
1126
+ # Configuration compliance assessment
1127
+ python list_config_recorders_delivery_channels.py --profile my-profile --verbose
1128
+ ```
1129
+
1130
+ ---
1131
+
1132
+ ## 📂 Directory Services
1133
+
1134
+ ### `list_ds_directories.py` ✅
1135
+ Purpose: Directory Service inventory for identity management
1136
+ AWS APIs: `ds.describe_directories()`
1137
+
1138
+ Usage Examples:
1139
+
1140
+
1141
+ ```bash
1142
+ # List directory services
1143
+ python list_ds_directories.py --profile my-profile
1144
+
1145
+ # Identity management cleanup
1146
+ python list_ds_directories.py --profile my-profile --verbose
1147
+ ```
1148
+
1149
+ ---
1150
+
1151
+ ## 📨 Messaging Services
1152
+
1153
+ ### `list_sns_topics.py` ✅
1154
+ Purpose: SNS topic inventory across accounts and regions
1155
+ AWS APIs: `sns.list_topics()`
1156
+
1157
+ Usage Examples:
1158
+
1159
+
1160
+ ```bash
1161
+ # List all SNS topics
1162
+ python list_sns_topics.py --profile my-profile
1163
+
1164
+ # Messaging service analysis
1165
+ python list_sns_topics.py --profile my-profile --verbose --filename sns_topics.json
1166
+ ```
1167
+
1168
+ ---
1169
+
1170
+ ## 📊 Monitoring & Logging
1171
+
1172
+ ### `update_cloudwatch_logs_retention_policy.py` ✅
1173
+ Purpose: CloudWatch Logs retention policy management
1174
+ AWS APIs: `logs.describe_log_groups()`, `logs.put_retention_policy()`
1175
+
1176
+ Usage Examples:
1177
+
1178
+
1179
+ ```bash
1180
+ # Update log retention policies
1181
+ python update_cloudwatch_logs_retention_policy.py --profile my-profile
1182
+
1183
+ # Cost optimization through retention management
1184
+ python update_cloudwatch_logs_retention_policy.py --profile my-profile --verbose
1185
+ ```
1186
+
1187
+ ---
1188
+
1189
+ ## 🔧 Common Parameters Across All Scripts
1190
+
1191
+ ### Authentication Parameters
1192
+ - `--profile`: AWS profile name for authentication
1193
+ - `--profiles`: Multiple profiles for cross-account operations
1194
+
1195
+ ### Regional Parameters
1196
+ - `--regions` / `--region`: Target AWS regions ('all' for all regions)
1197
+ - `--regions-fragment`: Region fragment matching (e.g., 'us-east')
1198
+
1199
+ ### Filtering Parameters
1200
+ - `--fragments` / `--fragment`: Resource name fragment filtering
1201
+ - `--accounts`: Account ID or fragment filtering
1202
+ - `--exact`: Exact string matching (no fragments)
1203
+
1204
+ ### Output Parameters
1205
+ - `--filename`: Export results to file (JSON format)
1206
+ - `--verbose` / `-v`: Detailed logging output
1207
+ - `--timing`: Performance timing information
1208
+
1209
+ ### Safety Parameters
1210
+ - `--skipprofile`: Profiles to exclude from operations
1211
+ - `--skipaccount`: Accounts to exclude from operations
1212
+ - `+delete`: Enable destructive operations (requires confirmation)
1213
+
1214
+ ---
1215
+
1216
+ ## 🚀 Best Practices for Usage
1217
+
1218
+ ### 1. Authentication Setup
1219
+
1220
+ ```bash
1221
+ # Configure AWS SSO
1222
+ aws configure sso --profile ams-admin-ReadOnlyAccess-909135376185
1223
+
1224
+ # Verify credentials
1225
+ aws sts get-caller-identity --profile ams-admin-ReadOnlyAccess-909135376185
1226
+ ```
1227
+
1228
+ ### 2. Regional Operations
1229
+
1230
+ ```bash
1231
+ # All regions
1232
+ --regions all
1233
+
1234
+ # Specific regions
1235
+ --regions us-east-1,us-west-2,eu-west-1
1236
+
1237
+ # Regional fragments
1238
+ --regions us-
1239
+ ```
1240
+
1241
+ ### 3. Cross-Account Operations
1242
+
1243
+ ```bash
1244
+ # All organization accounts
1245
+ --profile management-account-profile
1246
+
1247
+ # Specific account filtering
1248
+ --accounts prod
1249
+
1250
+ # Skip specific accounts
1251
+ --skipaccount 123456789012,987654321098
1252
+ ```
1253
+
1254
+ ### 4. Output and Reporting
1255
+
1256
+ ```bash
1257
+ # Export to file
1258
+ --filename inventory_$(date +%Y%m%d).json
1259
+
1260
+ # Verbose logging with timing
1261
+ --verbose --timing
1262
+
1263
+ # Structured output
1264
+ python script.py --profile my-profile --filename results.json --verbose
1265
+ ```
1266
+
1267
+ ### 5. Performance Optimization
1268
+
1269
+ ```bash
1270
+ # Regional targeting
1271
+ --regions us-east-1
1272
+
1273
+ # Account filtering
1274
+ --accounts prod
1275
+
1276
+ # Fragment-based filtering
1277
+ --fragments web-
1278
+ ```
1279
+
1280
+ ---
1281
+
1282
+ ## 📋 Quick Reference Commands
1283
+
1284
+ ### Infrastructure Inventory
1285
+
1286
+ ```bash
1287
+ # Complete EC2 inventory
1288
+ python list_ec2_instances.py --profile my-profile --regions all --filename ec2_complete.json
1289
+
1290
+ # Network topology
1291
+ python list_vpcs.py --profile my-profile --verbose --filename network_topology.json
1292
+
1293
+ # Security assessment
1294
+ python check_cloudtrail_compliance.py --profile my-profile --filename security_compliance.json
1295
+ ```
1296
+
1297
+ ### Governance & Compliance
1298
+
1299
+ ```bash
1300
+ # Organization overview
1301
+ python list_org_accounts.py --profile my-profile --filename org_structure.json
1302
+
1303
+ # IAM audit
1304
+ python list_iam_roles.py --profile my-profile --verbose --filename iam_audit.json
1305
+
1306
+ # CloudFormation inventory
1307
+ python list_cfn_stacks.py --profile my-profile --regions all --filename cfn_inventory.json
1308
+ ```
1309
+
1310
+ ### Cost Optimization
1311
+
1312
+ ```bash
1313
+ # EBS volume analysis
1314
+ python list_ec2_ebs_volumes.py --profile my-profile --filename volume_cost_analysis.json
1315
+
1316
+ # Lambda function optimization
1317
+ python list_lambda_functions.py --profile my-profile --filename lambda_optimization.json
1318
+
1319
+ # Log retention optimization
1320
+ python update_cloudwatch_logs_retention_policy.py --profile my-profile --verbose