HyperDevil
HyperDevil

Reputation: 2639

AWS SDK PHP - Cannot read credentials from /.aws/credentials

There seems to be an error either in the documentation or the SDK itself.
The SDK keeps looking for the standard credentials file while there is none.

require('aws/aws-autoloader.php');
use Aws\Credentials\CredentialProvider;
use Aws\S3\S3Client;
$profile = 'default';
$inipath = '/www/test/.test/credentials.ini';
$provider = CredentialProvider::ini($profile, $inipath);
$provider = CredentialProvider::memoize($provider);

use Aws\Exception\AwsException;
try {

    $s3Client = new S3Client([
            'profile' => 'default',
            'region' => 'eu-central-1',
            'version' => '2006-03-01',
            'credentials' => $provider,
    ]);

It fails with this error:

Uncaught Aws\Exception\CredentialsException: Cannot read credentials from /.aws/credentials in /www/test/aws/Aws/Credentials/CredentialProvider.php:394

Does anybody have a clue on how fix this?

Upvotes: 0

Views: 2883

Answers (1)

HyperDevil
HyperDevil

Reputation: 2639

I removed 'profile' => 'default', from the s3client and it worked. It seemed the profiles were defined twice.

Upvotes: 3

Related Questions