Skip to main content

Create S3 bucket

ยท 3 min read
Vitaliy Syveniuk
Fullstack Engineer

AWS provides a wonderful file storage service called S3. It offers scalability, data availability, security. And all this at a relatively low cost. In this article, we will look at how to create and configure a bucket in the AWS console.

aws s3

Go to the AWS Management Console and open the S3 console in your region, for example eu-central-1. In the Create menu, enter a bucket name and select the ownership options. You probably won't need to select the ACLs enabled option unless you have a specific need. Possible case: configuring access to the bucket for different teams under each of their own accounts in your company.

Docusaurus Plushie

Leave the Block all public acces setting enabled. You will customize access to bucket items later. You can enable or disable versioning, the choice is yours. It is good practice to enable it so that you can restore a previous version of a file if needed. But obviously this will take up more space in the bucket.

Docusaurus Plushie

Set a tag if you want to. This will help organize projects and better manage storage costs, but is not very important. For Encryption type, just leave the default value unless you have special needs. As for Object lock, if you need to secure items from deletion and modification, you can enable it. You can set a retention period for each item in the bucket. But this is usually not required for a regular projects.

Docusaurus Plushie

Now that you have created the bucket, you may want to set some access policies. For example, you may want to make some files in the bucket public so that everyone can access them. Let's create some folders to make one of them public.

Docusaurus Plushie

Upload a file into public folder

Docusaurus Plushie

Now select the file in the console, find its url and try to click on the link. You will see that it is inaccessible. This is because the bucket is private by default.

Docusaurus Plushie Docusaurus Plushie

It's time to make the folder public. Go to the bucket permissions

Docusaurus Plushie

Disable Block all public access

Docusaurus Plushie

And edit the bucket policy

Docusaurus Plushie

Modify the statements manually or use the sidebar menu

Docusaurus Plushie

Now go back to the shared folder and try to access the file again. Oh boy, success! ๐Ÿ˜บ The file is now accessible.

Docusaurus Plushie

Now all files in the public/ folder can be accessed by anyone. But files in the private/ folder are still private.

Hope you found this article helpful. Stay tuned for more articles on AWS services. ๐Ÿ“†