python - 将 Boto 库包含在 Elastic Beanstalk 中

标签 python amazon-web-services boto amazon-elastic-beanstalk

我正在寻找如何将 Boto 库包含在 Elastic Beanstalk 实例中。我的印象是我必须在 .ebextensions 中指定它。不幸的是,这似乎不起作用(见下文)。

python.config:

packages:
    python:
        Flask: []
        Boto: []
option_settings:
...AWS key redacted...

代码:

import boto
from boto.s3.connection import S3Connection
from boto.s3.key import Key

错误信息: 导入错误:没有名为 boto 的模块

我是否缺少配置文件中的任何内容?我还需要做其他事情吗?

最佳答案

包名boto事实上,它是小写的,所以调整它可能已经解决了你的问题。

或者,您可能想尝试明显推荐的方式 Customizing and Configuring a Python Container通过典型的 requirements.txt 文件和 pip 代替,请参阅 2):

Create a requirements.txt file and place it in the top-level directory of your source bundle. A typical python application will have dependencies on other third-party Python packages. In Python, pip is the standard way of installing packages. Pip has a feature that allows you to specify all the packages you need (as well as their versions) in a single requirements file. For more information about the requirements file, go to Requirements files. The following is an example requirements.txt file for Django.

Django==1.4.1
MySQL-python==1.2.3

因此,就您而言,目前可能是:

Flask==0.9
boto==2.9.2

Deploying a Python Application to AWS Elastic Beanstalk Using the Elastic Beanstalk Console 中也有这样的说明。 .

关于python - 将 Boto 库包含在 Elastic Beanstalk 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16308956/

相关文章:

python-3.x - 在本地测试 sagemaker 端点部署

python-3.x - 无法通过 boto3 查询 DynamoDB 中的分区键

python - 我们如何获取 IAM 用户、他们的组和策略?

python - 如何在 PySpark 中连接到 Presto JDBC?

python - 字符串到变量然后循环递增

amazon-web-services - 如何在 AWS Lambda 中创建身份验证中间件

amazon-web-services - 验证错误: The specified value for roleName is invalid

python - 合并字典的字典

python - 从具有匹配词的主列表生成列表,无论顺序如何

python - 如何从 awsebcli 中删除当前用户凭据?