我是第一次使用 AWS,刚刚安装了 boto for python。我被困在它建议的步骤:
“您可以将此文件放在/etc/boto.cfg 以供系统范围使用,或者放在以 ~/.boto 形式执行命令的用户的主目录中。”
老实说,我不知道该怎么办。首先,我找不到 boto.cfg,其次我不确定要为第二个选项执行哪个命令。
此外,当我将应用程序部署到我的服务器时,我假设我也需要在那里做同样的事情...
最佳答案
"You can place this file either at /etc/boto.cfg for system-wide use or in the home directory of the user executing the commands as ~/.boto."
前者只是意味着您可以在目录 /etc
中创建一个名为 boto.cfg
的配置文件(即它不一定已经存在,具体取决于如何boto 已安装在您的特定系统上)。
后者的措辞确实有点不幸 - ~/.boto
意味着 boto 将在用户执行的主目录中查找名为 .boto
的配置文件促进 boto 库的命令(即 Python 脚本)。
您可以在 boto wiki 文章 BotoConfig 中阅读更多相关信息,例如关于手头的问题:
A boto config file is simply a .ini format configuration file that specifies values for options that control the behavior of the boto library. Upon startup, the boto library looks for configuration files in the following locations and in the following order:
- /etc/boto.cfg - for site-wide settings that all users on this machine will use
- ~/.boto - for user-specific settings
您确实还需要在部署应用程序的服务器上准备相应的配置文件。
祝你好运!
关于python - 在 Python 的 boto.cfg 中获取凭证文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9197385/