从客户管理 Amazon Config 的配置记录器开始,使用 Amazon CLI - Amazon Config
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

从客户管理 Amazon Config 的配置记录器开始,使用 Amazon CLI

您可以先 Amazon Config 创建客户管理的配置记录器。要使用创建客户管理的配置记录器 Amazon CLI,请使用以下命令:put-configuration-recorderput-delivery-channel、和start-configuration-recorder

  • put-configuration-recorder命令创建客户托管的配置记录器。

  • put-delivery-channel命令创建一个传递渠道,用于向 S3 存储桶和SNS主题 Amazon Config 传送配置信息。

  • start-configuration-recorder启动客户管理的配置记录器。客户管理的配置记录器将开始记录您指定资源类型的配置更改。

注意事项

S3 存储桶、SNS主题和IAM角色为必填项

要创建客户托管的配置记录器,您需要创建一个 S3 存储桶、一个SNS主题和一个将附加策略作为先决条件的IAM角色。要设置的先决条件 Amazon Config,请参阅先决条件

每个区域每个账户一个客户管理的配置记录器

每 Amazon Web Services 账户 台只能有一个客户管理的配置记录器 Amazon Web Services 区域。

每个地区每个账户一个配送渠道

每个 Amazon Web Services 账户 配送渠道区域只能有一个配送渠道区域 Amazon Web Services 区域。

政策与合规结果

IAM在中管理的@@ 策略和其他策略 Amazon Organizations可能会影响是否 Amazon Config 有权记录资源的配置更改。此外,规则会直接评估资源的配置,而规则在运行评估时不考虑这些策略。确保现行政策与您打算使用的方式保持一致 Amazon Config。

第 1 步:运行 put-configuration-recorder

使用put-configuration-recorder命令创建客户托管的配置记录器:

此命令使用 --configuration-recorder---recording-group 字段。

$ aws configservice put-configuration-recorder \ --configuration-recorder file://configurationRecorder.json \ --recording-group file://recordingGroup.json

configuration-recorder领域

configurationRecorder.json 文件指定配置记录器的 nameroleArn 以及默认记录频率(recordingMode)。您也可以使用此字段来覆盖特定资源类型的录制频率。

{ "name": "default", "roleARN": "arn:aws:iam::123456789012:role/config-role", "recordingMode": { "recordingFrequency": CONTINUOUS or DAILY, "recordingModeOverrides": [ { "description": "Description you provide for the override", "recordingFrequency": CONTINUOUS or DAILY, "resourceTypes": [ Comma-separated list of resource types to include in the override ] } ] } }

recording-group领域

recordingGroup.json文件指定要记录哪些资源类型。

{ "allSupported": boolean, "exclusionByResourceTypes": { "resourceTypes": [ Comma-separated list of resource types to exclude ] }, "includeGlobalResourceTypes": boolean, "recordingStrategy": { "useOnly": "Recording strategy for the configuration recorder" }, "resourceTypes": [ Comma-separated list of resource types to include] }

有关这些字段的更多信息,请参阅《Amazon CLI 命令参考put-configuration-recorder中的。

步骤 2:运行 put-delivery-channel命令

使用put-delivery-channel命令创建传送渠道:

此命令使用字--delivery-channel段。

$ aws configservice put-delivery-channel --delivery-channel file://deliveryChannel.json

delivery-channel领域

deliveryChannel.json文件指定了以下内容:

  • name用于配送渠道。

  • Amazon Config 发送配置快照s3BucketName的地方。

  • Amazon Config 发送通知snsTopicARN的地点

  • 它设置configSnapshotDeliveryProperties了 Amazon Config 提供配置快照的频率以及它为定期规则调用评估的频率。

{ "name": "default", "s3BucketName": "config-bucket-123456789012", "snsTopicARN": "arn:aws:sns:us-east-1:123456789012:config-topic", "configSnapshotDeliveryProperties": { "deliveryFrequency": "Twelve_Hours" } }

有关这些字段的更多信息,请参阅《Amazon CLI 命令参考put-delivery-channel中的。

步骤 3:运行 start-configuration-recorder命令

使用start-configuration-recorder命令启动 Amazon Config:

$ aws configservice start-configuration-recorder --configuration-recorder-name configRecorderName

有关这些字段的更多信息,请参阅《Amazon CLI 命令参考start-configuration-recorder中的。