Last active
August 11, 2020 02:41
-
-
Save mccabe615/e750021a9b714f04eb165f28102619f2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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, json | |
print("Account: ", end = '') | |
print(boto3.client('sts').get_caller_identity()['Account']) | |
client = boto3.client('config') | |
print() | |
print("Getting non-compliant config results") | |
print() | |
paginator = client.get_paginator('describe_compliance_by_config_rule') | |
page_iterator = paginator.paginate(ComplianceTypes=['NON_COMPLIANT']) | |
print('Config results (rule name: count):') | |
print() | |
for page in page_iterator: | |
#print(json.dumps(page)) | |
for result in page['ComplianceByConfigRules']: | |
print(result['ConfigRuleName'] + ": ", end = '') | |
print(result['Compliance']['ComplianceContributorCount']['CappedCount']) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment