

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

# 部署配置
<a name="appconfig-deploying"></a>

在[创建了处理功能标志和自由格式配置数据所需的工件](https://docs.aws.amazon.com/appconfig/latest/userguide/creating-feature-flags-and-configuration-data.html)后，您可以使用 AWS 管理控制台 AWS CLI、或 SDK 创建新的部署。在中启动部署会 AWS AppConfig 调用 [StartDeployment](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_StartDeployment.html)API 操作。该调用包括 AWS AppConfig 应用程序、环境和配置文件的 ID 以及（可选）要部署的配置数据版本。该调用还包括要使用的部署策略的 ID，该策略确定如何部署配置数据。

如果您部署存储在中的密钥 AWS Secrets Manager、使用客户托管密钥加密的亚马逊简单存储服务 (Amazon S3) Service 对象，或者存储 AWS Systems Manager 在使用客户托管密钥加密的 Parameter Store 中的安全字符串参数，则必须为`KmsKeyIdentifier`该参数指定一个值。如果您的配置未加密或使用加密 AWS 托管式密钥，则无需为`KmsKeyIdentifier`参数指定值。

**注意**  
为 `KmsKeyIdentifier` 指定的值必须是客户管理的密钥。该密钥不必与您用来加密配置的密钥相同。  
当您使用开始部署时`KmsKeyIdentifier`，附加到您的 AWS Identity and Access Management (IAM) 委托人的权限策略必须允许该`kms:GenerateDataKey`操作。

AWS AppConfig 监视向所有主机的分发情况并报告状态。如果分发失败，则回 AWS AppConfig 滚配置。

**注意**  
一次只能将一个配置部署到一个环境中。但是，您可以同时将一个配置部署到不同的环境。

## 部署配置（控制台）
<a name="appconfig-deploying-console"></a>

使用以下过程通过 AWS Systems Manager 控制台部署 AWS AppConfig 配置。

**使用控制台部署配置**

1. 打开 AWS Systems Manager 控制台，网址为[https://console.aws.amazon.com/systems-manager/appconfig/](https://console.aws.amazon.com/systems-manager/appconfig/)。

1. 在导航窗格中，选择**应用程序**，然后选择在[在中为您的应用程序创建命名空间 AWS AppConfig](appconfig-creating-namespace.md)中创建的应用程序。

1. 在**环境**选项卡上，填充环境的单选按钮，然后选择**查看详细信息**。

1. 选择**开始部署**。

1. 对于 **Configuration (配置)**，请从列表中选择一个配置。

1. 根据配置的来源，使用版本列表来选择要部署的版本。

1. 对于 **Deployment strategy (部署策略)**，请从列表中选择一个策略。

1. （可选）对于**部署描述**，输入描述。

1. 对于**其他加密选项**，请从列表中选择一个 AWS Key Management Service 密钥。

1. （可选）在**标签**部分中，选择**添加新标签**，并输入键和可选值。您最多可以为一个资源指定 50 个标签。

1. 选择**开始部署**。

## 部署配置（命令行）
<a name="appconfig-deploying-commandline"></a>

以下过程介绍如何使用 AWS CLI （在 Linux 或 Windows 上）或 AWS Tools for PowerShell 部署 AWS AppConfig 配置。

**分步部署配置**

1. 打开 AWS CLI.

1. 运行以下命令部署配置。

------
#### [ Linux ]

   ```
   aws appconfig start-deployment \
     --application-id {{The_application_ID}} \
     --environment-id {{The_environment_ID}} \
     --deployment-strategy-id {{The_deployment_strategy_ID}} \
     --configuration-profile-id {{The_configuration_profile_ID}} \
     --configuration-version {{The_configuration_version_to_deploy}} \
     --description {{A_description_of_the_deployment}} \
     --tags {{User_defined_key_value_pair_metadata_of_the_deployment}}
   ```

------
#### [ Windows ]

   ```
   aws appconfig start-deployment ^
     --application-id {{The_application_ID}} ^
     --environment-id {{The_environment_ID}} ^
     --deployment-strategy-id {{The_deployment_strategy_ID}} ^
     --configuration-profile-id {{The_configuration_profile_ID}} ^
     --configuration-version {{The_configuration_version_to_deploy}} ^
     --description {{A_description_of_the_deployment}} ^
     --tags {{User_defined_key_value_pair_metadata_of_the_deployment}}
   ```

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

   ```
   Start-APPCDeployment `
     -ApplicationId {{The_application_ID}} `
     -ConfigurationProfileId {{The_configuration_profile_ID}} `
     -ConfigurationVersion {{The_configuration_version_to_deploy}} `
     -DeploymentStrategyId {{The_deployment_strategy_ID}} `
     -Description {{A_description_of_the_deployment}} `
     -EnvironmentId {{The_environment_ID}} `
     -Tag {{Hashtable_type_user_defined_key_value_pair_metadata_of_the_deployment}}
   ```

------

   系统将返回类似于以下内容的信息。

------
#### [ Linux ]

   ```
   {   
      "ApplicationId": "The ID of the application that was deployed",
      "EnvironmentId" : "The ID of the environment",
      "DeploymentStrategyId": "The ID of the deployment strategy that was deployed",
      "ConfigurationProfileId": "The ID of the configuration profile that was deployed",
      "DeploymentNumber": The sequence number of the deployment,
      "ConfigurationName": "The name of the configuration",
      "ConfigurationLocationUri": "Information about the source location of the configuration",
      "ConfigurationVersion": "The configuration version that was deployed",
      "Description": "The description of the deployment",
      "DeploymentDurationInMinutes": Total amount of time the deployment lasted,
      "GrowthType": "The linear or exponential algorithm used to define how percentage grew over time",
      "GrowthFactor": The percentage of targets to receive a deployed configuration during each interval,
      "FinalBakeTimeInMinutes": Time AWS AppConfig monitored for alarms before considering the deployment to be complete,
      "State": "The state of the deployment",  
   
      "EventLog": [ 
         { 
            "Description": "A description of the deployment event",
            "EventType": "The type of deployment event",
            "OccurredAt": The date and time the event occurred,
            "TriggeredBy": "The entity that triggered the deployment event"
         }
      ],
   
      "PercentageComplete": The percentage of targets for which the deployment is available,
      "StartedAt": The time the deployment started,
      "CompletedAt": The time the deployment completed   
   }
   ```

------
#### [ Windows ]

   ```
   {
      "ApplicationId": "The ID of the application that was deployed",
      "EnvironmentId" : "The ID of the environment",
      "DeploymentStrategyId": "The ID of the deployment strategy that was deployed",
      "ConfigurationProfileId": "The ID of the configuration profile that was deployed",
      "DeploymentNumber": The sequence number of the deployment,
      "ConfigurationName": "The name of the configuration",
      "ConfigurationLocationUri": "Information about the source location of the configuration",
      "ConfigurationVersion": "The configuration version that was deployed",
      "Description": "The description of the deployment",
      "DeploymentDurationInMinutes": Total amount of time the deployment lasted,
      "GrowthType": "The linear or exponential algorithm used to define how percentage grew over time",
      "GrowthFactor": The percentage of targets to receive a deployed configuration during each interval,
      "FinalBakeTimeInMinutes": Time AWS AppConfig monitored for alarms before considering the deployment to be complete,
      "State": "The state of the deployment",  
   
      "EventLog": [ 
         { 
            "Description": "A description of the deployment event",
            "EventType": "The type of deployment event",
            "OccurredAt": The date and time the event occurred,
            "TriggeredBy": "The entity that triggered the deployment event"
         }
      ],
   
      "PercentageComplete": The percentage of targets for which the deployment is available,
      "StartedAt": The time the deployment started,
      "CompletedAt": The time the deployment completed 
   }
   ```

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

   ```
   ApplicationId               : The ID of the application that was deployed
   CompletedAt                 : The time the deployment completed
   ConfigurationLocationUri    : Information about the source location of the configuration
   ConfigurationName           : The name of the configuration
   ConfigurationProfileId      : The ID of the configuration profile that was deployed
   ConfigurationVersion        : The configuration version that was deployed
   ContentLength               : Runtime of the deployment 
   DeploymentDurationInMinutes : Total amount of time the deployment lasted
   DeploymentNumber            : The sequence number of the deployment
   DeploymentStrategyId        : The ID of the deployment strategy that was deployed
   Description                 : The description of the deployment
   EnvironmentId               : The ID of the environment that was deployed
   EventLog                    : {Description : A description of the deployment event, EventType : The type of deployment event, OccurredAt : The date and time the event occurred,
            TriggeredBy : The entity that triggered the deployment event}
   FinalBakeTimeInMinutes      : Time AWS AppConfig monitored for alarms before considering the deployment to be complete
   GrowthFactor                : The percentage of targets to receive a deployed configuration during each interval
   GrowthType                  : The linear or exponential algorithm used to define how percentage grew over time
   HttpStatusCode              : HTTP Status of the runtime
   PercentageComplete          : The percentage of targets for which the deployment is available
   ResponseMetadata            : Runtime Metadata
   StartedAt                   : The time the deployment started
   State                       : The state of the deployment
   ```

------