Image

Amazon Web Services (AWS)

How to create private S3 bucket in AWS

If not specified, S3 buckets are by default private. This is to ensure objects in these buckets which are not meant for public consumption are not accessible to everyone.

The following are steps in creating a private S3 bucket.

  1. On S3 main screen, click on the Create Bucket button.
  2. Choose a unique name for your bucket and choose the region that you want your S3 bucket to be hosted. Click Create.

    The name must be unique regardless of regions. You’ll get an error when trying to use bucket name already being used anywhere within S3

  3. Once created, you can see the details of your bucket by clicking on the Properties tab.
  4. Load the bucket that you’ve just created by clicking on the name.
  5. Upload a file to your S3 bucket to test by clicking on Upload from the Actions select button.
  6. Click on the Add Files button.
  7. Select the files that you want to upload.
  8. Click on the Start Upload button to start uploading the files you’ve just selected.
  9. Select the object from the list on the left, and click on the Properties tab. Then click on the hyperlink of the file in Link.
  10. You should get this permission error when accessing the object.

How to create public S3 bucket in AWS

S3 buckets are by default private. You can configure your S3 buckets to be publicly accessible by applying appropriate bucket policy with the following steps. Be warned that his method will make the whole content of the bucket public.

  1. Create a private S3 bucket if you don’t already have one.

  2. In the AWS S3 console, select the bucket that you want to make public.
  3. Click on the Properties tab to the top right of the page and click on the Permissions card.
  4. Click on Add bucket policy link.
  5. Here you can use the AWS Policy Generator via the link at the bottom left, or just paste the following code at the editor.

    {
      "Version":"2012-10-17",
      "Statement":[
        {
          "Sid":"AddPerm",
          "Effect":"Allow",
          "Principal": "*",
          "Action":["s3:GetObject"],
          "Resource":["arn:aws:s3:::osdocs-testbucket/*"]
        }
      ]
    }

    Make sure you replace osdocs-testbucket with your own bucket name.


  6. Click on the Save button.
  7. And click on the Save button again here.
  8. Within your bucket, select any of your object and click on the Properties tab.
  9. Click on the link for your object.
  10. You should be able to view your content now.

Top