Amazon S3 copyObject permission

前端 未结 3 1967
梦毁少年i
梦毁少年i 2020-12-29 03:56

I\'v got user with all permissions.

{
  \"Statement\": [
    {
      \"Effect\": \"Allow\",
      \"Action\": \"*\",
      \"Resource\": \"*\"
    }
  ]
}
         


        
3条回答
  •  悲哀的现实
    2020-12-29 04:38

    Popular answer was on point, but still had issues. Had to include ACL option.

    $this->client->copyObject([
      'Bucket'        => $this->bucket,
      // Added the bucket name to the copy source
      'CopySource'    => $this->bucket.'/'.$file,
      'Key'           => str_replace($source, $destination, $file),
      'ACL'           => 'public-read'
    ]);
    

    ACL can be one of these value 'ACL' => 'private|public-read|public-read-write|authenticated-read|aws-exec-read|bucket-owner-read|bucket-owner-full-control',

提交回复
热议问题