You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Python3.11+Amazon Linux2023部署Flask到Elastic Beanstalk遇安装错误

Flask部署AWS Elastic Beanstalk故障排查

基本情况

能正常部署Elastic Beanstalk的示例应用,但自己的Flask应用部署失败。已按要求将主文件命名为application.py,并把Flask实例名改为application。

现有配置文件

.ebextensions/postgres.config

最初配置:

packages:
    yum:
        mariadb-devel: []
        postgresql-devel: []

(已移除mariadb-devel,现在报错提示无法安装postgresql-devel)

.ebextensions/python.config

commands:
  01_update_pip:
    command: "pip install --upgrade pip setuptools"

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: application.py

项目目录结构

server(根目录)
├── .ebextensions
│   ├── postgres.config
│   └── python.config
├── application.py
└── requirements.txt
venv

部署日志关键报错

[INFO] Error occurred during build: Yum does not have postgresql-devel available for installation
[ERROR] An error occurred during execution of command [app-deploy] - [PreBuildEbExtension]
[WARN]could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size

过往尝试

曾在Amazon Linux 2环境下完成部署,但出现网关错误,具体配置命令已记不清。优先想使用最新的Amazon Linux 2023,也接受其他更简单的部署方案。

附Amazon Linux 2下的参考配置(假设主文件为Application.py):

commands:
  01_update_pip:
    command: "pip install --upgrade pip setuptools"

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: Application:application

内容的提问来源于stack exchange,提问作者Izy G

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 15:22:50