在尝试将一些部署任务自动化到 S3 时,我注意到我通过 aws configure
提供的凭据没有被 Node.js SDK 获取。如何让 shell 和 gulp 任务引用同一个文件?
最佳答案
经过大量搜索,这是this article 的摘录。这引起了灵光一现的时刻。
If you've been using the AWS CLI, you might already have a credentials file, which is in the same location as the new credentials file, but is named
config
. If so, the CLI will continue to use that file. However, if you create a new credentials file, the CLI will use that one instead. (Be aware that theaws configure
command that you can use to set credentials from the command line will put the credentials in theconfig
file, not the credentials file.)
现在,通过将 ~/.aws/config 移动到 ~/.aws/credentials,CLI 和 SDK 从同一位置读取。遗憾的是,除了手动编辑之外,我还没有找到任何用于维护 ~/.aws/credentials 的界面。
关于node.js - 配置 AWS 凭证以同时使用 CLI 和 SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25050644/