kartik
kartik

Reputation: 602

How can I set 'always make image public' whenever I upload image to S3 AWS?

Let's suppose if I am uploading an image to AWS S3 (manually from the console), and I would like everyone to view it. Currently, I upload an image, go to actions, and make it public. This process repeats for every image. How can I prevent myself doing the last step (i.e. not making the image public everytime, it will be checked by-default)

So, every image I upload, I would just copy it's URL, without doing anything else. It would be made public by-default.

Thanks a lot!

Upvotes: 7

Views: 5012

Answers (2)

Opal
Opal

Reputation: 84756

It seems that if you add the following policy to your bucket:

{
  "Version": "2008-10-17",
  "Statement": [{
    "Sid": "AllowPublicRead",
    "Effect": "Allow",
    "Principal": {
      "AWS": "*"
    },
    "Action": [ "s3:GetObject" ],
    "Resource": [ "arn:aws:s3:::MY_BUCKET_NAME/*" ]
  }]
}

all uploaded files will become public by default - taken from here.

Upvotes: 13

Ajit Pradhan
Ajit Pradhan

Reputation: 49

You can add change rules or go to properties of bucket you can disable block public access to that bucket.

Upvotes: 0

Related Questions