管理配置记录器 - Amazon Config
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
  1. 登录 Amazon Web Services Management Console 并打开 Amazon Config 控制台,网址为 https://console.aws.amazon.com/config/

  2. 在导航窗格中,选择设置

  3. 停止或启动配置记录器:

    • 如果您要停止记录,请选择 Recording is on 下的 Turn off。系统提示时,请选择继续

    • 如果您要开始记录,请选择 Recording is off (记录已关闭) 下的 Turn on (开启)。系统提示时,请选择继续

To change the recording frequency

Amazon Config 支持连续录制每日录制。连续记录可让您在每次发生配置更改时连续记录更改。使用每日记录,您将收到代表过去 24 小时内资源的最新状态的配置项 (CI),前提是它与之前记录的 CI 不同。有关更多信息,请参阅记录频率

  1. 登录 Amazon Web Services Management Console 并打开 Amazon Config 控制台,网址为 https://console.aws.amazon.com/config/

  2. 在导航窗格中,选择设置

  3. 选择编辑,以查看“记录频率”下的选项。

管理配置记录器 (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文件指定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 ] } ] } }

put-configuration-recorder 使用 --configuration-recorder 参数的以下字段:

  • name— 配置记录器的名称。 Amazon Config 创建配置记录器时会自动分配 “默认” 的名称。

  • roleARN— 由配置记录器担任 Amazon Config 和使用的 IAM 角色的 Amazon 资源名称 (ARN)。

  • recordingMode— 指定用于记录配置更改的 Amazon Config 默认录制频率。 Amazon Config 支持连续录制每日录制。连续记录可让您在每次发生配置更改时连续记录更改。使用每日记录,您将收到代表过去 24 小时内资源的最新状态的配置项 (CI),前提是它与之前记录的 CI 不同。

    • recordingFrequency— Amazon Config 用于记录配置更改的默认录制频率。

      注意

      Amazon Firewall Manager 依赖于持续录制来监控您的资源。如果您使用的是 Firewall Manager,建议您将记录频率设置为“持续”。

    • recordingModeOverrides – 此字段允许您为记录模式指定覆盖。它是一个 recordingModeOverride 对象数组。recordingModeOverrides 数组中的每个 recordingModeOverride 对象都由三个字段组成:

      • description – 您为覆盖提供的描述。

      • recordingFrequency – 将应用于覆盖中指定的所有资源类型的记录频率。

      • resourceTypes— 以逗号分隔的列表,用于指定覆盖中 Amazon Config 包含哪些资源类型。

注意

必填字段和可选字段

put-configuration-recorderrecordingMode 字段是可选的。默认情况下,配置记录器的记录频率被设置为连续记录。

注意

限制

以下资源类型不支持每日记录:

  • 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

要更改配置记录器的名称,您必须删除该配置记录器,然后使用所需名称创建一个新配置记录器。

  1. 使用 describe-configuration-recorders 命令查找当前配置记录器的名称:

    $ aws configservice describe-configuration-recorders { "ConfigurationRecorders": [ { "roleARN": "arn:aws:iam::012345678912:role/myConfigRole", "name": "default" } ] }
  2. 使用 delete-configuration-recorder 命令删除当前配置记录器:

    $ aws configservice delete-configuration-recorder --configuration-recorder-name default
  3. 使用 put-configuration-recorder 命令创建具有所需名称的配置记录器:

    $ aws configservice put-configuration-recorder --configuration-recorder name=configRecorderName,roleARN=arn:aws:iam::012345678912:role/myConfigRole
  4. 使用 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 资源类型的记录不收取额外费用。