runbooks 1.1.9__py3-none-any.whl → 1.1.10__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.
- runbooks/__init__.py +1 -1
- runbooks/__init___optimized.py +2 -1
- runbooks/_platform/__init__.py +1 -1
- runbooks/cfat/cli.py +4 -3
- runbooks/cfat/cloud_foundations_assessment.py +1 -2
- runbooks/cfat/tests/test_cli.py +4 -1
- runbooks/cli/commands/finops.py +68 -19
- runbooks/cli/commands/inventory.py +796 -7
- runbooks/cli/commands/operate.py +65 -4
- runbooks/cloudops/cost_optimizer.py +1 -3
- runbooks/common/cli_decorators.py +6 -4
- runbooks/common/config_loader.py +787 -0
- runbooks/common/config_schema.py +280 -0
- runbooks/common/dry_run_framework.py +14 -2
- runbooks/common/mcp_integration.py +238 -0
- runbooks/finops/ebs_cost_optimizer.py +7 -4
- runbooks/finops/elastic_ip_optimizer.py +7 -4
- runbooks/finops/infrastructure/__init__.py +3 -2
- runbooks/finops/infrastructure/commands.py +7 -4
- runbooks/finops/infrastructure/load_balancer_optimizer.py +7 -4
- runbooks/finops/infrastructure/vpc_endpoint_optimizer.py +7 -4
- runbooks/finops/nat_gateway_optimizer.py +7 -4
- runbooks/finops/tests/run_tests.py +1 -1
- runbooks/inventory/ArgumentsClass.py +2 -1
- runbooks/inventory/README.md +111 -12
- runbooks/inventory/Tests/test_Inventory_Modules.py +27 -10
- runbooks/inventory/Tests/test_cfn_describe_stacks.py +18 -7
- runbooks/inventory/Tests/test_ec2_describe_instances.py +30 -15
- runbooks/inventory/Tests/test_lambda_list_functions.py +17 -3
- runbooks/inventory/Tests/test_org_list_accounts.py +17 -4
- runbooks/inventory/account_class.py +0 -1
- runbooks/inventory/all_my_instances_wrapper.py +4 -8
- runbooks/inventory/aws_organization.png +0 -0
- runbooks/inventory/check_cloudtrail_compliance.py +4 -4
- runbooks/inventory/check_controltower_readiness.py +50 -47
- runbooks/inventory/check_landingzone_readiness.py +35 -31
- runbooks/inventory/cloud_foundations_integration.py +8 -3
- runbooks/inventory/core/collector.py +201 -1
- runbooks/inventory/discovery.md +2 -1
- runbooks/inventory/{draw_org_structure.py → draw_org.py} +55 -9
- runbooks/inventory/drift_detection_cli.py +8 -68
- runbooks/inventory/find_cfn_drift_detection.py +14 -4
- runbooks/inventory/find_cfn_orphaned_stacks.py +7 -5
- runbooks/inventory/find_cfn_stackset_drift.py +5 -5
- runbooks/inventory/find_ec2_security_groups.py +6 -3
- runbooks/inventory/find_landingzone_versions.py +5 -5
- runbooks/inventory/find_vpc_flow_logs.py +5 -5
- runbooks/inventory/inventory.sh +20 -7
- runbooks/inventory/inventory_mcp_cli.py +4 -0
- runbooks/inventory/inventory_modules.py +9 -7
- runbooks/inventory/list_cfn_stacks.py +18 -8
- runbooks/inventory/list_cfn_stackset_operation_results.py +2 -2
- runbooks/inventory/list_cfn_stackset_operations.py +32 -20
- runbooks/inventory/list_cfn_stacksets.py +7 -4
- runbooks/inventory/list_config_recorders_delivery_channels.py +4 -4
- runbooks/inventory/list_ds_directories.py +3 -3
- runbooks/inventory/list_ec2_availability_zones.py +7 -3
- runbooks/inventory/list_ec2_ebs_volumes.py +3 -3
- runbooks/inventory/list_ec2_instances.py +1 -1
- runbooks/inventory/list_ecs_clusters_and_tasks.py +8 -4
- runbooks/inventory/list_elbs_load_balancers.py +7 -3
- runbooks/inventory/list_enis_network_interfaces.py +3 -3
- runbooks/inventory/list_guardduty_detectors.py +9 -5
- runbooks/inventory/list_iam_policies.py +7 -3
- runbooks/inventory/list_iam_roles.py +3 -3
- runbooks/inventory/list_iam_saml_providers.py +8 -4
- runbooks/inventory/list_lambda_functions.py +8 -4
- runbooks/inventory/list_org_accounts.py +306 -276
- runbooks/inventory/list_org_accounts_users.py +45 -9
- runbooks/inventory/list_rds_db_instances.py +4 -4
- runbooks/inventory/list_route53_hosted_zones.py +3 -3
- runbooks/inventory/list_servicecatalog_provisioned_products.py +5 -5
- runbooks/inventory/list_sns_topics.py +4 -4
- runbooks/inventory/list_ssm_parameters.py +6 -3
- runbooks/inventory/list_vpc_subnets.py +8 -4
- runbooks/inventory/list_vpcs.py +15 -4
- runbooks/inventory/mcp_vpc_validator.py +6 -0
- runbooks/inventory/organizations_discovery.py +17 -3
- runbooks/inventory/organizations_utils.py +553 -0
- runbooks/inventory/output_formatters.py +422 -0
- runbooks/inventory/recover_cfn_stack_ids.py +5 -5
- runbooks/inventory/run_on_multi_accounts.py +3 -3
- runbooks/inventory/tag_coverage.py +481 -0
- runbooks/inventory/validation_utils.py +358 -0
- runbooks/inventory/verify_ec2_security_groups.py +18 -5
- runbooks/inventory/vpc_architecture_validator.py +7 -1
- runbooks/inventory/vpc_dependency_analyzer.py +6 -0
- runbooks/main_final.py +2 -2
- runbooks/main_ultra_minimal.py +2 -2
- runbooks/mcp/integration.py +6 -4
- runbooks/remediation/acm_remediation.py +2 -2
- runbooks/remediation/cloudtrail_remediation.py +2 -2
- runbooks/remediation/cognito_remediation.py +2 -2
- runbooks/remediation/dynamodb_remediation.py +2 -2
- runbooks/remediation/ec2_remediation.py +2 -2
- runbooks/remediation/kms_remediation.py +2 -2
- runbooks/remediation/lambda_remediation.py +2 -2
- runbooks/remediation/rds_remediation.py +2 -2
- runbooks/remediation/s3_remediation.py +1 -1
- runbooks/vpc/cloudtrail_audit_integration.py +1 -1
- {runbooks-1.1.9.dist-info → runbooks-1.1.10.dist-info}/METADATA +74 -4
- {runbooks-1.1.9.dist-info → runbooks-1.1.10.dist-info}/RECORD +106 -100
- runbooks/__init__.py.backup +0 -134
- {runbooks-1.1.9.dist-info → runbooks-1.1.10.dist-info}/WHEEL +0 -0
- {runbooks-1.1.9.dist-info → runbooks-1.1.10.dist-info}/entry_points.txt +0 -0
- {runbooks-1.1.9.dist-info → runbooks-1.1.10.dist-info}/licenses/LICENSE +0 -0
- {runbooks-1.1.9.dist-info → runbooks-1.1.10.dist-info}/top_level.txt +0 -0
@@ -9,15 +9,23 @@ AWS Identity Center (formerly AWS SSO) user management. It's designed for enterp
|
|
9
9
|
identity and access management teams who need complete visibility into user distribution,
|
10
10
|
access patterns, and identity governance across large-scale multi-account deployments.
|
11
11
|
|
12
|
+
**AWS API Mapping**: `iam.list_users()`, `identitystore.list_users()`, `sso-admin.list_instances()`
|
13
|
+
|
12
14
|
Key Features:
|
13
15
|
- Multi-account user discovery using assume role capabilities across AWS Organizations
|
14
16
|
- Dual identity source support: IAM users and AWS Identity Center users
|
15
17
|
- Comprehensive user metadata extraction with last access tracking
|
16
18
|
- Cross-account user enumeration with organizational hierarchy mapping
|
17
19
|
- Identity Center directory deduplication for efficient discovery
|
18
|
-
-
|
20
|
+
- Multi-format export (JSON, CSV, Markdown, Table)
|
19
21
|
- Profile-based authentication with support for federated access
|
20
22
|
|
23
|
+
Architecture (v1.1.10):
|
24
|
+
- Group-level with --all-profiles pattern (Option B)
|
25
|
+
- Shared utilities integration (organizations_utils.py + output_formatters.py)
|
26
|
+
- Modern CLI + Legacy Python Main dual compatibility
|
27
|
+
- Rich CLI output with enterprise UX standards
|
28
|
+
|
21
29
|
Enterprise Use Cases:
|
22
30
|
- Identity governance and user access auditing across organizations
|
23
31
|
- User lifecycle management and access certification processes
|
@@ -70,8 +78,8 @@ Dependencies:
|
|
70
78
|
- boto3/botocore for AWS IAM and Identity Center API interactions
|
71
79
|
- ArgumentsClass for standardized CLI argument parsing
|
72
80
|
- Inventory_Modules for common utility functions and credential management
|
73
|
-
-
|
74
|
-
-
|
81
|
+
- Rich CLI for enhanced output formatting
|
82
|
+
- Progress bars for discovery tracking
|
75
83
|
|
76
84
|
Compliance and Audit Features:
|
77
85
|
- Comprehensive user discovery for identity governance auditing
|
@@ -80,6 +88,29 @@ Compliance and Audit Features:
|
|
80
88
|
- Identity lifecycle tracking for governance and compliance management
|
81
89
|
- User attribute and metadata extraction for compliance reporting
|
82
90
|
|
91
|
+
Example (Modern CLI):
|
92
|
+
Multi-account user discovery:
|
93
|
+
```bash
|
94
|
+
runbooks inventory --all-profiles $MANAGEMENT_PROFILE list-org-users
|
95
|
+
```
|
96
|
+
|
97
|
+
Brief listing with timing:
|
98
|
+
```bash
|
99
|
+
runbooks inventory --profile mgmt list-org-users --short --timing
|
100
|
+
```
|
101
|
+
|
102
|
+
Identity Center only:
|
103
|
+
```bash
|
104
|
+
runbooks inventory --profile mgmt list-org-users --idc --export-format csv
|
105
|
+
```
|
106
|
+
|
107
|
+
Example (Legacy Python Main):
|
108
|
+
```bash
|
109
|
+
python src/runbooks/inventory/list_org_accounts_users.py --profile my-org-profile
|
110
|
+
python src/runbooks/inventory/list_org_accounts_users.py --profile my-profile --idc
|
111
|
+
python src/runbooks/inventory/list_org_accounts_users.py --rootonly --iam
|
112
|
+
```
|
113
|
+
|
83
114
|
Future Enhancements:
|
84
115
|
- Multi-threading for improved performance across large organizations
|
85
116
|
- User access pattern analysis and behavioral analytics
|
@@ -87,28 +118,33 @@ Future Enhancements:
|
|
87
118
|
- User optimization recommendations for identity governance
|
88
119
|
|
89
120
|
Author: AWS CloudOps Team
|
90
|
-
Version:
|
121
|
+
Version: 1.1.10 (v1.1.10 parameter patterns + shared utilities)
|
91
122
|
"""
|
92
123
|
|
93
124
|
import logging
|
94
125
|
import sys
|
95
126
|
from os.path import split
|
96
127
|
from time import time
|
128
|
+
from typing import Dict, List, Optional
|
97
129
|
|
98
|
-
from ArgumentsClass import CommonArguments
|
130
|
+
from runbooks.inventory.ArgumentsClass import CommonArguments
|
99
131
|
from botocore.exceptions import ClientError
|
100
|
-
from runbooks.common.rich_utils import console
|
101
|
-
from
|
132
|
+
from runbooks.common.rich_utils import console, print_header, print_success, print_error, print_info
|
133
|
+
from runbooks.inventory.inventory_modules import (
|
102
134
|
display_results,
|
103
135
|
find_iam_users2,
|
104
136
|
find_idc_directory_id2,
|
105
137
|
find_idc_users2,
|
106
138
|
get_all_credentials,
|
107
139
|
)
|
140
|
+
from runbooks import __version__
|
141
|
+
|
142
|
+
logger = logging.getLogger(__name__)
|
143
|
+
|
144
|
+
# Terminal control constants
|
145
|
+
ERASE_LINE = '\x1b[2K'
|
108
146
|
# Migrated to Rich.Progress - see rich_utils.py for enterprise UX standards
|
109
|
-
# from tqdm.auto import tqdm
|
110
147
|
|
111
|
-
__version__ = "2024.05.09"
|
112
148
|
begin_time = time()
|
113
149
|
|
114
150
|
|
@@ -62,15 +62,15 @@ from queue import Queue
|
|
62
62
|
from threading import Thread
|
63
63
|
from time import time
|
64
64
|
|
65
|
-
import Inventory_Modules
|
66
|
-
from ArgumentsClass import CommonArguments
|
65
|
+
from runbooks.inventory import inventory_modules as Inventory_Modules
|
66
|
+
from runbooks.inventory.ArgumentsClass import CommonArguments
|
67
67
|
from botocore.exceptions import ClientError
|
68
68
|
from runbooks.common.rich_utils import console
|
69
|
-
from
|
69
|
+
from runbooks.inventory.inventory_modules import display_results, find_account_rds_instances2, get_all_credentials
|
70
70
|
from runbooks.common.rich_utils import create_progress_bar
|
71
|
+
from runbooks import __version__
|
71
72
|
|
72
73
|
|
73
|
-
__version__ = "2025.04.09"
|
74
74
|
|
75
75
|
|
76
76
|
##################
|
@@ -55,12 +55,12 @@ from queue import Queue
|
|
55
55
|
from threading import Thread
|
56
56
|
from time import time
|
57
57
|
|
58
|
-
from ArgumentsClass import CommonArguments
|
58
|
+
from runbooks.inventory.ArgumentsClass import CommonArguments
|
59
59
|
from botocore.exceptions import ClientError
|
60
60
|
from runbooks.common.rich_utils import console
|
61
|
-
from
|
61
|
+
from runbooks.inventory.inventory_modules import display_results, find_private_hosted_zones2, get_all_credentials
|
62
|
+
from runbooks import __version__
|
62
63
|
|
63
|
-
__version__ = "2023.11.08"
|
64
64
|
|
65
65
|
########################
|
66
66
|
|
@@ -93,15 +93,15 @@ from queue import Queue
|
|
93
93
|
from threading import Thread
|
94
94
|
from time import time
|
95
95
|
|
96
|
-
import Inventory_Modules
|
97
|
-
from account_class import aws_acct_access
|
98
|
-
from ArgumentsClass import CommonArguments
|
96
|
+
from runbooks.inventory import inventory_modules as Inventory_Modules
|
97
|
+
from runbooks.inventory.account_class import aws_acct_access
|
98
|
+
from runbooks.inventory.ArgumentsClass import CommonArguments
|
99
99
|
from botocore.exceptions import ClientError, ProfileNotFound, UnknownCredentialError, UnknownRegionError
|
100
100
|
from runbooks.common.rich_utils import console
|
101
|
-
from
|
101
|
+
from runbooks.inventory.inventory_modules import display_results
|
102
102
|
from runbooks.common.rich_utils import create_progress_bar
|
103
|
+
from runbooks import __version__
|
103
104
|
|
104
|
-
__version__ = "2023.08.09"
|
105
105
|
|
106
106
|
parser = CommonArguments()
|
107
107
|
parser.singleprofile()
|
@@ -66,13 +66,13 @@ from queue import Queue
|
|
66
66
|
from threading import Thread
|
67
67
|
from time import time
|
68
68
|
|
69
|
-
import Inventory_Modules
|
70
|
-
from ArgumentsClass import CommonArguments
|
69
|
+
from runbooks.inventory import inventory_modules as Inventory_Modules
|
70
|
+
from runbooks.inventory.ArgumentsClass import CommonArguments
|
71
71
|
from botocore.exceptions import ClientError
|
72
72
|
from runbooks.common.rich_utils import console
|
73
|
-
from
|
73
|
+
from runbooks.inventory.inventory_modules import display_results, get_all_credentials
|
74
|
+
from runbooks import __version__
|
74
75
|
|
75
|
-
__version__ = "2023.11.08"
|
76
76
|
begin_time = time()
|
77
77
|
|
78
78
|
|
@@ -62,14 +62,17 @@ from datetime import datetime, timedelta, timezone
|
|
62
62
|
from os.path import split
|
63
63
|
from time import time
|
64
64
|
|
65
|
-
from ArgumentsClass import CommonArguments
|
65
|
+
from runbooks.inventory.ArgumentsClass import CommonArguments
|
66
66
|
from botocore.exceptions import ClientError
|
67
67
|
from runbooks.common.rich_utils import console
|
68
|
-
from
|
68
|
+
from runbooks.inventory.inventory_modules import display_results, find_ssm_parameters2, get_all_credentials
|
69
|
+
from runbooks import __version__
|
69
70
|
|
70
|
-
__version__ = "2024.05.07"
|
71
71
|
begin_time = time()
|
72
72
|
|
73
|
+
# ANSI escape sequence for terminal line clearing in progress display
|
74
|
+
ERASE_LINE = "\x1b[2K"
|
75
|
+
|
73
76
|
|
74
77
|
##################
|
75
78
|
# Functions
|
@@ -73,13 +73,17 @@ from queue import Queue
|
|
73
73
|
from threading import Thread
|
74
74
|
from time import time
|
75
75
|
|
76
|
-
import Inventory_Modules
|
77
|
-
from ArgumentsClass import CommonArguments
|
76
|
+
from runbooks.inventory import inventory_modules as Inventory_Modules
|
77
|
+
from runbooks.inventory.ArgumentsClass import CommonArguments
|
78
78
|
from botocore.exceptions import ClientError
|
79
79
|
from runbooks.common.rich_utils import console
|
80
|
-
from
|
80
|
+
from runbooks.inventory.inventory_modules import display_results, get_all_credentials
|
81
|
+
from runbooks import __version__
|
81
82
|
|
82
|
-
|
83
|
+
|
84
|
+
|
85
|
+
# Terminal control constants
|
86
|
+
ERASE_LINE = '\x1b[2K'
|
83
87
|
|
84
88
|
# TODO: Add Elastic IPs to this script as well.
|
85
89
|
|
runbooks/inventory/list_vpcs.py
CHANGED
@@ -8,6 +8,13 @@ filtering for default VPCs to identify potential security risks.
|
|
8
8
|
|
9
9
|
**AWS API Mapping**: `boto3.client('ec2').describe_vpcs()`
|
10
10
|
|
11
|
+
.. TODO v1.1.11: Performance optimization for large-scale VPC discovery
|
12
|
+
- Current: Timeouts at 540s for AWS Organizations with 100+ accounts
|
13
|
+
- Root Cause: Threading pool size (max 25) insufficient for large-scale discovery
|
14
|
+
- Improvement: Dynamic ThreadPoolExecutor sizing + concurrent pagination
|
15
|
+
- Target: Complete VPC discovery in <120s for 100+ accounts across 16 regions
|
16
|
+
- Reference: FinOps proven pattern (optimal_workers = min(accounts * regions, 50))
|
17
|
+
|
11
18
|
Features:
|
12
19
|
- Multi-account VPC discovery via AWS Organizations
|
13
20
|
- Default VPC identification for security auditing
|
@@ -59,13 +66,17 @@ from queue import Queue
|
|
59
66
|
from threading import Thread
|
60
67
|
from time import time
|
61
68
|
|
62
|
-
import Inventory_Modules
|
63
|
-
from ArgumentsClass import CommonArguments
|
69
|
+
from runbooks.inventory import inventory_modules as Inventory_Modules
|
70
|
+
from runbooks.inventory.ArgumentsClass import CommonArguments
|
64
71
|
from botocore.exceptions import ClientError
|
65
|
-
from
|
72
|
+
from runbooks.inventory.inventory_modules import display_results, get_all_credentials
|
66
73
|
from runbooks.common.rich_utils import console
|
74
|
+
from runbooks import __version__
|
75
|
+
|
76
|
+
|
67
77
|
|
68
|
-
|
78
|
+
# Terminal control constants
|
79
|
+
ERASE_LINE = '\x1b[2K'
|
69
80
|
|
70
81
|
|
71
82
|
##########################
|
@@ -40,6 +40,9 @@ import boto3
|
|
40
40
|
from botocore.exceptions import ClientError
|
41
41
|
|
42
42
|
from runbooks.common.rich_utils import (
|
43
|
+
|
44
|
+
|
45
|
+
# Terminal control constants
|
43
46
|
console,
|
44
47
|
print_header,
|
45
48
|
print_success,
|
@@ -50,6 +53,9 @@ from runbooks.common.rich_utils import (
|
|
50
53
|
STATUS_INDICATORS,
|
51
54
|
)
|
52
55
|
|
56
|
+
|
57
|
+
# Terminal control constants
|
58
|
+
ERASE_LINE = '\x1b[2K'
|
53
59
|
logger = logging.getLogger(__name__)
|
54
60
|
|
55
61
|
|
@@ -40,6 +40,9 @@ from ..utils.logger import configure_logger
|
|
40
40
|
from ..common.performance_optimization_engine import get_optimization_engine
|
41
41
|
from ..common.rich_utils import console, Progress
|
42
42
|
|
43
|
+
|
44
|
+
# Terminal control constants
|
45
|
+
ERASE_LINE = '\x1b[2K'
|
43
46
|
logger = configure_logger(__name__)
|
44
47
|
|
45
48
|
# Global Organizations cache to prevent duplicate API calls across all instances
|
@@ -71,6 +74,7 @@ def _set_global_organizations_cache(data):
|
|
71
74
|
# Universal AWS Environment Profile Support (Compatible with ANY AWS Setup)
|
72
75
|
import os
|
73
76
|
|
77
|
+
|
74
78
|
ENTERPRISE_PROFILES = {
|
75
79
|
"BILLING_PROFILE": os.getenv("BILLING_PROFILE", "default"), # Universal compatibility
|
76
80
|
"MANAGEMENT_PROFILE": os.getenv("MANAGEMENT_PROFILE", "default"), # Works with any profile
|
@@ -1414,7 +1418,13 @@ if __name__ == "__main__":
|
|
1414
1418
|
description="Enhanced Organizations Discovery Engine with 4-Profile AWS SSO Architecture"
|
1415
1419
|
)
|
1416
1420
|
parser.add_argument(
|
1421
|
+
"--profile",
|
1422
|
+
help=f"AWS profile for single account operations (default: {ENTERPRISE_PROFILES['SINGLE_ACCOUNT_PROFILE']})",
|
1423
|
+
)
|
1424
|
+
parser.add_argument(
|
1425
|
+
"--all-profile",
|
1417
1426
|
"--management-profile",
|
1427
|
+
dest="management_profile",
|
1418
1428
|
help=f"AWS profile with Organizations access (default: {ENTERPRISE_PROFILES['MANAGEMENT_PROFILE']})",
|
1419
1429
|
)
|
1420
1430
|
parser.add_argument(
|
@@ -1441,19 +1451,23 @@ if __name__ == "__main__":
|
|
1441
1451
|
args = parser.parse_args()
|
1442
1452
|
|
1443
1453
|
async def main():
|
1454
|
+
# Use --profile as fallback for single-account mode
|
1455
|
+
single_account = args.single_account_profile or args.profile
|
1456
|
+
management = args.management_profile or args.profile
|
1457
|
+
|
1444
1458
|
if args.legacy:
|
1445
1459
|
console.print("[yellow]⚠️ Using legacy compatibility mode[/yellow]")
|
1446
1460
|
results = await run_organizations_discovery(
|
1447
|
-
management_profile=
|
1461
|
+
management_profile=management or ENTERPRISE_PROFILES["MANAGEMENT_PROFILE"],
|
1448
1462
|
billing_profile=args.billing_profile or ENTERPRISE_PROFILES["BILLING_PROFILE"],
|
1449
1463
|
)
|
1450
1464
|
else:
|
1451
1465
|
console.print("[cyan]🚀 Using enhanced 4-profile discovery engine[/cyan]")
|
1452
1466
|
results = await run_enhanced_organizations_discovery(
|
1453
|
-
management_profile=
|
1467
|
+
management_profile=management,
|
1454
1468
|
billing_profile=args.billing_profile,
|
1455
1469
|
operational_profile=args.operational_profile,
|
1456
|
-
single_account_profile=
|
1470
|
+
single_account_profile=single_account,
|
1457
1471
|
performance_target_seconds=args.performance_target,
|
1458
1472
|
)
|
1459
1473
|
|