Upload amazon s3

0

I have a question, I made a small php script to upload files into my bucket and I need every file contained in it to be accessed only through a url. How can I do this? via code or configuration in my same bucket?

I need this because the system I'm developing requires the files and videos to be accessed only within the user area.

    
asked by anonymous 25.12.2017 / 22:01

1 answer

0

If someone needs to, I got the information on how to make such restrictions in the Amazon documentation, 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/*"
                    ]
                }
            }
        }
    ]
}
    
25.12.2017 / 23:03