我正在尝试将对象从一个AWS账户S3转移到另一个账户S3。目前我使用临时目录来实现该功能,如下所示:
$s3_remote = S3Client::factory(/*AWS logins*/);
$s3_local = S3Client::factory(/*AWS logins*/);
$s3_remote->getObject([
"Bucket" => $bucket,
"Key" => $object,
"SaveAs" => $path . $name . "." . $extension,
]);
$s3_local->putObject([
"Bucket" => $bucket,
"Key" => $object,
"SourceFile" => $path . $name . "." . $extension,
]);
有没有办法getObject
直接从远程一个本地S3存储桶?
是否有类似的东西:
$s3_remote->getObject(
"Bucket" => $bucket,
"Key" => $key
"LocalAWSKey" => "13265ASD",
"LocalAWSSKey" => "aASd31a2sd13as564fsdg4aA"
);
答案 0 :(得分:1)
您可以设置权限,允许一个帐户访问另一个帐户的S3资源。请参阅“S3开发人员指南”的Access Control部分。适当的权限到位后,您应该能够使用S3Client::copyObject()
方法。