How to create a bucket with Public Read Access?

后端 未结 2 1058
逝去的感伤
逝去的感伤 2021-01-13 04:05

I´d like to enable Public Read-Access on all items in my Bucket that are in the \"public\" folder in the serverless.yml file.

Currently this is definition code i use

2条回答
  •  無奈伤痛
    2021-01-13 04:18

    As the others have said, you need to implement a Bucket Policy such as this one:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "PublicReadForGetBucketObjects",
                "Effect": "Allow",
                "Principal": "*",
                "Action": "s3:GetObject",
                "Resource": "arn:aws:s3:::{NAME_OF_YOUR_BUCKET_HERE}/*"
            }
        ]
    } 
    

    This can be done in the AWS console by selecting the Bucket, then Permissions, then Bucket Policy. Looks like @Milan C. is indicating how to declare this in a serverless.yml file.

提交回复
热议问题