我想要在 Amazon Managed Workflows for Apache Airflow (Amazon MWAA) 環境中使用 plugins.zip 安裝自訂套件。
建立 plugins.zip 檔案,然後將 plugins.zip 檔案上傳至 Amazon Simple Storage Service (Amazon S3)。
建立 requirements.txt 檔案,然後將 requirements.txt 檔案上傳至 Amazon S3。
如需使用 Python wheel 安裝程式庫,請參閱如何在 Amazon MWAA 環境中安裝 Python 程式庫?
安裝 Python wheel 時,請確定 plugins.zip 檔案中包含 WHL 檔案。然後,在 requirements.txt 檔案中加入 WHL 檔案的路徑。將 WHL 檔案新增至 plugins.zip 檔案後,如果您更新環境,環境會將 WHL 檔案傳送至 /usr/local/airflow/plugins/。
Amazon MWAA 支援 Apache Airflow 內建的外掛程式管理員,讓您可以使用自訂 Apache Airflow 運算子、勾點、感應器或介面。如需安裝自訂外掛程式,請參閱安裝自訂外掛程式。
請完成以下步驟:
如需自訂外掛程式的建立範例,請參閱 plugins.zip 的使用案例範例。如需在 requirements 檔案中設定條件約束的相關資訊,請參閱建立 requirements.txt。如需升級條件約束檔案的相關資訊,請參閱條件約束檔案。
如果環境執行時無須持續更新某些檔案,請將這些檔案壓縮至 plugins.zip。此外,也請將不需要授予 DAG 編寫者存取權的檔案壓縮至 plugins.zip。這些檔案包括憑證 (CRT) 檔案、PEM 檔案及 YAML 組態檔案。
若要將 CRT、PEM 或 YAML 檔案壓縮至 plugins.zip 檔案,請執行以下命令:
zip plugins.zip your-file.txt
注意: 將 your-file.txt 替換為 CRT、PEM 或 YAML 檔案的名稱及副檔名。
將所有檔案壓縮至 plugins.zip 後,請將 plugins.zip 上傳至 Amazon S3。然後,更新您的環境。系統會將檔案複寫至 /usr/local/airflow/plugins,並設定所需的存取權限。
如果無法安裝這些套件,請使用 amazon-mwaa-docker-images 在本機測試 DAG、自訂外掛程式或 Python 相依性。如需更多資訊,請參閱 GitHub 網站上的 amazon-mwaa-docker-images。
若要疑難排解 plugins.zip 檔案中的 Python 套件安裝問題,請從 Apache Airflow 工作程序或排程器日誌群組中檢視 requirements_install_ip 日誌檔案。
外掛程式
This article was reviewed and updated on 2026-03-13.
AWS Official
回答 1 個月前
DamonDeng
已提問 4 年前
david
已提問 5 個月前
Eric
已提問 2 年前
Jimi Hung
LumensJeff
Donnie LI
已發佈 2 年前