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:

        '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 :

      "Principal": "*",

People are also looking for solutions to the problem: php - Trying to access url that returns json results in connection reset by peer error


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.