Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅
中国的 Amazon Web Services 服务入门
(PDF)。
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
管理配置记录器
Amazon Config 使用配置记录器来检测资源配置中的更改,并将这些更改捕获为配置项目。必须先创建配置记录器,然后 Amazon Config 才能跟踪资源配置。
如果您使用控制台或 Amazon CLI Amazon Config 进行设置,则 Amazon Config 会自动为您创建配置记录器,然后启动配置记录器。有关更多信息,请参阅入门 Amazon Config。
默认情况下,配置记录器会记录 Amazon Config 运行的区域内所有受支持的资源。您可以创建一个自定义配置记录器,仅记录您指定的资源类型。有关更多信息,请参阅选择 Amazon Config 记录哪些资源。
Amazon Config 开始记录配置时,您需要支付服务使用费。有关定价信息,请参阅 Amazon Config 定价。
启动配置记录器时, Amazon Config 会清点您账户中的所有 Amazon 资源。
如果配置记录器关闭,已删除资源的评估结果可能会持续显示
如果配置记录器已关闭,它将禁用跟踪资源配置更改(包括资源删除)的功能。 Amazon Config 这意味着,如果您关闭配置记录器,可能会看到先前已删除的资源的评估结果。
管理配置记录器 (控制台)
您可以使用 Amazon Config 控制台停止或启动配置记录器。您也可以更改配置记录器的记录频率。
- To stop or start the configuration recorder
-
- To change the recording frequency
-
Amazon Config 支持连续录制和每日录制。连续记录可让您在每次发生配置更改时连续记录更改。使用每日记录,您将收到代表过去 24 小时内资源的最新状态的配置项 (CI),前提是它与之前记录的 CI 不同。有关更多信息,请参阅记录频率。
管理配置记录器 (Amazon CLI)
您可以使用 Amazon CLI 来停止或启动配置记录器。您也可以使用 Amazon CLI、 Amazon Config API 或其中一个 Amazon SDK 重命名或删除配置记录器。以下步骤可帮助您使用 Amazon CLI。
- To stop the configuration recorder
-
使用 stop-configuration-recorder
命令:
$ aws configservice stop-configuration-recorder --configuration-recorder-name configRecorderName
- To start the configuration recorder
-
使用 start-configuration-recorder
命令:
$ aws configservice start-configuration-recorder --configuration-recorder-name configRecorderName
- To change the recording frequency
-
使用 put-configuration-recorder
命令更改配置记录器的记录频率:
$ aws configservice put-configuration-recorder \
--configuration-recorder file://configurationRecorder.json
该configurationRecorder.json
文件指定name
和roleArn
以及配置记录器的默认录制频率 (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
]
}
]
}
}
put-configuration-recorder
使用 --configuration-recorder
参数的以下字段:
name
— 配置记录器的名称。 Amazon Config 创建配置记录器时会自动分配 “默认” 的名称。
roleARN
— 由配置记录器担任 Amazon Config 和使用的 IAM 角色的 Amazon 资源名称 (ARN)。
recordingMode
— 指定用于记录配置更改的 Amazon Config 默认录制频率。 Amazon Config 支持连续录制和每日录制。连续记录可让您在每次发生配置更改时连续记录更改。使用每日记录,您将收到代表过去 24 小时内资源的最新状态的配置项 (CI),前提是它与之前记录的 CI 不同。
限制
以下资源类型不支持每日记录:
AWS::Config::ResourceCompliance
AWS::Config::ConformancePackCompliance
AWS::Config::ConfigurationRecorder
对于记录所有当前和未来支持的资源类型 (ALL_SUPPORTED_RESOURCE_TYPES
) 记录策略,这些资源类型将设置为“连续记录”。
- To delete the configuration recorder
-
使用 delete-configuration-recorder
命令:
$ aws configservice delete-configuration-recorder --configuration-recorder-name default
- To rename the configuration recorder
-
要更改配置记录器的名称,您必须删除该配置记录器,然后使用所需名称创建一个新配置记录器。
-
使用 describe-configuration-recorders
命令查找当前配置记录器的名称:
$ aws configservice describe-configuration-recorders
{
"ConfigurationRecorders": [
{
"roleARN": "arn:aws:iam::012345678912:role/myConfigRole",
"name": "default"
}
]
}
-
使用 delete-configuration-recorder
命令删除当前配置记录器:
$ aws configservice delete-configuration-recorder --configuration-recorder-name default
-
使用 put-configuration-recorder
命令创建具有所需名称的配置记录器:
$ aws configservice put-configuration-recorder --configuration-recorder name=configRecorderName
,roleARN=arn:aws:iam::012345678912:role/myConfigRole
-
使用 start-configuration-recorder
命令恢复记录:
$ aws configservice start-configuration-recorder --configuration-recorder-name configRecorderName
配置记录器的偏离检测
AWS::Config::ConfigurationRecorder
资源类型是配置记录器的配置项 (CI),用于跟踪配置记录器的所有状态更改。您可以使用此 CI 来检查配置记录器的状态是否与其先前的状态不同或已经偏离。例如,此 CI 会跟踪您是否允许 Amazon Config 跟踪资源类型更新、是否已停止或启动配置记录器,或者是否删除或卸载了配置记录器。发生偏离的配置记录器表示您没有准确检测到预期资源类型的更改。如果您的配置记录器发生偏离,则可能导致漏报或误报合规性结果。
AWS::Config::ConfigurationRecorder
资源类型是系统资源类型,默认情况下 Amazon Config ,所有支持的区域都启用了该资源类型的记录。AWS::Config::ConfigurationRecorder
资源类型的记录不收取额外费用。