title: How to get AWS command line interface to work in cygwin
body: <p>I installed the AWS command line interface on my Windows 7 box, and it worked immediately when I called commands from a DOS shell.</p>
  
  <p>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.</p>
  
  <p>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.  (<a href="https://cygwin.com/cygwin-ug-net/setup-env.html">cygwin includes your Windows environmental variables</a>, such as PATH, in its own environment.)</p>
  
  <p>Unfortunately, when I first tried to execute an AWS CLI command from cygwin/bash, I got an error:</p>
  
  <pre><code>$ aws s3 cp code.tgz s3://xyz/
  upload failed: .\code.tgz to s3://xyz/code.tgz
  Unable to locate credentials
  </code></pre>
  
  <p>This error is likely because the AWS CLI is looking in the wrong directory for the <code>credentials</code> file.  On Windows, it expects that file to be in <code>%UserProfile%.aws</code> and in unix in <code>~/.aws</code>.</p>
  
  <p>One hack work around is that in my home directory I created a new file named <code>config_credentials</code> which contains a union of the contents of that directory's files <code>config</code> and <code>credentials</code>.  I then made a new Windows System env var named <code>AWS_CONFIG_FILE</code> whose value is the path to <code>config_credentials</code>.  Success: AWS CLI commands issued from cygwin now work.</p>
  
  <p>I am wondering if there is a better solution?</p>
  
  <p>I am curious why AWS CLI initially failed to search in the correct home directory for the <code>config</code> and <code>credentials</code> files.  I also wonder if there is a way to correct that (this would eliminate the need for the <code>AWS_CONFIG_FILE</code> env var).</p>