更新外部執行個體上的 AWS Systems Manager 代理程式和 Amazon ECS 容器代理程式 - Amazon Elastic Container Service

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

更新外部執行個體上的 AWS Systems Manager 代理程式和 Amazon ECS 容器代理程式

執行 Amazon ECS 工作負載時,您的內部部署伺服器或 VM 必須同時執行 AWS Systems Manager 代理程式 (SSM 代理程式) 和 Amazon ECS 容器代理程式。 新增或更新任何功能時, 會 AWS 發行這些代理程式的新版本。如果您的外部執行個體使用舊版代理程式,您可以使用下列程序來更新它們。

在外部執行個體上更新 SSM Agent

AWS Systems Manager 建議您自動化更新執行個體上 SSM 代理程式的程序。它們提供多種方法來自動化更新。如需詳細資訊,請參閱 AWS Systems Manager 使用者指南中的自動化 SSM Agent 更新

在外部執行個體上更新 Amazon ECS 代理程式

在外部執行個體上,Amazon ECS 容器代理程式會透過升級 ecs-init 套件進行更新。更新 Amazon ECS 代理程式不會中斷執行中的任務或服務。Amazon ECS 在每個區域的 Amazon S3 儲存貯體中提供 ecs-init 套件和簽章檔案。從 ecs-init 版本 1.52.1-1 開始,Amazon ECS 提供單獨的 ecs-init 套件以供使用,這取決於外部執行個體所使用的作業系統和系統架構。

依據外部執行個體使用的作業系統和系統架構,使用下表來確定您應下載的 ecs-init 套件。

注意

透過使用下列命令來確定外部執行個體所使用的作業系統和系統架構。

cat /etc/os-release uname -m
作業系統 (架構) ecs-init 套件

CentOS 7 (x86_64)

CentOS 8 (x86_64)

CentOS 串流 9 (x86_64)

SUSE Enterprise Server 15 (x86_64)

RHEL 7 (x86_64)

RHEL 8 (x86_64)

amazon-ecs-init-latest.x86_64.rpm

CentOS 7 (aarch64)

CentOS 8 (aarch64)

CentOS 串流 9 (aarch64)

RHEL 7 (aarch64)

amazon-ecs-init-latest.aarch64.rpm

Debian 9 (x86_64)

Debian 10 (x86_64)

Debian 11 (x86_64)

Debian 12 (x86_64)

Ubuntu 18 (x86_64)

Ubuntu 20 (x86_64)

Ubuntu 22 (x86_64)

Ubuntu 24 (x86_64)

amazon-ecs-init-latest.amd64.deb

Debian 9 (aarch64)

Debian 10 (aarch64)

Debian 11 (aarch64)

Debian 12 (aarch64)

Ubuntu 18 (aarch64)

Ubuntu 20 (aarch64)

Ubuntu 22 (aarch64)

Ubuntu 24 (aarch64)

amazon-ecs-init-latest.arm64.deb

請依照以下步驟更新 Amazon ECS 代理程式。

