How to create a public Amazon S3 bucket on AWS console

May 23, 2020 | By Gerald | Filed in: AWS.
Create a new bucket on Amazon S3

In this guide, you will learn how to create a public Amazon S3 bucket within the AWS management console. By default, Amazon S3 bucket is private accessible to avoid exposure of data in public facing. If you want to use a bucket to host a static website, you can use these step by step guide.

Note: Buckets are globally unique across all AWS account and you cannot create a bucket in another bucket.

What will you do

  1. Create Amazon S3 Bucket
  2. Upload Object on S3 bucket
  3. Access the Object URL on S3 Bucket
  4. Enable S3 Bucket on Public Access
  5. Verify the Object URL on Public Access

Requirements

To get started, this guide will show you on how to create and public an Amazon S3 bucket on AWS Management Console.

Step 1. Create Amazon S3 Bucket

While signed in to the AWS Management Console with a user who has S3 permissions or either root account. Open the Amazon S3 Console and select Create Bucket.

Provide a globally unique name for the bucket, and choose the appropriate region.

create s3 bucket

If you want to enable your bucket on public access, you can uncheck the Block all public access checkbox, but for now leave all default settings and proceed to Create Bucket.

S3 bucket ACL settings

Now you have created a newly S3 bucket.

new created S3 bucket

Step 2. Upload Object on S3 bucket

After you create a bucket, you can upload your objects (for example, your photo or video files). To upload objects, click on the bucket name and choose Uploads.

upload new object to s3 bucket

Step #1. Add sample objects (e.g your photos).

Step #2. You can set permissions to your object, but for now leave all default.

Step #3. Set properties, select which storage class you want to store you files, but for now leave all default for standard storage class.

set permission for newly uploaded s3 object

Step #4. Review and proceed to click Uploads.

Now, this will be your newly object uploaded.

s3 uploaded object

Step 3. Access the Object URL on S3 Bucket

When you saved your files into S3 bucket, there is a unique URI created for each object, which include bucket name as the domain.

Now, select the uploaded photo and popup box will prompt contains file information and then click on the Object URL to access the photo on web browser.

s3 object url

Next, You will see in the web browser the bucket has denied to access the object.

s3 access denied object

By default, the permissions on an object are private, but you can set up access control policies to grant permissions to others.

Step 4. Enable S3 Bucket on Public Access

You can create a public object using individual Actions, but this is not often necessary compared to enabling the S3 bucket. When an object is uploaded to the bucket your object is automatically accessible on publicly.

Now, Go to the Permissions tab and select Edit and then uncheck Block all public access boxes to give everyone read access to the object and click Save.

enable bucket on public access

Next, the popup box verification will prompt and then type confirm in the field.

public access bucket enable confirmation

Next, Select Bucket Policy under Permissions tab and use the following S3 policy below on editor area and then replace lb-testbucket1 with your full bucket name.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Public S3 Bucket",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::lb-testbucket1/*"
        }
    ]
}

Now save the bucket policy, and you will see a warning sign that your bucket will be granted now on public access.

public accessible s3 bucket

Step 5. Verify the Object URL on Public Access

Go the the Overview tab and select your uploaded image and then click Actions and choose Open. You will redirected to a new web browser window.

open s3 bucket object

Then, You should now see your image look like this.

s3 object on public access

That’s all.

Finally, you have now created a bucket and loaded content that is web-enabled and publicly accessible.

I hope this tutorial helped you and feel free to comment section below for more suggestions.

SHARE THIS ARTICLE

Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *