php - getting permission denied in amazon aws -
i trying connect amazon s3 using aws credentials file have done following things
i have created
credentials.ini
file @.aws\credentials
. have validawsaccesskeyid
,awssecretkey
[default] awsaccesskeyid=somekey awssecretkey=somesecretkey
i doing following use key , list object
.
$s3 = new aws\s3\s3client([ 'version' => 'latest', 'region' => 'us-west-2' ]); $result = $s3->listbuckets(); var_dump($result);
and getting error
warning: parse_ini_file(c:\users\user\.aws\credentials): failed open stream: permission denied in c:\xampp\htdocs\aws\vendor\aws\aws-sdk-php\src\credentials\credentialprovider.php on line 216 fatal error: uncaught exception 'aws\exception\credentialsexception' message 'error retrieving credentials instance profile metadata server. (curl error 28: connection timed out after 1000 milliseconds (see http://curl.haxx.se/libcurl/c/libcurl-errors.html))' in c:\xampp\htdocs\aws\vendor\aws\aws-sdk-php\src\credentials\instanceprofileprovider.php:79 stack trace: #0 c:\xampp\htdocs\aws\vendor\guzzlehttp\promises\src\promise.php(199): aws\credentials\instanceprofileprovider->aws\credentials\{closure}(array) #1 c:\xampp\htdocs\aws\vendor\guzzlehttp\promises\src\promise.php(152): guzzlehttp\promise\promise::callhandler(2, array, array) #2 c:\xampp\htdocs\aws\vendor\guzzlehttp\promises\src\taskqueue.php(60): guzzlehttp\promise\promise::guzzlehttp\promise\{closure}() #3 c:\xampp\htdocs\aws\vendor\guzzlehttp\guzzle\src\handler\curlmultihandler.php(96): guzzlehttp\promise\taskqueue->run() #4 c:\xampp\htdocs\aws\vendor\guzzlehttp\guzzle\src\handler\curlmultihandler.php(123): guzzlehttp\handler\curlmultihandler->tick in c:\xampp\htdocs\aws\vendor\aws\aws-sdk-php\src\credentials\instanceprofileprovider.php on line 79
according aws php documentation, format of credentials file follows:
[default] aws_access_key_id = your_aws_access_key_id aws_secret_access_key = your_aws_secret_access_key
in case, here believe happening:
- first, php library tries credentials environment, not present ...
- next, tries them ini file, have mis-spelled keys ...
- finally, tries them ec2 metadata server looks not running on ec2 instance there no metadata server , attempt, using curl, times out.
you can see of in source code aws php library.
the end result bubbles step #3 failed, steps #1, #2, , #3 failed. so, think fix simple correcting key names in ini file.
Comments
Post a Comment