diff --git a/local-app/python-tools/cross-organization/tag-checker/generate-aws-service-map.py b/local-app/python-tools/cross-organization/tag-checker/generate-aws-service-map.py new file mode 100755 index 00000000..f38023e8 --- /dev/null +++ b/local-app/python-tools/cross-organization/tag-checker/generate-aws-service-map.py @@ -0,0 +1,46 @@ +#!/bin/env python + +import requests +import json +import re + +__version__ = "1.0.0" + +def fetch_aws_service_data(): + """ + Fetches the list of service prefixes and friendly names from + AWS Policy Sentry's maintained data (official-ish source of truth). + """ + print("[*] Fetching latest AWS service metadata...") + # This URL points to a well-maintained community list derived from IAM docs + url = "https://raw.githubusercontent.com/salesforce/policy_sentry/master/policy_sentry/shared/data/iam-definition.json" + + try: + response = requests.get(url, timeout=10) + response.raise_for_status() + data = response.json() + + service_map = {} + for service in data: + prefix = service.get('prefix') + name = service.get('service_name') + if prefix and name: + service_map[prefix] = name + + return service_map + except Exception as e: + print(f"[!] Failed to fetch data: {e}") + return None + +def main(): + service_map = fetch_aws_service_data() + if service_map: + output_file = "aws_service_map.json" + with open(output_file, 'w') as f: + json.dump(service_map, f, indent=4) + print(f"[+] Successfully generated {output_file} with {len(service_map)} services.") + else: + print("[!] Could not generate map.") + +if __name__ == "__main__": + main()