title: Bash with AWS CLI - unable to locate credentials
body: <p>I have a shell script which is supposed to download some files from S3 and mount an ebs drive. However, I always end up with "Unable to locate credentials".</p>
  
  <p>I have specified my credentials with the <code>aws configure</code> command and the commands work outside the shell script. Could somebody, please, tell me (preferably in detail) how to make it work?</p>
  
  <p>This is my script</p>
  
  <pre><code>#!/bin/bash
  
  AWS_CONFIG_FILE="~/.aws/config"
  
  echo $1
  
  sudo mkfs -t ext4 $1
  sudo mkdir /s3-backup-test
  sudo chmod -R ugo+rw /s3-backup-test
  sudo mount $1 /s3-backup-test
  
  sudo aws s3 sync s3://backup-test-s3 /s3-backup/test
  
  du -h /s3-backup-test
  ipt (short version):
  </code></pre>
  
  <p>Thanks for any help!</p>