node.js - 配置 AWS 凭证以同时使用 CLI 和 SDK

标签 node.js amazon-web-services

在尝试将一些部署任务自动化到 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 the aws configure command that you can use to set credentials from the command line will put the credentials in the config 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/

相关文章:

json - Azure 网站实例未运行 Package.json 中定义的 Node 版本

node.js - node-v12.16.1.pkg”无法打开,因为 Apple 无法检查它是否存在恶意软件

javascript - 客户端无法保存jpeg图片

带有动态变量的 JSON(配置文件)

node.js - 警告 : NODE_ENV value of 'test ' did not match any deployment config file names

amazon-web-services - AWS Cognito SMS 角色 : Cannot create or assign a new role

java - AWS Lambda 不从队列中删除消息

amazon-web-services - 我无法读取环境变量(Go 中的 aws-lambda)

amazon-web-services - Elastic Beanstalk 环境因以下有关 RDS 的错误消息而被阻止

amazon-web-services - 连接到Elasticsearch-Amazon Elasticsearch Service-IAM用户