How to Make Files Uploaded to S3 Default to Public

• 1 min read • 8 votes

By default, files uploaded to Amazon S3 are private, requiring a separate action to make public. To make uploads default to public, add this policy to your S3 bucket.

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

If you aren’t sure how to add a policy, follow these steps:

  1. click on bucket
  2. expand the Permissions row
  3. click “Add Bucket Policy”
  4. copy/paste the snippet below into the text area.
  5. change MY_BUCKET_NAME to the bucket you want
  6. submit your changes

That’s it!

If you enjoyed this tutorial, please consider sponsoring my work on GitHub 🤗

Now look what you've done 🌋
Stop clicking and run for your life! 😱
Uh oh, I don't think the system can't handle it! 🔥
Stop it, you're too kind 😄
Thanks for the love! ❤️
Thanks, glad you enjoyed it! Care to share?
Hacker News Reddit

More Posts ✍🏻

See All »
• 4 min read • 613 votes
🗓 2020 Year in Review: Life Shuffle
Read Post »
• 2 min read • 1002 votes
👨🏼‍💻 Going Indie, Again
Read Post »
• 2 min read • 700 votes
🗓 2019 Year in Review: Prioritizing Health
Read Post »
• 4 min read • 4282 votes
😈 Productive Procrastination
Read Post »
• 6 min read • 919 votes
🎈 Abandoning the Static Site
Read Post »
• 6 min read • 429 votes
👔 Quit With Positivity
Read Post »
• 3 min read • 415 votes
📈 Indie to Acquisition
Read Post »
×