將 ECR 映像提取至 AWS 您的帳戶 - Amazon Athena

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

將 ECR 映像提取至 AWS 您的帳戶

Athena 聯合連接器 Lambda 函數使用存放在 Athena 受管 Amazon ECR 儲存庫中的容器映像。若要在這些容器映像上執行安全性掃描,您必須先將它們複製到帳戶中的 Amazon ECR 儲存庫。本節提供step-by-step指示,說明如何將映像複製到您的儲存庫,並設定 Lambda 函數以使用映像。

先決條件

  • Athena 聯合連接器 – 連接器可以透過任何來源建立,前提是它使用容器映像。

    注意

    若要驗證映像部署,請檢查 Athena Federation Connector Lambda 中的映像索引標籤

  • 安裝並執行 Docker

  • AWS CLI 已安裝

  • 具有適當提取許可的帳戶登入資料

如何傳輸映像

  1. 從 Athena Federation Connector Lambda 找到映像 URI

    account_id_1.dkr.ecr.us-east-1.amazonaws.com/athena-federation-repository:2025.15.1
  2. 為 Athena 受管帳戶產生 Docker 身分驗證字符:

    aws ecr get-login-password --region regionID | docker login --username AWS --password-stdin athena-managed-registry

    其中:

    • regionID 是您的部署區域 (例如 us-east-1)

    • athena-managed-registry 是映像 URI 的登錄部分 (例如 account_id_1.dkr.ecr.us-east-1.amazonaws.com)

  3. 從 Athena 受管帳戶提取映像:

    docker pull athenaImageURI
  4. 將 Docker 驗證為您的登錄檔:

    aws ecr get-login-password --region regionID | docker login --username AWS --password-stdin customer-registry

    其中 customer-registry 是您的 ECR 登錄檔 (例如 account_id_2.dkr.ecr.us-east-1.amazonaws.com)

  5. 為您的儲存庫標記提取的映像:

    docker tag athenaImageURI yourImageURI
  6. 將映像推送到您的儲存庫:

    docker push yourImageURI
  7. 更新您的 Athena 聯合連接器:

    1. 導覽至您的 Lambda 函數

    2. 選取部署新映像

    3. 輸入您的新映像 URI

    Athena 聯合連接器映像現在位於您的帳戶中,可讓您在映像上執行 CVE 掃描。