in aws_sra_examples/utils/aws_control_tower/helper_scripts/list_config_recorder_status.py [0:0]
def get_config_recorder_status():
"""
get_config_recorder_status
:return:
"""
try:
account_ids = get_all_organization_accounts(False, "")
available_regions = get_available_service_regions("", "config", True)
account_set = set()
processes = []
if MAX_THREADS > len(account_ids):
thread_cnt = len(account_ids) - 2
else:
thread_cnt = MAX_THREADS
with ThreadPoolExecutor(max_workers=thread_cnt) as executor:
for account_id in account_ids:
try:
processes.append(executor.submit(
get_account_config,
account_id,
available_regions
))
except Exception as error:
LOGGER.error(f"{error}")
continue
for task in as_completed(processes, timeout=300):
account_id, all_regions_enabled, enabled_regions, not_enabled_regions = task.result()
LOGGER.info(f"Account ID: {account_id}")
LOGGER.info(f"Regions Enabled = {enabled_regions}")
LOGGER.info(f"Regions Not Enabled = {not_enabled_regions}\n")
if not all_regions_enabled:
account_set.add(account_id)
LOGGER.info(f'!!! Accounts to exclude from Organization Conformance Packs: {",".join(list(account_set))}')
except Exception as error:
LOGGER.error(f"{error}")
exit(1)