windows AWS 命令行界面无法找到凭证 - 特殊权限
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18967696/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
AWS Command Line Interface Unable to Locate Credentials - Special Permissions
提问by RoboArch
Okay, so I've encountered an insanely frustrating problem while trying to reach an AWS S3 Bucket through AWS CLI via the command prompt in Windows 7. The AWS CLI is "unable to locate credentials" a.k.a. the config.txt file @ C:\Users\USERNAME\.aws\config.txt
.
好的,所以我在尝试通过 Windows 7 中的命令提示符通过 AWS CLI 访问 AWS S3 Bucket 时遇到了一个非常令人沮丧的问题。 AWS CLI 是“无法找到凭证”,也就是 config.txt 文件 @ C:\Users\USERNAME\.aws\config.txt
。
I've tried pathing to it by creating the AWS_CONFIG_FILE environmental variable in ControlPanel>System>AdvancedSystemSettings>EnvironmentalVariables, but no dice. I've also tried all of the above on another Win7 machine. Again, no dice.
我已经尝试通过在 ControlPanel>System>AdvancedSystemSettings>EnvironmentalVariables 中创建 AWS_CONFIG_FILE 环境变量来找到它,但没有骰子。我也在另一台 Win7 机器上尝试了上述所有方法。再次,没有骰子。
What could I be missing here. Are there any special permission that need to be set for AWS CLI to accest config.txt? Help, before I poke my own eyes out!
我会在这里错过什么。是否需要为 AWS CLI 设置任何特殊权限才能访问 config.txt?救命,在我戳破自己的眼睛之前!
The contents of config.txt, in case you're interested, are:
如果您有兴趣,config.txt 的内容是:
[default]
aws_access_key_id = key id here
aws_secret_access_key = key here
region = us-east-1
采纳答案by RoboArch
Okay, so the config file cannot be a text file (.txt). You should create the file in CMD, and it should be a generic file w/o any extension.
好的,所以配置文件不能是文本文件 (.txt)。您应该在 CMD 中创建该文件,它应该是一个没有任何扩展名的通用文件。
回答by Firoz Sabaliya
There is a another way to configure aws credentials while using command line tool. You can pass credentials using windows command instead of passing through file. Execute below command from windows command prompt
还有另一种在使用命令行工具时配置 aws 凭据的方法。您可以使用 windows 命令而不是通过文件传递凭据。从 Windows 命令提示符执行以下命令
aws configure
It prompt you to enter below things
它会提示您输入以下内容
AWS Access key ID:
AWS secrete key ID:
Default region Name:
Default output Format:
See this video tutorial: https://youtu.be/hhXj8lM_jBs
请参阅此视频教程:https: //youtu.be/hhXj8lM_jBs
回答by Remotec
A couple of points on this as I had similar problems whilst trying to perform an S3 sync.
关于这一点,因为我在尝试执行 S3 同步时遇到了类似的问题。
My findings were as follows.
我的发现如下。
Remove the spaces between hte
=
and the key value pair (see example below).The OP has specified a
[default]
section in their example, but I got the same error when I had removed this section as I did not think it was needed so it's worth nothing this is needed.
删除 hte
=
和键值对之间的空格(参见下面的示例)。OP
[default]
在他们的示例中指定了一个部分,但是当我删除该部分时我遇到了同样的错误,因为我认为不需要它,所以不需要它。
I then reformed my file as follows and it worked...
然后我按如下方式修改了我的文件,它起作用了......
[default]
aws_access_key_id=****
aws_secret_access_key=****
region=eu-west-2
[deployment-profile]
aws_access_key_id=****
aws_secret_access_key=****
region=eu-west-2
- I had to include a blank line at the bottom of my
credentials
file.
- 我必须在
credentials
文件底部包含一个空行。
Just posting this really as I struggled for a few hours with vague messages from AWS and these were the solutions that worked for me. Hope that it helps someone.
只是发布这个,因为我在 AWS 的模糊消息中挣扎了几个小时,这些是对我有用的解决方案。希望它可以帮助某人。
回答by Laurie
If like me you have a custom IAM user in your credentials file rather than 'default', try setting the AWS_DEFAULT_PROFILE
to the name of your IAM user, and then running commands:
如果像我一样,您的凭证文件中有一个自定义 IAM 用户而不是“默认”,请尝试将 设置AWS_DEFAULT_PROFILE
为您的 IAM 用户的名称,然后运行命令:
set AWS_DEFAULT_PROFILE=<name defined in credentials file>