

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

# 部署組態
<a name="appconfig-deploying"></a>

[建立使用特徵標記和自由格式組態資料所需的成品](https://docs.aws.amazon.com/appconfig/latest/userguide/creating-feature-flags-and-configuration-data.html)之後，您可以使用 AWS CLI AWS 管理主控台、 或 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 Simple Storage Service (Amazon S3) 物件，或存放在使用客戶受管金鑰加密的 AWS Systems Manager 參數存放區中的安全字串參數，您必須指定 `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. 在 https：//[https://console.aws.amazon.com/systems-manager/appconfig/](https://console.aws.amazon.com/systems-manager/appconfig/) 開啟 AWS Systems Manager 主控台。

1. 在導覽窗格中，選擇**應用程式**，然後選擇您在 中建立的應用程式[在 中為您的應用程式建立命名空間 AWS AppConfig](appconfig-creating-namespace.md)。

1. 在**環境**索引標籤上，填入環境的選項按鈕，然後選擇**檢視詳細資訊**。

1. 選擇 **Start deployment (啟動部署)**。

1. 對於 **Configuration (組態)**，請從清單中選擇一個組態。

1. 根據您的組態來源，使用版本清單來選擇您要部署的版本。

1. 對於 **Deployment strategy (部署策略)**，請從清單中選擇策略。

1. (選用) 在**部署說明**中輸入說明。

1. 對於**其他加密選項**，請從清單中選擇 AWS Key Management Service 金鑰。

1. （選用） 在**標籤**區段中，選擇**新增標籤**，然後輸入索引鍵和選用值。您可以為資源指定最多 50 個標籤。

1. 選擇 **Start deployment (啟動部署)**。

## 部署組態 （命令列）
<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
   ```

------