Search code examples
amazon-web-servicesamazon-s3aws-sdkaws-php-sdk

Cannot read credentials from /.aws/credentials


I am trying to integrate AWS PHP SDK for codeigniter

But its showing error as follows

An uncaught Exception was encountered
Type: Aws\Exception\CredentialsException

Message: Cannot read credentials from /.aws/credentials

Filename: /var/www/html/aws/Aws/Credentials/CredentialProvider.php

And on cli getting an error as -bash: /root/.aws/credentials: Permission denied

So after this i have allowed permission ... cli error has gone but php error Cannot read credentials from /.aws/credentials still remain.

Please help to solve this issue.

Thanks!


Solution

  • If your are using IAM Role to EC2 Instance then there is no need of using following

    'profile'=>'default',
    

    i just remove above line which solved error "Cannot read credentials from /.aws/credentials"

    Issue using an IAM role with PHP SDK