PostgreSQL on Elastic Beanstalk (Amazon Linux 2)



对于前一代的AmazonLinux,我只需要在.eextensions中添加以下内容即可使用PostgreSQL:

packages:
yum:
postgresql93-devel: []

现在,当我使用以下平台在EB上部署时:Python 3.7在64位Amazon Linux 2/3.0.0 上运行

我在部署时遇到以下错误:

[ERROR] Error occurred during build: Yum does not have postgresql93-devel available for installation

因此无法部署,因为我需要连接到RDS中的PostgreSQL数据库。

我需要在.eextensions中做什么配置?

以下作品:

packages:
yum:
amazon-linux-extras: []
commands:
01_postgres_activate:
command: sudo amazon-linux-extras enable postgresql10
02_postgres_install:
command: sudo yum install -y postgresql-devel

postgresql93-devel相当古老。百胜PostgreSQL存储库的起价为9.5。根据您的需要,您可能希望至少升级到9.5。PostgreSQL 12是最新的生产版本。

编辑

至于@jordanm的评论——没错,AWS Linux 2环境确实有PostgreSQL 9.2.24可用。如果您对该版本满意,那么您只需安装postgresql-devel即可。将.ebextensions更改为只运行:

packages:
yum:
postgresql-devel: []

这将安装9.2.24的devel程序包。

如果你想要更新一点的东西,显然会更难。我无法将其用于devel程序包。如果您将.ebextensions更改为包含以下内容(未测试!(:

container_commands:
command: 'amazon-linux-extras install -y postgresql9.6'

然后你会得到PostgreSQL 9.6,但它似乎没有可用的devel包。

看起来不可能使用https://yum.postgresql.org/因为不支持AWS Linux 2。尝试CentOS或RHEL时出错。

9.2对您的环境可用吗?

帮助我使用Amazon Linus 1的是,在插入RDS服务并指定Postgres作为驱动程序时,我根本不需要安装Postgres。这只是有这个问题的人的一个想法。但也许只是试着不显式安装Postgres。

我还没有验证默认情况下将安装哪个版本。

此配置适用于ElasticBeanstalk环境(在64位AmazonLinux上运行的Python 3.6(。在此之后,我能够安装带有requirements.txt 的psycopg2

packages:
yum:
libicu-devel: []
commands:
01_postgres_libs:
command: rpm -ivh --force https://yum.postgresql.org/10/redhat/rhel-6.9-x86_64/postgresql10-libs-10.7-1PGDG.rhel6.x86_64.rpm
02_postgres_install:
command: rpm -ivh --force https://yum.postgresql.org/10/redhat/rhel-6.9-x86_64/postgresql10-10.7-1PGDG.rhel6.x86_64.rpm
03_symink_pg_config:
command: sudo ln -sf /usr/pgsql-10/bin/pg_config /usr/bin/pg_config
04_postgres_devel:
command: sudo rpm -ivh --force https://yum.postgresql.org/10/redhat/rhel-6.9-x86_64/postgresql10-devel-10.7-1PGDG.rhel6.x86_64.rpm

最新更新