Skip to content
Advertisement

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 AwsCredentialsCredentialProvider;
use AwsS3S3Client;
$profile = 'default';
$inipath = '/www/test/.test/credentials.ini';
$provider = CredentialProvider::ini($profile, $inipath);
$provider = CredentialProvider::memoize($provider);

use AwsExceptionAwsException;
try {

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

It fails with this error:

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

Does anybody have a clue on how fix this?

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement