amazon-web-services - 在没有 --profile 标志的情况下,每个 aws 命令都会失败并出现不同的错误
问题描述
免责声明:我确实将变量AWS_PROFILE
设置为default
并且 echo $AWS_PROFILE 确实 return default
。
但是,如果我不传递 --profile 标志,我的简单 aws 命令将失败。
例如,
如果我这样做aws2 s3 ls
,那么它会失败并出现错误:An error occurred (InvalidToken) when calling the ListBuckets operation: The provided token is malformed or otherwise invalid.
当我这样做时aws2 ec2 describe-instances
,它失败并出现错误An error occurred (AuthFailure) when calling the DescribeInstances operation: AWS was not able to validate the provided access credentials
即使消息不同,根本问题是相同的。如果我这样做,aws2 s3 ls --profile default
那么它工作正常,与aws2 ec2 describe-instances
命令相同。
即使我确实AWS_PROFILE
设置了,我也不知道如何不需要 --profile 标志。
我的凭据文件如下所示:
[default]
aws_access_key_id = AKIA****
aws_secret_access_key = VpR***
我的配置文件如下所示:
[default]
region = us-west-1
output = json
我设置了以下两个环境变量:
AWS_ACCESS_KEY_ID
和AWS_SECRET_ACCESS_KEY
。此外,我已经回显了他们的值,并确保这些值与凭证文件中的值完全相同。
有任何想法吗?
解决方案
用于
unset AWS_PROFILE
删除配置文件标记。运行
aws configure
以更新凭据确保您的机器时间正确。
推荐阅读
- hibernate - 如何将复合键中的单个字段映射为另一个实体的主键
- java - 如何生成 Klov 报告
- sql - 从excel表中获取数据并加载到表中的存储过程
- react-native - 像这样的可滑动列表控件如何使用 React Native 实现?
- java - 替换字符串上的空格并使用 toCharArray() 打破它们似乎不起作用
- three.js - 将 ShaderToy 转换为三个 js 的 Webgl 着色器(需要帮助)
- python - 名称“openpyxl”未定义错误
- c++ - g++ 在 Windows 上的 ubuntu 上的 bash 上安装
- c# - 在正则表达式捕获组中执行 OR
- javascript - PrimeNG 日历未在模式中反映日期