【发布时间】:2019-05-06 20:57:10
【问题描述】:
早上好,
我正在与 AWS 合作,以利用存储服务。 我基于版本 3,你可以在这里找到它: https://docs.aws.amazon.com/it_it/sdk-for-php/v3/developer-guide/getting-started_installation.html 使用 ZIP 文件安装!
我发现这个错误:
Uncaught exception 'Aws\Exception\CredentialsException' with message 'Error retrieving credentials from the instance profile metadata server. (cURL error 7: Failed connect to 169.254.169.254:80; No route to host (see http://curl.haxx.se/libcurl/c/libcurl-errors.html))'
我的代码:
use Aws\S3\S3Client;
require_once 'aws-autoloader.php';
require_once 'config.php';
$config = array(
'bucket' => BUCKET,
'region' => 'eu-west-3',
'version' => 'latest',
'credentials ' => array('key'=>KEY,
'secret'=>SECRET)
);
$s3 = Aws\S3\S3Client::factory($config);
$objects = $s3->getIterator('ListObjects', ['Bucket' => $config['bucket'], 'Prefix' => 'challenge/']
);
我正在创建一个独立于 cms 或框架的函数。
有人知道怎么解决吗?
【问题讨论】:
标签: php amazon-web-services curl amazon-s3 aws-sdk