如何获得AWS命令行界面在Cygwin的工作 [英] How to get AWS command line interface to work in cygwin

查看:824
本文介绍了如何获得AWS命令行界面在Cygwin的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装在我的Windows 7中的AWS命令行界面,并立即工作时,我打电话从DOS Shell命令。

I installed the AWS command line interface on my Windows 7 box, and it worked immediately when I called commands from a DOS shell.

但DOS,曾经发明了最糟糕的语言,是可怕的任何严重的脚本。所以,我想通过Cygwin来使用AWS CLI从庆典。

But DOS, the worst language ever invented, is hideous for any serious scripting. So, I would like to to use the AWS CLI from bash via cygwin.

在我的例子中,安装AWS CLI是Windows版本。原则上,不应该是一个问题,因为Windows的命令是从Cygwin的可执行文件。 (的cygwin包括您的Windows环境变量的,如PATH,在它自己的环境。)

In my case, the installed AWS CLI is the Windows version. In principle, that should not be a problem because Windows commands are executable from cygwin. (cygwin includes your Windows environmental variables, such as PATH, in its own environment.)

不幸的是,当我第一次试图执行从Cygwin的/ bash的一个AWS CLI命令时,我得到了一个错误:

Unfortunately, when I first tried to execute an AWS CLI command from cygwin/bash, I got an error:

$ aws s3 cp code.tgz s3://xyz/
upload failed: .\code.tgz to s3://xyz/code.tgz
Unable to locate credentials

此错误可能是因为AWS CLI是找错了目录的证书文件。在Windows上,它希望该文件将在%USERPROFILE%.aws 和UNIX的〜/ .aws

This error is likely because the AWS CLI is looking in the wrong directory for the credentials file. On Windows, it expects that file to be in %UserProfile%.aws and in unix in ~/.aws.

一个黑客的解决办法是,在我的主目录我创建了一个名为新文件 config_credentials 包含的该目录中的文件的内容工会配置证书。然后我做了一个新的Windows系统ENV名为 AWS_CONFIG_FILE ,其值为路径 config_credentials 变种。成功:AWS CLI命令cygwin的版本现在的工作发出

One hack work around is that in my home directory I created a new file named config_credentials which contains a union of the contents of that directory's files config and credentials. I then made a new Windows System env var named AWS_CONFIG_FILE whose value is the path to config_credentials. Success: AWS CLI commands issued from cygwin now work.

我想知道是否有更好的解决办法?

I am wondering if there is a better solution?

我很好奇,为什么AWS CLI最初未能为配置证书文件正确的主目录中搜索。我也想知道是否有办法纠正(这将不再需要为 AWS_CONFIG_FILE 的环境变量)。

I am curious why AWS CLI initially failed to search in the correct home directory for the config and credentials files. I also wonder if there is a way to correct that (this would eliminate the need for the AWS_CONFIG_FILE env var).

推荐答案

我有同样的问题。我得到了解决它通过在Cygwin安装AWSCLI的新副本。首先,您需要安装卷曲和巨蟒Cygwin的包,那么你就可以安装AWSCLI如下:

I had the same problem. I got around it by installing a new copy of AWSCLI within Cygwin. You first need to install the "curl" and "python" Cygwin packages, then you can install AWSCLI as follows:

$ curl -O https://bootstrap.pypa.io/get-pip.py
$ python get-pip.py
$ pip install awscli

如果你使用bash,你已经pviously执行$ P $ Windows的AWS命令行,你需要清除缓存路径如下:

If you're running bash, and you've previously executed the Windows AWS command line, you need to clear the cached path as follows:

$ hash -d aws

AWS --version会类似于此:

"aws --version" will then look similar to this:

aws-cli/1.8.1 Python/2.7.10 CYGWIN_NT-10.0/2.2.1(0.289/5/3)

而不是Windows命令行输出,这类似于此:

as opposed to the Windows command line output, which looks similar to this:

aws-cli/1.8.1 Python/2.7.9 Windows/8

我现在可以做AWS配置的Cygwin之下,一切正常,因为它应该。

I'm now able to do "aws configure" under Cygwin, and everything works as it should.

这篇关于如何获得AWS命令行界面在Cygwin的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