Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » AWS/Azure/OpenShift » How to grant public access to S3 Bucket using Policy

How to grant public access to S3 Bucket using Policy

Posted on 04/04/202215/12/2023 Imoh Etuk By Imoh Etuk No Comments on How to grant public access to S3 Bucket using Policy
How to grant public access to S3 Bucket using Policy

In this article, you will learn how to grant public access to S3 Bucket using Policy. This means you will be acquainted with the steps to generate and add a bucket policy to an Amazon S3 bucket to grant public access to any data stored on it, but first, let’s take a look at what Amazon S3 is all about. Please see How to sync S3 Bucket with an EC2 instance, Hosting Static Website and Versioning on AWS S3, and How to delete AWS S3 Bucket and Objects via  AWS CLI from Linux.

What is Amazon S3?

Amazon S3, also known as Amazon Simple Storage Service, is a service provided by Amazon Web Services that offers object storage via a web service interface. It is one of the most popular storage solutions when compared to file and block storage solutions such as Amazon Elastic File System (EFS) and Amazon Elastic Block Stores (EBS).

When we talk about an object storage solution with industry-leading scalability, availability, and security that allows you to store and retrieve any amount of data from any location, we are simply referring to Amazon S3.

All data stored on the S3 storage solution are stored in a component known as an S3 Bucket. Also, see how to enable Amazon S3 default bucket encryption using S3 Console.

S3 Bucket policy

By default, Amazon S3 blocks all public access to data stored in the S3 bucket. This means that access to an S3 bucket’s data is restricted. However, you can grant public access by adding a policy – known as an S3 Bucket Policy.

But why is a bucket policy necessary? Well, it’s essential to provide multiple users with access to a bucket. Moreover, it allows you to control account access for reading and uploading files.

In situations involving critical data, implementing a bucket policy can prevent users from unauthorized additions or removals of buckets.

You may also be interested in reading these related articles: How to integrate AWS CodeBuild and AWS CodeCommit to SonarCloud, How to deploy a React Application to AWS S3, How to deploy an Angular App to AWS S3 and How to redirect requests for your bucket’s website endpoint to another bucket or domain

An S3 bucket policy is a type of object that allows you to control who has access to specific Amazon S3 storage resources. 

Note: You should only do this on selected occasions or based on a special request authorized by your organization, as granting access to the S3 bucket with critical data can expose your data to the public, which can also be subject to abuse. Therefore, you should only grant access to temporary data that you know needs public access!

Prerequisite to accessing S3 Bucket

To follow along without missing a step in this post, you need to have an active AWS account with access to the AWS Management Console. If you don’t have an active AWS account with a subscription, Amazon has made it very easy for you as you can enjoy the AWS Free-Tier without being charged.

If the above requirements are in place, proceed with me to the next steps below:

Step 1: Sign in to your AWS Management Console

To get started, sign in to the AWS Management Console as either a root user or an IAM user, or sign up for an AWS Free account if you’re a new user.

AWS Console Sign in Page
AWS Sign in & Sign up page

Step 2: Select S3 in your Console

Search for and click on S3 using the horizontal search bar on the AWS Management Console

Search For S3 Bucket
Search for S3

Step 3: Create the S3 Bucket you want to grant public access to

When you click on the S3, you will be taken to the console. In the S3 Console, click on “Create bucket” as shown below:

Create an S3 bucket
Create a bucket

Step 3: Give your S3 Bucket a unique name

Next, give your bucket a unique name and proceed to supply other information.

Note: Because S3 is a global service on the AWS Cloud, your bucket name must be unique and must not already be taken. It must not also contain a special character like an underscore (_).

Step 4: Uncheck “Block all public access”

Remember to uncheck “Block all public access ” and mark the checkbox below to acknowledge your consent to grant public access to the S3 bucket.

Unchecking the "Block all public access" is the first step to granting public access to the S3 bucket.

Uncheck the block public access
Accept bucket public access consent

After the public access has been unchecked, proceed to create the bucket. As you can see the access level to our bucket in the below screenshot is indicated as “Objects can be public” which means it’s not public yet.

We have succesfully created an S3 Bucket

Step 5: Add the files grant public access to in your S3 Bucket

Next, we will create a bucket policy, but before then, we need to add a file to the bucket and try to access the file URL to get an access denied prompt, which is the issue we’re about to solve in this article.

Here, we will upload a simple text.txt file to the bucket. You can upload any kind of file provided that granting public access to the file on your S3 bucket won’t cause any damage to you.

To upload a file to the bucket, double click on the bucket name > Objects > Upload > Add files >Click on upload

File Upload successful
File uploaded

Step 6: Navigate to the Object URL

Now, navigate to the Object URL by double-clicking on the file name. The URL should look like https://bucket-name.s3.amazonaws.com/filename. You will be denied access to the content of the file from your browser when you double click to open the URL. See the screenshot below:

