[英]Uploading object into transfer accelerated S3 bucket using PHP
我是AWS的新手。 据我了解,S3传输加速使用Cloudfront边缘进行最快上传,但我无法找到适合PHP API的文档,用于将对象上传到启用传输加速的存储桶中。 我的代码:
use Aws\S3\S3Client;
$S3_Client = new S3Client([
'version' => 'latest',
'region' =>'ap-south-1',
'credentials' => [
'key' => 'Accesskey',
'secret' => 'Secretkey',
],
'endpoint' => 'http://my_bucket_name.s3-accelerate.amazonaws.com'
]);
$bucket = 'my_bucket_name';
$key = 'EC2.pdf';
$SourceFile = '/path/to/the/file/EC2.pdf';
$put = $S3_Client->putObject([
'Bucket' => $bucket,
'Key' => $key,
'SourceFile' => $SourceFile
]);
我收到以下错误
The authorization header is malformed;
the region 'ap-south-1' is wrong; expecting 'us-east-1'
但我的桶位于us-east-1,当我改变区域时
us-east-1
我收到以下错误:
The specified bucket does not exist
而不是endpoint => ...
,将'use_accelerate_endpoint' => True
传递给构造函数 。
在构建发送到S3的请求时,有许多不同的规则可以发挥作用。 endpoint
选项提供服务端点,而不是桶端点,并且非常适用于非标准配置。
这可能与此讨论有关: https : //github.com/hashicorp/terraform/issues/2774
尝试以下解决方案 - “我有同样的问题,我之前已经创建了存储桶并删除了它。我更改了名称,它没有应用任何问题。”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.