title: AWS credentials not working - ~/.aws/credentials
body: <p>I'm having a problem with my AWS credentials. I used the credentials file that I created on ~/.aws/credentials just as it is written on the AWS doc. However, apache just can't read it.</p>
  
  <p>First, I was getting this error:</p>
  
  <p><strong>Error retrieving credentials from the instance profile metadata server. When you are not running inside of Amazon EC2, you must provide your AWS access key ID and secret access key in the "key" and "secret" options when creating a client or provide an instantiated Aws\Common\Credentials CredentialsInterface object.</strong></p>
  
  <p>Then I tried some solutions that I found on internet. For example, I tried to check my HOME variable. It was /home/ubuntu. I tried also to move my credentials file to the /var/www directory even if it is not my web server directory. Nothing worked. I was still getting the same error.</p>
  
  <p>As a second solution, I saw that we could call directly the CredentialsProvider and indicate the directory on the client.</p>
  
  <p><a href="https://forums.aws.amazon.com/thread.jspa?messageID=583216&amp;#583216" rel="noreferrer">https://forums.aws.amazon.com/thread.jspa?messageID=583216&amp;#583216</a></p>
  
  <p>The error changed but I couldn't make it work:</p>
  
  <p><strong>Cannot read credentials from /.aws/credentials</strong></p>
  
  <p>I saw also that we could use the default provider of the CredentialsProvider instead of indicating a path.</p>
  
  <p><a href="http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/credentials.html#using-credentials-from-environment-variables" rel="noreferrer">http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/credentials.html#using-credentials-from-environment-variables</a></p>
  
  <p>I tried and I keep getting the same error:</p>
  
  <p><strong>Cannot read credentials from /.aws/credentials</strong></p>
  
  <p>Just in case you need this information, I'm using aws/aws-sdk-php (3.2.5). The service I'm trying to use is the AWS Elastic Transcoder. My EC2 instance is an Ubuntu 14.04. It runs a Symfony application deployed using Capifony.</p>
  
  <p>Before I try on this production server, I tried it in a development server where it works perfectly only with the ~/.aws/credentials file. This development server is exactly a copy of the production server. However, it doesn't use Capifony for the deployment. It is just a normal git clone of the project. And it has only one EBS volume while the production server has one for the OS and one for the application.</p>
  
  <p>Ah! And I also checked if the permissions/owners of the credentials file were the same on both servers and they are the same. I tried a 777 to see if it could change something but nothing.</p>
  
  <p>Does anybody have an idea?</p>