bucket access denied

Step 7: Edit an S3 Bucket policy to grant public access

Now, let’s generate an S3 bucket policy to public allow access. To do so, click to go back to the bucket. Click on the permission tab and scroll down to where you have "Bucket Policy" and click on the Edit button.

Open the permission tab
Bucket Permission
Click on Edit
Set bucket policy

After clicking on the edit button to open the policy creation console, click on Policy generator to open on a new browser tab.

Note your Amazon Resource Name (ARN) as it will be required in the new browser tab where you will generate the policy – ARN is a file naming convention used to identify a particular resource in the Amazon Web Services (AWS) public cloud.

Generate Policy
Policy generator

Step 8: Generate an S3 Bucket policy to grant public access

On the new browser tab to generate the policy, under Select Type of Policy, select S3 bucket policy from the list of policies in the drop-down menu leaving the Effect directly below it as “Allow”. Under the principal column, type asterisk (*) which means it will grant public access.

Next, move to the Actions column and select the GetObject action, copy and paste your ARN arn:aws:s3:::techda-store/* from the Edit Bucket Policy Console. Add a forward slash(/) and asterisk to the ARN.

What this means is that it will allow all objects stored in this bucket to be accessible. Now, click on “Add statement”

Add policy Statement
Add policy statement

Now, click on generate policy to generate the policy.

Generate Policy statement to generate script that will grant public access to S3 bucket
Generate policy

After generating the policy, a dialog box containing the policy script will pop-up. Now highlight and copy the policy script and paste it under the policy section within the bucket console.

Copy and paste policy script to grant  public access to S3 bucket
Copy the policy script

Click on save changes after you have pasted the script.

You have now granted public access to your S3 bucket
Bucket is publicly accessible

As shown in the screenshot above, we have successfully granted public access to our S3 Bucket using policy.

Lastly, let’s browse to the object URL once again and read the content of the file as shown below:

Browse to the text file
Object now accessible to the public

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • Share on Nextdoor (Opens in new window) Nextdoor
AWS/Azure/OpenShift

Post navigation

Previous Post: Install and configure Prometheus for Monitoring on a Linux
Next Post: How to sync S3 Bucket with an EC2 instance

Related Posts

  • Storage Explorer
    How to Install Azure Storage Explorer on Windows AWS/Azure/OpenShift
  • Ec2 Instance
    How to create an EC2 Instance AWS/Azure/OpenShift
  • ADO Self hosted agent
    How to Create Self-Hosted Agent for Azure DevOps Pipelines Automation
  • a Multiple SPF Records  Issues and Examples@2x
    How to setup SPF and TXT Records in AWS AWS/Azure/OpenShift
  • images 2 1
    How to create an AMI using AWS console AWS/Azure/OpenShift
  • Microsoft Enterprise Root Certification Authority and Forest Domain to Azure migration
    Migrate Microsoft Enterprise Root Certification Authority and Forest Domain to Azure AWS/Azure/OpenShift

More Related Articles

Storage Explorer How to Install Azure Storage Explorer on Windows AWS/Azure/OpenShift
Ec2 Instance How to create an EC2 Instance AWS/Azure/OpenShift
ADO Self hosted agent How to Create Self-Hosted Agent for Azure DevOps Pipelines Automation
a Multiple SPF Records  Issues and Examples@2x How to setup SPF and TXT Records in AWS AWS/Azure/OpenShift
images 2 1 How to create an AMI using AWS console AWS/Azure/OpenShift
Microsoft Enterprise Root Certification Authority and Forest Domain to Azure migration Migrate Microsoft Enterprise Root Certification Authority and Forest Domain to Azure AWS/Azure/OpenShift

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

Veeam Vanguard

  • Norton Antivirus Free Download For Mac 1st
    How to fix repeated app-blocking connection alerts from Norton on Mac Mac
  • wordpresserrorsiteadmin
    There has been a critical error on this website please check your site admin email inbox for instructions Web Server
  • Disable Lock Screen on Windows
    How to disable Lock Screen on Windows 10 Windows
  • speedtest
    How to set up a self-hosted speed test server on Ubuntu Linux Linux
  • Screenshot 2024 02 29 at 4.47.19 PM
    How to reset MacBook password after all other options fail Mac
  • 87a26c60 0001 0004 0000 000001423515 w948 r1.77 fpx54.99 fpy56.04
    Administer LXC Containers: Easy Guide Virtualization
  • How to Block IP Addresses Using Group Policy (GPO) in Active Directory
    Block IP Addresses Using Group Policy (GPO) in Active Directory Network | Monitoring
  • Retrict access to external storage
    Restrict access to removable Storage Drives [Part 2] Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,819 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

Active Directory Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.