How to Create S3 Bucket in AWS Step by Step
Creating an S3 bucket in AWS is one of the most basic and essential things that you can do in AWS cloud.
Before we do that, Do you know that, AWS S3 is one of the widely used AWS services. It’s being used by few biggies like Reddit, Netflix, Pinterest and others.
Therefore, It’s always a good idea to learn how to get started with S3.
This tutorial is a beginner friendly tutorial on getting to know s3 and creating your first bucket.
What is AWS S3?
- S3 or Simple Storage Service is a fully managed(Serverless) object storage service provided by AWS.
- It lets you store any type and amount of data from anywhere in the world provided you are connected with internet.
- Before you can store any object/data in S3, you need to create a bucket.
- Buckets are ideally container for the objects. They can store unlimited number and amount of data.
- You can use an S3 bucket to host static websites or to store any kind of data you want.
Suggested Read : Serverless Services on AWS : List with Explanation
By the end of this tutorial, you should be able to-
- Create an S3 bucket
- Upload an object
- View the uploaded object
So let’s start. We will do all the above by taking baby steps.
Step 1: Login to AWS Management Console and open S3
To create s3 bucket in AWS, the very first step is to login to AWS Management Console and open S3 service.
You can either go to Services -> Storage -> S3
or
Type s3 in the search bar and hit enter. Once you see S3 option click on that.
Step 2: Create an S3 Bucket
Once you click on S3 in above step, it will lead you to S3 dashboard. Here you can see the list of all your bucket across regions and create new bucket as well.
Click on Create bucket
Provide a unique name to your bucket or else you will get “Bucket with same name already exists” error as above.
Reason is , S3 bucket names are globally unique. One you create a bucket with name “xyz” no one else in the world can create a bucket with the same name even in any other region or account until the bucket is deleted.
Suggested Read: This is why S3 Bucket name is unique globally
After the name, choose a region in which you would like your bucket to be created. You can choose any region of your choice, preferably near to your customer location to have optimum latency.
I have chosen a bucket name which is unique to me and eu-west-1 region.
Note: You might have noticed that when you open S3, Global is selected in region and region selection is disabled. However, you must choose a region in which your bucket should reside at the time of creation of bucket.
Suggested Read: Is S3 Region Specific or Global? What do you think?
After putting the name and region, let’s leave all other details to default and scroll down the page to find create Bucket button.
Click on Create bucket.
In a matter of seconds, your bucket is created and you see success message like below.
Congratulation !!!
You have created your first S3 bucket. 🙂
Step 3: Upload an Object
As of now, you can see your created S3 bucket in the list of buckets as seen on above success screenshot
Create a simple text file named demo.txt
Click on the bucket name link to navigate inside the bucket. Once inside, you can upload your file.
Click on Upload
It will lead you to below screen where you can add files or even folders to upload in the bucket.
Click on Add files
Select file from your local system. Once file is loaded, Scroll down the page and click on Upload
Depending on the file size it will take some time to upload your file and once done, you will see below success message.
Step 4: View the Object
At this point of time, we have created an S3 bucket and uploaded a simple text file into it.
Now, it’s time to view the uploaded file.
In the above screen, with the success message You can see your uploaded file in the Files and Folders section.
Click on demo.txt
You will see object overview screen.
Click on the Object URL to view the object.
P.S. – By default, all Amazon S3 buckets and objects are private so on clicking above URL you will get similar error as below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>9X41902RKTPWRJY9</RequestId>
<HostId>thTGy7XWX8RAWbkbA7kCZWhYEZ4ENJhosN0M108EdQZ4273r4KTSVjWoTIJG/IPGsaS9Mfw3bYg=</HostId>
</Error>
And the error is so obvious because the object is not publicly accessible. That’s why you get access denied.
Let’s fix that.
This is gonna be a two stet task.
Step 1: Unblock Public Access on Bucket Level
A newly created bucket is always private by default and all objects belonging to the bucket is private. So let’s unblock that setting on bucket level first.
Click on the Permissions tab on your bucket like below.
Click on Edit.
Uncheck Block all public access checkbox like below.
Click on Save changes
Now as you can see below, objects can be public
Note: Here notice that it says objects can be public and not as objects are public
Well, it means that now you can use various mechanism like bucket policy or Access Control List to allow public access on your object.
Step 2: Allow Public Access on Bucket.
Let’s update the object’s ACL to allow public read. You can do that from console using Make public action
Select the object you would like to make publicly accessible.
Click on Actions drop-down and click Make public
Confirm the dialog box and tada. Your object is public now and you can view it publicly.
Go to Object -> Click on Object Name -> Click on Object URL
and here you are !!
Congratulations once again.!!! You are able to view your uploaded file.
Note: Please note that making an object public using this way makes only that specific object public and all other objects permission is unaffected.
Conclusion
In this in-depth tutorial, You learnt to create S3 bucket in AWS. We went through the creation of S3 Bucket using AWS console in a step by step manner.
We also uploaded a text file, made the object publicly accessible and viewed the file using the object URL.
Enjoyed the content?
Subscribe to our newsletter below to get awesome AWS learning materials delivered straight to your inbox.
Subscribe to our newsletter below to get awesome AWS learning materials delivered straight to your inbox.
I hope you enjoyed this tutorial. If you have a question, feel free to drop in comment. I will be more then happy to answer your query.
Meanwhile you can also –
Suggested Read:
- Understand IAM PassRole to Secure your AWS Infrastructure
- How to Create S3 Bucket using CloudFomation
- AWS S3 Storage Classes: Everything You Need to Know
- AWS SQS Standard vs FIFO Queue
- How to Create S3 Bucket Policy using CloudFomation
- Provision ACM certificate using CloudFormation
- Create SSM Parameter using CloudFormation