Home > database >  s3 folder permissions to get http requests
s3 folder permissions to get http requests

Time:04-06

I have 1 folder in this bucket with many subfolders. I want to make it possible that (future) files in all folders are available within a browser (https get request). Other buckets are listed as "objects can be public"

How can I do this through S3 console ? regards, w

CodePudding user response:

It appears that you are wanting a specific folder within an Amazon S3 bucket to be public.

You can do this by adding a Bucket Policy to the S3 bucket:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::BUCKET-NAME/folder-name/*"
        }
    ]
}

This allows any object within folder-name/ to be accessed (including sub-folders). The user would need to know the specific Key (filename) to access the object.

You would need to deactivate S3 Block Public Access before adding the Bucket Policy.

For more examples of Bucket Policies, see: Bucket policy examples - Amazon Simple Storage Service

  • Related