

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

# 将 `PutDeliveryChannel` 与 CLI 配合使用
<a name="example_config-service_PutDeliveryChannel_section"></a>

以下代码示例演示如何使用 `PutDeliveryChannel`。

操作示例是大型程序的代码摘录，必须在上下文中运行。在以下代码示例中，您可以查看此操作的上下文：
+  [Config 入门](example_config_service_GettingStarted_053_section.md) 

------
#### [ CLI ]

**Amazon CLI**  
**创建传输通道**  
以下命令以 JSON 代码的形式提供传输通道的设置：  

```
aws configservice put-delivery-channel --delivery-channel {{file://deliveryChannel.json}}
```
`deliveryChannel.json` 文件指定了传输通道的属性：  

```
{
    "name": "default",
    "s3BucketName": "config-bucket-123456789012",
    "snsTopicARN": "arn:aws:sns:us-east-1:123456789012:config-topic",
    "configSnapshotDeliveryProperties": {
        "deliveryFrequency": "Twelve_Hours"
    }
}
```
此示例设置了以下属性：  
`name`——传输通道的名称。默认情况下， Amazon Config 会`default`将名称分配给新的交付渠道。您无法使用命令更新传递渠道名称。`put-delivery-channel`有关更改名称的步骤，请参阅“重命名传输通道”。`s3BucketName`- Amazon Config 向其发送配置快照和配置历史记录文件的 Amazon S3 存储桶的名称。如果您指定的存储桶属于另一个 Amazon 账户，则该存储桶必须具有授予对 Config Amazon 的访问权限的策略。有关更多信息，请参阅 Amazon S3 存储桶的权限。  
`snsTopicARN`-Amazon SNS 主题的亚马逊资源名称 (ARN)， Amazon Config 会向其发送有关配置变更的通知。如果您从其他账户选择主题，则该主题必须具有授予对 Config 的访问权限的策略。 Amazon 有关更多信息，请参阅 Amazon SNS 主题的权限。  
`configSnapshotDeliveryProperties`-包含`deliveryFrequency`属性，该属性设置 Amazon Config 提供配置快照的频率以及它为定期 Config 规则调用评估的频率。  
如果命令成功， Amazon Config 将不返回任何输出。要验证您的配送渠道的设置，请运行 describe-delivery-channels命令。  
+  有关 API 的详细信息，请参阅*Amazon CLI 命令参考[PutDeliveryChannel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/configservice/put-delivery-channel.html)*中的。

------
#### [ PowerShell ]

**适用于 PowerShell V4 的工具**  
**示例 1：此示例更改现有传输通道的 deliveryFrequency 属性。**  

```
Write-CFGDeliveryChannel -ConfigSnapshotDeliveryProperties_DeliveryFrequency TwentyFour_Hours -DeliveryChannelName default -DeliveryChannel_S3BucketName amzn-s3-demo-bucket -DeliveryChannel_S3KeyPrefix my
```
+  有关 API 的详细信息，请参阅 *Amazon Tools for PowerShell Cmdlet 参考 (V* 4) [PutDeliveryChannel](https://docs.amazonaws.cn/powershell/v4/reference)中的。

**适用于 PowerShell V5 的工具**  
**示例 1：此示例更改现有传输通道的 deliveryFrequency 属性。**  

```
Write-CFGDeliveryChannel -ConfigSnapshotDeliveryProperties_DeliveryFrequency TwentyFour_Hours -DeliveryChannelName default -DeliveryChannel_S3BucketName amzn-s3-demo-bucket -DeliveryChannel_S3KeyPrefix my
```
+  有关 API 的详细信息，请参阅 *Amazon Tools for PowerShell Cmdlet 参考 (V* 5) [PutDeliveryChannel](https://docs.amazonaws.cn/powershell/v5/reference)中的。

------

有关 S Amazon DK 开发者指南和代码示例的完整列表，请参阅[Amazon Config与Amazon SDK 一起使用](sdk-general-information-section.md)。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。