如何增加 Elastic Beanstalk 部署的逾時?

如何增加 Elastic Beanstalk 部署的逾時?

作為我的應用程式部署的一部分,我的設定檔commands中有一些。.ebextensions第一次運行命令(克隆大型儲存庫)時,可能需要 20 分鐘或更長時間才能完成所有命令。

不幸的是,這會在部署期間觸發逾時:

INFO Deploying new version to instance(s).
WARN The following instances have not responded in the allowed command
     timeout time (they might still finish eventually on their own).
INFO Command execution completed. Summary: [Successful: 0, TimedOut: 1].

是否可以增加這個超時時間?我在環境設定中找不到該選項。

答案1

你可以加AWS Elastic Beanstalk 設定文件(.ebextensions) 新增至您的 Web 應用程式的原始程式碼中,以配置您的環境並自訂其包含的 AWS 資源。

option_settings設定檔的部分定義了以下值配置選項。配置選項可讓您配置 Elastic Beanstalk 環境、其中的 AWS 資源以及執行應用程式的軟體。

將設定檔新增至原始程式碼中名為 .ebextensions 的資料夾中,並將其部署到應用程式來源套件中。

例子:

option_settings:
    - namespace: aws:elasticbeanstalk:command
      option_name: Timeout
      value: 1000

*“value”表示超時前的時間長度(以秒為單位)。

參考資料:官方 AWS Elastic Beanstalk環境配置適用於所有環境的通用選項,堆疊溢位答案和AWS 開發者論壇貼文。

答案2

您可以將儲存庫烘焙到 AMI 中並讓 Elastic beanstalk 使用它。這樣結帳時間就不會那麼長。

另一方面,您正在做什麼克隆大量存儲庫作為部署

相關內容