“AWS Config” 是 AWS 上一个管理和监视 AWS 资源配置的服务。用户可以使用 AWS Config 规则定义他们要求的预期配置,并通过 Amazon S3 存储与 AWS 资源相关的配置更改历史记录,以查找配置更改情况,以及分析和审计 AWS 资源配置的变化情况。在 AWS Config 中,用户还可以找到不符合其定义的配置规则的 AWS 资源(非符合性资源)。以下是在 AWS Config 中导出非符合性资源的详细步骤和 Python 代码示例:
import boto3
from botocore.exceptions import ClientError
def export_non_compliance_resources():
AWS_CONFIG_S3_BUCKET = 'your-s3-bucket-name'
AWS_CONFIG_SNS_TOPIC_ARN = 'your-sns-topic-arn'
client = boto3.client('config')
response = client.start_export_task(
ConfigurationSnapshotDeliveryProperties={
'deliveryFrequency': 'TwentyFour_Hours'
},
S3Destination={
'bucket': AWS_CONFIG_S3_BUCKET,
'prefix': 'config/history',
'format': 'CSV'
},
Filters={
'ResourceType': 'AWS::AllSupported',
'ComplianceType': 'NON_COMPLIANT'
},
IncludedDeletedResources=True
上一篇:AWS-Cognito和Shibboleth之间有什么区别?
下一篇:aws-controltower-GuardrailsComplianceAggregator无法访问已注册账户的配置数据。