AWS

How to Access AWS S3 Bucket from Browser

The S3 buckets in AWS S3 service are used for storing files and folders as their objects. The objects of the buckets are then accessed from the browser by simply typing the “Object URL” of the objects stored in the buckets. An S3 bucket can be accessed from the browser if it is made publicly accessible. This is done by editing the permission policies of an already created S3 bucket and changing the bucket status from private to public.

In this article, we will discuss the whole process of creating and then accessing the S3 bucket from the browser.

Accessing S3 Bucket from Browser

To start the process of accessing the S3 bucket from browser from the scratch, follow the step given below:

  • Create an S3 Bucket
  • Upload objects to the Bucket
  • Edit bucket policy
  • Access from the browser

Step 1: Create an S3 Bucket
Open the S3 service of AWS after logging in to the AWS console and create a new bucket:

After adding details and configuring the S3 bucket, click on the “Create bucket” button:

Step 2: Upload Objects to the Bucket
It is required to add at least one object of any file type and format into the bucket. The object uploaded into the bucket will be accessed from the browser like a static website:

For instance, we have uploaded a few objects in different file formats:

Now, go to the permissions section and change the “Block public access” status if it is displayed as “On”:

Unmark the “Block all public access” option and save the changes:

Step 3: Edit Bucket Policy
Now, edit the bucket policy by scrolling down to the “Bucket policy” option. Click on the “Edit” button:

In the “Edit bucket policy”, select the “Policy generator” option:

This will direct the user to a different interface in a new tab. Now, select the type of policy as “S3 Bucket Policy”, type “*” in the space given for “Principal”, select “GetObject” from the Actions dropdown, and paste the ARN copied from the S3 bucket details with “/*” symbols in the end. And then click on the “Add Statement” option:

This will generate a policy according to the details added in the previous step. Copy the policy code:

Go back to the AWS S3 bucket details and then paste the policy code into it:

This will change the bucket status from private to public. Now, the bucket is publicly accessible and can be accessed from the browser:

Select any object file from the created S3 bucket and go to its details:

Now, copy the “Object URL” of the object:

Step 4: Access From the Browser
Simply paste the copied Object URL into the web browser. This will open the file like a static website. The file we selected was a simple text file that was stored on the system:

This was all about accessing the AWS S3 bucket from the web browser.

Conclusion

The objects stored in the AWS S3 bucket can be accessed from the browser if the bucket is made publicly accessible. This requires editing and generating a new policy for the S3 bucket. The Objects in any file format can be stored in the S3 bucket, and the URL of the objects is used to open the files in the browser. This article explained the process of accessing the S3 bucket from the web browser.

About the author

Hadia Atiq

A Software Engineer and Technical Writer passionate about learning and spreading knowledge of the latest technology. I utilize my writing skills to help readers understand the importance and usage of modern technology.