使用 Editor (编辑器) 创建更改模板 - Amazon Systems Manager
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

使用 Editor (编辑器) 创建更改模板

可以使用本主题中的步骤,通过输入 JSON 或 YAML,而不是使用控制台控件,在 Amazon Systems Manager 的功能 Change Manager 中配置更改模板。

使用 Editor (编辑器) 创建更改模板
  1. 在导航窗格中,选择 Change Manager

    -或者-

    如果首先打开 Amazon Systems Manager 主页,选择菜单图标 ( 
    The menu icon
  ) 打开导航窗格,然后选择 Change Manager

  2. 选择创建模板

  3. 对于 Name (名称),请输入模板的名称,以便于识别其用途,例如 RestartEC2LinuxInstance

  4. Change template details (更改模板详细信息) 上方,选择 Editor (编辑器)

  5. Document editor (文档编辑器) 部分中,选择 Edit (编辑),然后为您的更改模板输入 JSON 或 YAML 内容。

    以下是示例。

    注意

    参数 minRequiredApprovals 用于指定对于使用此模板创建的更改请求,必须取得多少指定级别的审阅者批准。

    此示例演示了两个级别的批准。您可以指定最多五个级别的批准,但只需要一个级别。

    在第一级,每个更改请求必须取得指定用户“John-Doe”的批准。然后,该更改请求必须由 IAM 角色 Admin 的任意三个成员批准。

    有关批准更改模板的更多信息,请参阅 关于更改模板中的批准

    YAML
    description: >- This change template demonstrates the feature set available for creating change templates for Change Manager. This template starts a Runbook workflow for the Automation runbook called AWS-HelloWorld. templateInformation: > ### Document Name: HelloWorldChangeTemplate ## What does this document do? This change template demonstrates the feature set available for creating change templates for Change Manager. This template starts a Runbook workflow for the Automation runbook called AWS-HelloWorld. ## Input Parameters * ApproverSnsTopicArn: (Required) Amazon Simple Notification Service ARN for approvers. * Approver: (Required) The name of the approver to send this request to. * ApproverType: (Required) The type of reviewer. * Allowed Values: IamUser, IamGroup, IamRole, SSOGroup, SSOUser ## Output Parameters This document has no outputs schemaVersion: '0.3' parameters: ApproverSnsTopicArn: type: String description: Amazon Simple Notification Service ARN for approvers. Approver: type: String description: IAM approver ApproverType: type: String description: >- Approver types for the request. Allowed values include IamUser, IamGroup, IamRole, SSOGroup, and SSOUser. executableRunBooks: - name: AWS-HelloWorld version: '1' emergencyChange: false autoApprovable: false mainSteps: - name: ApproveAction1 action: 'aws:approve' timeoutSeconds: 3600 inputs: Message: >- A sample change request has been submitted for your review in Change Manager. You can approve or reject this request. EnhancedApprovals: NotificationArn: '{{ ApproverSnsTopicArn }}' Approvers: - approver: John-Doe type: IamUser minRequiredApprovals: 1 - name: ApproveAction2 action: 'aws:approve' timeoutSeconds: 3600 inputs: Message: >- A sample change request has been submitted for your review in Change Manager. You can approve or reject this request. EnhancedApprovals: NotificationArn: '{{ ApproverSnsTopicArn }}' Approvers: - approver: Admin type: IamRole minRequiredApprovals: 3
    JSON
    { "description": "This change template demonstrates the feature set available for creating change templates for Change Manager. This template starts a Runbook workflow for the Automation runbook called AWS-HelloWorld", "templateInformation": "### Document Name: HelloWorldChangeTemplate\n\n ## What does this document do?\n This change template demonstrates the feature set available for creating change templates for Change Manager. This template starts a Runbook workflow for the Automation runbook called AWS-HelloWorld.\n\n ## Input Parameters\n* ApproverSnsTopicArn: (Required) Amazon Simple Notification Service ARN for approvers.\n * Approver: (Required) The name of the approver to send this request to.\n * ApproverType: (Required) The type of reviewer. * Allowed Values: IamUser, IamGroup, IamRole, SSOGroup, SSOUser\n\n ## Output Parameters\nThis document has no outputs\n", "schemaVersion": "0.3", "parameters": { "ApproverSnsTopicArn": { "type": "String", "description": "Amazon Simple Notification Service ARN for approvers." }, "Approver": { "type": "String", "description": "IAM approver" }, "ApproverType": { "type": "String", "description": "Approver types for the request. Allowed values include IamUser, IamGroup, IamRole, SSOGroup, and SSOUser." } }, "executableRunBooks": [ { "name": "AWS-HelloWorld", "version": "1" } ], "emergencyChange": false, "autoApprovable": false, "mainSteps": [ { "name": "ApproveAction1", "action": "aws:approve", "timeoutSeconds": 3600, "inputs": { "Message": "A sample change request has been submitted for your review in Change Manager. You can approve or reject this request.", "EnhancedApprovals": { "NotificationArn": "{{ ApproverSnsTopicArn }}", "Approvers": [ { "approver": "John-Doe", "type": "IamUser", "minRequiredApprovals": 1 } ] } } }, { "name": "ApproveAction2", "action": "aws:approve", "timeoutSeconds": 3600, "inputs": { "Message": "A sample change request has been submitted for your review in Change Manager. You can approve or reject this request.", "EnhancedApprovals": { "NotificationArn": "{{ ApproverSnsTopicArn }}", "Approvers": [ { "approver": "Admin", "type": "IamRole", "minRequiredApprovals": 3 } ] } } } ] }
  6. 选择 Save and preview (保存和预览)

  7. 审核您所创建的更改模板的详细信息。

    如果要在提交更改模板以供审核之前对其进行更改,请选择 Actions (操作)、Edit (编辑)

    如果您对更改模板的内容感到满意,请选择 Submit for review (提交以供审核)。您的组织或账户内在 Change Manager 中的 Settings (设置) 选项卡上被指定为模板审核人员的用户,将收到新的更改模板正等待其审核的通知。

    如果已为更改模板指定 Amazon Simple Notification Service (Amazon SNS) 主题,则当更改模板被拒绝或批准时,系统会发送通知。如果您没有收到与此更改模板相关的通知,可在稍后返回 Change Manager 以检查其状态。