Assign permission in an entire directory inside Amazon S3 Bucket (PHP)
I'm using AWS SDK + PHP + Symfony2.
Is there a way to assign public-read permission to an entire directory that I've just uploaded to an Amazon S3 Bucket?
The code I normally use to assign a public-read permission is:
$this->s3->putObjectAcl( array( 'Bucket' => $this->bucketName, 'Key' => $destinationPath, 'ACL' => CannedAcl::PUBLIC_READ ) );
But it doesn't work if $destinationPath is a directory. Is there a way to achieve that?
As urfusion mentioned, what you're looking for is a Bucket Policy.
Here's an example policy you might use :