anacronw / multer-s3

multer storage engine for amazon s3
MIT License
660 stars 190 forks source link

acl: 'public-read' gives access denied error #49

Closed iamchathu closed 8 years ago

iamchathu commented 8 years ago

Without acl: 'public-read', files get uploaded.when I click the file link it says access denied.

So I added acl: 'public-read', . It gives error

AccessDenied: Access Denied

and files didn't get uploaded.

iamchathu commented 8 years ago

Changed the AWS policy and now it works

xavi-tristancho commented 5 years ago

@iamchathu what did you change? I'm having the same issue with the policy like this:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "s3:PutAccountPublicAccessBlock",
                "s3:GetAccountPublicAccessBlock",
                "s3:ListAllMyBuckets",
                "s3:HeadBucket"
            ],
            "Resource": "*"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::some-bucket",
                "arn:aws:s3:::some-bucket/*"
            ]
        }
    ]
}
maciejpk commented 5 years ago

Applying this Bucket Privacy helps with this issue

{
    "Id": "Policy1564065714148",
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1564065712071",
            "Action": "s3:*",
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::some-bucket",
                "arn:aws:s3:::some-bucket/*"
            ],
            "Principal": "*"
        }
    ]
}