若要更新 Amazon ECS 代理程式
  1. 確認您正在執行的 Amazon ECS 代理程式版本。

    curl -s 127.0.0.1:51678/v1/metadata | python3 -mjson.tool
  2. 下載適用於您的作業系統和系統架構的 ecs-init 套件。Amazon ECS 在每個區域的 Amazon S3 儲存貯體中提供 ecs-init 套件檔案。請務必將命令中的 <region> 識別符替換為與您的地理位置最接近的區域名稱 (例如,us-west-2)。

    amazon-ecs-init-latest.x86_64.rpm

    curl -o amazon-ecs-init.rpm https://s3.<region>.amazonaws.com/amazon-ecs-agent-<region>/amazon-ecs-init-latest.x86_64.rpm

    amazon-ecs-init-latest.aarch64.rpm

    curl -o amazon-ecs-init.rpm https://s3.<region>.amazonaws.com/amazon-ecs-agent-<region>/amazon-ecs-init-latest.aarch64.rpm

    amazon-ecs-init-latest.amd64.deb

    curl -o amazon-ecs-init.deb https://s3.<region>.amazonaws.com/amazon-ecs-agent-<region>/amazon-ecs-init-latest.amd64.deb

    amazon-ecs-init-latest.arm64.deb

    curl -o amazon-ecs-init.deb https://s3.<region>.amazonaws.com/amazon-ecs-agent-<region>/amazon-ecs-init-latest.arm64.deb
  3. (選用) 使用 PGP 簽章確認 ecs-init 套件檔案的有效性。

    1. 下載並安裝 GnuPG。如需 GNUpg 的詳細資訊,請參閱 GnuPG 網站。若您的系統為 Linux,請使用套件軟體管理工具在 Linux 上安裝 gpg

    2. 擷取Amazon ECS PGP 公有金鑰。

      gpg --keyserver hkp://keys.gnupg.net:80 --recv BCE9D9A42D51784F
    3. 下載 ecs-init 套件簽章。簽章是 ASCII 分離的 PGP 簽章,存放於副檔名為 .asc 的檔案中。Amazon ECS 在每個區域的 Amazon S3 儲存貯體中提供簽章檔案。請務必將命令中的 <region> 識別符替換為與您的地理位置最接近的區域名稱 (例如,us-west-2)。

      amazon-ecs-init-latest.x86_64.rpm

      curl -o amazon-ecs-init.rpm.asc https://s3.<region>.amazonaws.com/amazon-ecs-agent-<region>/amazon-ecs-init-latest.x86_64.rpm.asc

      amazon-ecs-init-latest.aarch64.rpm

      curl -o amazon-ecs-init.rpm.asc https://s3.<region>.amazonaws.com/amazon-ecs-agent-<region>/amazon-ecs-init-latest.aarch64.rpm.asc

      amazon-ecs-init-latest.amd64.deb

      curl -o amazon-ecs-init.deb.asc https://s3.<region>.amazonaws.com/amazon-ecs-agent-<region>/amazon-ecs-init-latest.amd64.deb.asc

      amazon-ecs-init-latest.arm64.deb

      curl -o amazon-ecs-init.deb.asc https://s3.<region>.amazonaws.com/amazon-ecs-agent-<region>/amazon-ecs-init-latest.arm64.deb.asc
    4. 使用金鑰驗證 ecs-init 套件檔案。

      對於 rpm 套件

      gpg --verify amazon-ecs-init.rpm.asc ./amazon-ecs-init.rpm

      對於 deb 套件

      gpg --verify amazon-ecs-init.deb.asc ./amazon-ecs-init.deb

      預期的輸出如下:

      gpg: Signature made Fri 14 May 2021 09:31:36 PM UTC gpg: using RSA key 50DECCC4710E61AF gpg: Good signature from "Amazon ECS <ecs-security@amazon.com>" [unknown] gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: F34C 3DDA E729 26B0 79BE AEC6 BCE9 D9A4 2D51 784F Subkey fingerprint: D64B B6F9 0CF3 77E9 B5FB 346F 50DE CCC4 710E 61AF
  4. 安裝 ecs-init 套裝服務。

    對於 CentOS 7、CentOS 8 以及 RHEL 7 中的 rpm 套件

    sudo yum install -y ./amazon-ecs-init.rpm

    對於 SUSE Enterprise Server 15 中的 rpm 套件

    sudo zypper install -y --allow-unsigned-rpm ./amazon-ecs-init.rpm

    對於 deb 套件

    sudo dpkg -i ./amazon-ecs-init.deb
  5. 重新啟動 ecs 服務。

    sudo systemctl restart ecs
  6. 確認 Amazon ECS 代理程式版本已更新。

    curl -s 127.0.0.1:51678/v1/metadata | python3 -mjson.tool