

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

# 部署加速警示組態變更
<a name="acc-mem-deploy-change"></a>

完成自訂後，您需要使用 AppConfig 或 部署它 CloudFormation。

**Topics**
+ [使用 AppConfig 部署加速警示組態變更](acc-mem-deploy-change-appconfig.md)
+ [使用 CloudFormation 來部署加速組態變更](acc-mem-deploy-change-cfn.md)

# 使用 AppConfig 部署加速警示組態變更
<a name="acc-mem-deploy-change-appconfig"></a>

自訂完成後，請使用 AppConfig 透過 [StartDeployment](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_StartDeployment.html) 部署您的變更。

```
  aws appconfig start-deployment --application-id application_id 
   --environment-id environment_id Vdeployment-strategy-id 
   deployment_strategy_id --configuration-profile-id configuration_profile_id --configuration-version 1
```
+ **應用程式 ID**：應用程式 的 ID`AMSAlarmManager`，您可以使用 [ListApplications](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_ListApplications.html) API 呼叫找到它。
+ **環境 ID**：您可以使用 [ListEnvironments](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_ListEnvironments.html) API 呼叫找到此 ID。
+ **部署策略 ID**：您可以使用 [ListDeploymentStrategies](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_ListDeploymentStrategies.html) API 呼叫找到此選項。
+ **組態設定檔 ID**： 的 ID`CustomerManagedAlarms`；您可以使用 [ListConfigurationProfiles](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_ListConfigurationProfiles.html) API 呼叫找到此 ID。
+ **組態版本**：要部署的組態設定檔版本。

**重要**  
 警示管理員會套用組態設定檔中指定的警示定義。使用 AWS 管理主控台 或 CloudWatch CLI/SDK 對 CloudWatch 警示所做的任何手動修改都會自動還原，因此請確定您的變更是透過 Alarm Manager 定義。若要了解警示管理員建立哪些警示，您可以尋找值為 的`ams:alarm-manager:managed`標籤`true`。  
將 [StartDeployment](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_StartDeployment.html) 和 [ StopDeployment](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_StopDeployment.html) API 動作的存取權限制為信任的使用者，這些使用者了解將新組態部署到目標的責任和後果。

若要進一步了解如何使用 AWS AppConfig 功能來建立和部署組態，請參閱 [AWS AppConfig 文件。](https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-working.html)

# 使用 CloudFormation 來部署加速組態變更
<a name="acc-mem-deploy-change-cfn"></a>

如果您想要使用 部署`CustomerManagedAlarms`組態設定檔 CloudFormation，您可以使用下列 CloudFormation 範本。將您想要的 JSON 組態放在 `AMSAlarmManagerConfigurationVersion.Content` 欄位中。

當您在 CloudFormation 堆疊或堆疊集中部署範本時，如果您未遵循組態所需的 JSON 格式，`AMSResourceTaggerDeployment`資源的部署將會失敗。[加速組態設定檔：監控](acc-mem-config-doc-format.md) 如需預期格式的詳細資訊，請參閱 。

如需將這些範本部署為 CloudFormation 堆疊或堆疊集的說明，請參閱下列相關的 AWS CloudFormation 文件：
+ [在 AWS CloudFormation 主控台上建立堆疊](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-create-stack.html)
+ [使用 AWS CLI 建立堆疊](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-cli-creating-stack.html)
+ [建立堆疊集](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-getting-started-create.html)

**注意**  
如果您使用其中一個範本部署組態版本，然後刪除 CloudFormation 堆疊/堆疊集，則範本組態版本會保留為目前部署的版本，而且不會進行任何額外的部署。如果您想要還原為預設組態，您將需要手動部署空白組態 （即僅 \$1\$1)，或將堆疊更新為空白組態，而不是刪除堆疊。

**JSON**

```
{
  "Description": "Custom configuration for the AMS Alarm Manager.",
  "Resources": {
    "AMSAlarmManagerConfigurationVersion": {
      "Type": "AWS::AppConfig::HostedConfigurationVersion",
      "Properties": {
        "ApplicationId": {
          "Fn::ImportValue": "AMS-Alarm-Manager-Configuration-ApplicationId"
        },
        "ConfigurationProfileId": {
          "Fn::ImportValue": "AMS-Alarm-Manager-Configuration-CustomerManagedAlarms-ProfileID"
        },
        "Content": "{}",
        "ContentType": "application/json"
      }
    },
    "AMSAlarmManagerDeployment": {
      "Type": "AWS::AppConfig::Deployment",
      "Properties": {
        "ApplicationId": {
          "Fn::ImportValue": "AMS-Alarm-Manager-Configuration-ApplicationId"
        },
        "ConfigurationProfileId": {
          "Fn::ImportValue": "AMS-Alarm-Manager-Configuration-CustomerManagedAlarms-ProfileID"
        },
        "ConfigurationVersion": {
          "Ref": "AMSAlarmManagerConfigurationVersion"
        },
        "DeploymentStrategyId": {
          "Fn::ImportValue": "AMS-Alarm-Manager-Configuration-Deployment-StrategyID"
        },
        "EnvironmentId": {
          "Fn::ImportValue": "AMS-Alarm-Manager-Configuration-EnvironmentId"
        }
      }
    }
  }
}
```

**YAML**

```
Description: Custom configuration for the AMS Alarm Manager.
Resources:
  AMSAlarmManagerConfigurationVersion:
    Type: AWS::AppConfig::HostedConfigurationVersion
    Properties:
      ApplicationId:
        !ImportValue AMS-Alarm-Manager-Configuration-ApplicationId
      ConfigurationProfileId:
        !ImportValue AMS-Alarm-Manager-Configuration-CustomerManagedAlarms-ProfileID
      Content: |
        {
          
        }
      ContentType: application/json
  AMSAlarmManagerDeployment:
    Type: AWS::AppConfig::Deployment
    Properties:
      ApplicationId:
        !ImportValue AMS-Alarm-Manager-Configuration-ApplicationId
      ConfigurationProfileId:
        !ImportValue AMS-Alarm-Manager-Configuration-CustomerManagedAlarms-ProfileID
      ConfigurationVersion:
        !Ref AMSAlarmManagerConfigurationVersion
      DeploymentStrategyId:
        !ImportValue AMS-Alarm-Manager-Configuration-Deployment-StrategyID
      EnvironmentId:
        !ImportValue AMS-Alarm-Manager-Configuration-EnvironmentId
```