The default bucket policy for Amazon S3 is private, which means that the contents of a bucket are only accessible to you and people who have been given permission. This will not work if you want your content to be public! Luckily, making your s3 bucket public is simple with this step-by-step guide.
What is an S3 bucket, and why should I make it public?
An S3 bucket is a cloud storage service from AWS (Amazon Web Services). You can store anything from files to images, videos, and backups in s-buckets.
Making your bucket public is important if you want it to be accessible by anyone on the internet, or just one user who has been given permission. Some people may find this useful for sharing a certain type of content with others online (like images), whereas some will use s-buckets as cloud storage – such as saving large video/image files that they do not need immediate access to but might like in future!
Also if you want to host your ReactJS application into S3, then you need to set the bucket policy to the public otherwise you will get an error.
How to configure your bucket for public access in the AWS Management Console?
- Log in to the AWS console
- Find your S3 bucket on the list and open it. If you do not know how to find it, just type S3 in the console search box and then select Amazon S3 service. It will be shown as Bucket name: S3 – Select Properties option from the drop-down menu.
- Go to the Permission section and click the Edit bucket policy button which is located on the right side of the Policy Editor section.
-Then click on Edit policy and provide this JSON as given below.
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::project-griffioen-webshop/*"
}
]
}
Replace the {BUCKET_ARN} with your S3 bucket ARN and save it.
That’s it. You just made your S3 bucket public and it’s ready to host static websites, images, and video files.
Conclusion
We have a few more tips to help you make the most of your public S3 bucket. Leave us a comment below and we will send them your way!