Upload Amazon S3

Asked

Viewed 46 times

0

I’m having a question, I made a small php script to upload files into my Bucket and I need all and any file contained in it to be accessed only through a url. How can I do this? via code or configuration in my own Bucket?

I need this because the system I am developing, has as a requirement that the files and videos are accessed only within the user area.

1 answer

0

In case someone needs it, I got in the Amazon documentation information on how to make such restrictions, just add the Bucket policy below in your Bucket:

    {
    "Version": "2012-10-17",
    "Id": "http referer policy example",
    "Statement": [
        {
            "Sid": "Descricao aqui",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::nomebucket/*",
            "Condition": {
                "StringLike": {
                    "aws:Referer": [
                        "http://www.urlaqui.com/*",
                        "http://urlaqui.com/*"
                    ]
                }
            }
        }
    ]
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.