

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 從使用 AWS Config 的客戶受管組態記錄器開始 AWS CLI
<a name="gs-cli-subscribe"></a>

您可以從建立客戶受管組態記錄器 AWS Config 開始。若要使用 建立客戶受管組態記錄器 AWS CLI，請使用下列命令：[https://docs.aws.amazon.com/cli/latest/reference/configservice/put-configuration-recorder.html](https://docs.aws.amazon.com/cli/latest/reference/configservice/put-configuration-recorder.html)、 [https://docs.aws.amazon.com/cli/latest/reference/configservice/put-delivery-channel.html](https://docs.aws.amazon.com/cli/latest/reference/configservice/put-delivery-channel.html)和 [https://docs.aws.amazon.com/cli/latest/reference/configservice/start-configuration-recorder.html](https://docs.aws.amazon.com/cli/latest/reference/configservice/start-configuration-recorder.html)。
+ `put-configuration-recorder` 命令會建立客戶受管組態記錄器。
+ `put-delivery-channel` 命令會建立交付管道，其中 會將組態資訊 AWS Config 交付至 S3 儲存貯體和 SNS 主題。
+ 會`start-configuration-recorder`啟動客戶受管組態記錄器。客戶受管組態記錄器將開始記錄您指定資源類型的組態變更。

**Topics**
+ [考量事項](#gs-cli-subscribe-considerations)
+ [步驟 1：執行 put-configuration-recorder](#gs-cli-subscribe-put-configuration-recorder)
+ [步驟 2：執行 put-delivery-channel 命令](#gs-cli-subscribe-put-delivery-channel)
+ [步驟 3：執行 start-configuration-recorder 命令](#gs-cli-subscribe-start-configuration-recorder)

## 考量事項
<a name="gs-cli-subscribe-considerations"></a>

**需要 S3 儲存貯體、SNS 主題和 IAM 角色**

若要建立客戶受管組態記錄器，您需要建立 S3 儲存貯體、SNS 主題，以及連接政策做為先決條件的 IAM 角色。若要設定 的先決條件 AWS Config，請參閱[先決條件](https://docs.aws.amazon.com/config/latest/developerguide/gs-cli-prereq.html)。

**每個區域每個帳戶一個客戶受管組態記錄器**

 AWS 帳戶 每個 的每個 只能有一個客戶受管組態記錄器 AWS 區域。

**每個區域每個帳戶一個交付管道**

每個 只能有一個交付管道區域 AWS 帳戶 AWS 區域。

**政策和合規結果**

在 中管理的 [IAM 政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html)和其他政策可能會影響 是否 AWS Config 具有記錄資源組態變更的許可。 [AWS Organizations](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies.html)此外，規則會直接評估資源的組態，而規則在執行評估時不會考慮這些政策。確定有效政策符合您打算使用的方式 AWS Config。

## 步驟 1：執行 put-configuration-recorder
<a name="gs-cli-subscribe-put-configuration-recorder"></a>

使用 [https://docs.aws.amazon.com/cli/latest/reference/configservice/put-configuration-recorder.html](https://docs.aws.amazon.com/cli/latest/reference/configservice/put-configuration-recorder.html)命令來建立客戶受管組態記錄器：

此命令使用 `--configuration-recorder`和 `---recording-group` 欄位。

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

**`configuration-recorder` 欄位**

`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 ]
        }
    ]
  }
}
```

**`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]
}
```

如需這些欄位的詳細資訊，請參閱 *AWS CLI 命令參考*[https://docs.aws.amazon.com/cli/latest/reference/configservice/put-configuration-recorder.html](https://docs.aws.amazon.com/cli/latest/reference/configservice/put-configuration-recorder.html)中的 。

## 步驟 2：執行 put-delivery-channel 命令
<a name="gs-cli-subscribe-put-delivery-channel"></a>

使用 [https://docs.aws.amazon.com/cli/latest/reference/configservice/put-delivery-channel.html](https://docs.aws.amazon.com/cli/latest/reference/configservice/put-delivery-channel.html)命令來建立交付管道：

此命令使用 `--delivery-channel` 欄位。

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

**`delivery-channel` 欄位**

`deliveryChannel.json` 檔案會指定下列項目：
+ 交付管道`name`的 。
+  AWS Config 傳送組態快照`s3BucketName`的 。
+  AWS Config 傳送通知`snsTopicARN`的 位置
+ `configSnapshotDeliveryProperties` 會設定組態快照 AWS Config 的交付頻率，以及它調用定期規則評估的頻率。

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

如需這些欄位的詳細資訊，請參閱 *AWS CLI 命令參考*[https://docs.aws.amazon.com/cli/latest/reference/configservice/put-delivery-channel.html](https://docs.aws.amazon.com/cli/latest/reference/configservice/put-delivery-channel.html)中的 。

## 步驟 3：執行 start-configuration-recorder 命令
<a name="gs-cli-subscribe-start-configuration-recorder"></a>

使用 [https://docs.aws.amazon.com/cli/latest/reference/configservice/start-configuration-recorder.html](https://docs.aws.amazon.com/cli/latest/reference/configservice/start-configuration-recorder.html)命令啟動 AWS Config：

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

如需這些欄位的詳細資訊，請參閱 *AWS CLI 命令參考*[https://docs.aws.amazon.com/cli/latest/reference/configservice/start-configuration-recorder.html](https://docs.aws.amazon.com/cli/latest/reference/configservice/start-configuration-recorder.html)中的 。