

• 2026 年 4 月 30 日之後將不再提供 AWS Systems Manager CloudWatch Dashboard。客戶可以繼續使用 Amazon CloudWatch 主控台來檢視、建立和管理其 Amazon CloudWatch 儀表板，就像現在一樣。如需詳細資訊，請參閱 [Amazon CloudWatch Dashboard 文件](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html)。

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

# 使用 Run Command 開啟 Kernel Live Patching
<a name="enable-klp"></a>

若要開啟 Kernel Live Patching，您可以在受管節點上執行 `yum` 命令，或使用 Run Command 和您建立的自訂 Systems Manager 文件 (SSM 文件)。

如需有關透過直接在受管節點上執行 `yum` 命令來關閉 Kernel Live Patching 的資訊，請參閱《Amazon EC2 使用者指南》**中的[啟用 Kernel Live Patching](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/al2-live-patching.html#al2-live-patching-prereq)。

**注意**  
當您開啟「核心即時修補」時，如果受管節點上已經執行的核心*早於* `kernel-4.14.165-131.185.amzn2.x86_64` (最低支援的版本)，則程序會安裝最新的可用核心版本並重新啟動受管節點。如果節點已在執行 `kernel-4.14.165-131.185.amzn2.x86_64` 或更新版本，則程序不會安裝較新的版本，也不會重新啟動節點。

**使用 Run Command 開啟 Kernel Live Patching (主控台)**

1. 在 https：//[https://console.aws.amazon.com/systems-manager/](https://console.aws.amazon.com/systems-manager/) 開啟 AWS Systems Manager 主控台。

1. 在導覽窗格中，選擇 **Run Command**。

1. 選擇**執行命令**。

1. 在 **Command document** (命令文件) 清單中，選擇 SSM 文件 `AWS-ConfigureKernelLivePatching`。

1. 在 **Command parameters (命令參數)** 區段中，指定是否要在此操作中重新啟動受管節點。

1. 如需使用此頁面上其餘控制項的詳細資訊，請參閱[從主控台執行命令](running-commands-console.md)。

1. 選擇**執行**。

**開啟 Kernel Live Patching (AWS CLI)**
+ 在本機機器上執行以下命令。

------
#### [ Linux & macOS ]

  ```
  aws ssm send-command \
      --document-name "AWS-ConfigureKernelLivePatching" \
      --parameters "EnableOrDisable=Enable" \
      --targets "Key=instanceids,Values={{instance-id}}"
  ```

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

  ```
  aws ssm send-command ^
      --document-name "AWS-ConfigureKernelLivePatching" ^
      --parameters "EnableOrDisable=Enable" ^
      --targets "Key=instanceids,Values={{instance-id}}"
  ```

------

  將 i{{instance-id}} 取代為您要啟用該功能的 Amazon Linux 2 受管節點 ID，例如 i-02573cafcfEXAMPLE。若要在多個受管節點上開啟此功能，您可以使用下列其中一種格式。
  + `--targets "Key=instanceids,Values={{instance-id1}},{{instance-id2}}"`
  + `--targets "Key=tag:{{tag-key}},Values={{tag-value}}"`

  如需可以在命令中使用之其他選項的相關資訊，請參閱《AWS CLI 命令參考》**中的 [https://docs.aws.amazon.com/cli/latest/reference/ssm/send-command.html](https://docs.aws.amazon.com/cli/latest/reference/ssm/send-command.html) 一節。