Created
November 22, 2021 21:47
-
-
Save stewmi/665cdd6135d006347ff41c1885e2e1df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import json | |
orgs = boto3.client("organizations") | |
paginator = orgs.get_paginator('list_policies') | |
page_iterator = paginator.paginate(Filter="SERVICE_CONTROL_POLICY") | |
for page in page_iterator: | |
for policy in page['Policies']: | |
policy_desc = orgs.describe_policy(PolicyId=policy['Id']) | |
with open('{}.json'.format(policy['Name']), 'w') as f: | |
json.dump(json.loads(policy_desc['Policy']['Content']), f, ensure_ascii=False, indent=4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment