步骤 2:将目标节点注册到维护时段 (Amazon CLI) - Amazon Systems Manager
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

步骤 2:将目标节点注册到维护时段 (Amazon CLI)

在此步骤中,您使用新的维护时段注册目标。在这种情况下,您需指定维护时段运行时要更新的节点。

有关使用节点 ID 一次注册多个节点的示例、使用标签来标识多个节点的示例,以及将资源组指定为目标的示例,请参阅 示例:向维护时段注册目标

注意

您应该已经创建了要在此步骤中使用的 Amazon Elastic Compute Cloud (Amazon EC2) 实例,如 Maintenance Windows 教程先决条件中所述。

将目标节点注册到维护时段 (Amazon CLI)
  1. 在本地计算机上运行以下命令。将每个示例资源占位符替换为您自己的信息。

    Linux & macOS
    aws ssm register-target-with-maintenance-window \ --window-id "mw-0c50858d01EXAMPLE" \ --resource-type "INSTANCE" \ --target "Key=InstanceIds,Values=i-02573cafcfEXAMPLE"
    Windows
    aws ssm register-target-with-maintenance-window ^ --window-id "mw-0c50858d01EXAMPLE" ^ --resource-type "INSTANCE" ^ --target "Key=InstanceIds,Values=i-02573cafcfEXAMPLE"

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

    {
       "WindowTargetId":"e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE"
    }
  2. 现在,在本地计算机上运行以下命令,查看有关您的维护时段目标的详细信息。

    Linux & macOS
    aws ssm describe-maintenance-window-targets \ --window-id "mw-0c50858d01EXAMPLE"
    Windows
    aws ssm describe-maintenance-window-targets ^ --window-id "mw-0c50858d01EXAMPLE"

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

    {
        "Targets": [
            {
                "WindowId": "mw-0c50858d01EXAMPLE",
                "WindowTargetId": "e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE",
                "ResourceType": "INSTANCE",
                "Targets": [
                    {
                        "Key": "InstanceIds",
                        "Values": [
                            "i-02573cafcfEXAMPLE"
                        ]
                    }
                ]
            }
        ]
    }

继续浏览 步骤 3:向维护时段注册任务 (Amazon CLI)