Amazon S3
public bucket
URL access
cloud storage
AWS configuration

URL for public Amazon S3 bucket

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

A public S3 object can usually be accessed with a normal HTTPS URL, but the exact URL format depends on whether you mean the standard S3 object endpoint or the static website hosting endpoint. The most common case is a public object URL, where the bucket name and object key are combined into a virtual-hosted-style S3 URL.

Standard Public Object URL

For a bucket named example-bucket and an object key images/logo.png, the common virtual-hosted-style URL is:

text
https://example-bucket.s3.amazonaws.com/images/logo.png

In many regions, you may also see the region in the hostname:

text
https://example-bucket.s3.us-east-1.amazonaws.com/images/logo.png

The exact hostname form depends on the bucket region and AWS endpoint conventions, but the key idea is the same: the URL points to an object, not just to the bucket container by itself.

Public Bucket Does Not Mean "Browse the Bucket Root"

S3 stores objects, not traditional directories. So when people ask for the "URL of a public bucket," they often really mean:

  • the URL of a specific public object
  • the website endpoint of a bucket configured for static hosting

If you only know the bucket name, that is not automatically enough to get a meaningful public web page unless static website hosting is configured.

Static Website Endpoint

If S3 static website hosting is enabled, the bucket gets a website endpoint such as:

text
http://example-bucket.s3-website-us-east-1.amazonaws.com

This endpoint is different from the standard object endpoint:

  • website endpoint is for web-site style hosting
  • standard S3 endpoint is for ordinary object access

If you want index.html behavior and website-style routing, the website endpoint is the relevant one.

Making the Object Public

The URL alone is not enough. The object must actually be readable publicly through bucket policy, object ACL policy model, or equivalent access configuration.

A public-read bucket policy for objects might look like:

json
1{
2  "Version": "2012-10-17",
3  "Statement": [
4    {
5      "Effect": "Allow",
6      "Principal": "*",
7      "Action": "s3:GetObject",
8      "Resource": "arn:aws:s3:::example-bucket/*"
9    }
10  ]
11}

Without public-read access, the URL exists but returns an access error.

Example

If the bucket is my-public-assets and the object key is docs/manual.pdf, then a likely public URL is:

text
https://my-public-assets.s3.amazonaws.com/docs/manual.pdf

If that file is public, opening the URL in a browser should return the object.

Spaces and Special Characters in Keys

Object keys are part of the URL path, so special characters must be URL-encoded properly. For example, a file named my photo.jpg should be requested with an encoded space:

text
https://my-public-assets.s3.amazonaws.com/my%20photo.jpg

If the key contains spaces or other reserved characters and the URL is not encoded correctly, the object may exist and still appear unreachable.

Common Pitfalls

The most common mistake is asking for the bucket URL when the real requirement is a specific object URL. S3 public access is usually about objects, not about a bucket behaving like a browsable folder root.

Another issue is confusing the object endpoint with the static website endpoint. They are related but serve different purposes.

A third pitfall is assuming the URL should work just because the bucket exists. Public accessibility depends on bucket policy and public access settings, not only on the URL shape.

Finally, avoid old path-style assumptions unless you have a very specific legacy reason. Virtual-hosted-style object URLs are the normal pattern to understand first.

Summary

  • The usual public S3 URL is the URL of a specific object, not just the bucket name by itself.
  • Standard object URLs use the S3 endpoint and include the bucket name plus object key.
  • Static website hosting uses a different website endpoint.
  • Public access still depends on the bucket's access policy, not only on URL format.
  • Be clear whether you need direct object access or website-style hosting behavior.

Course illustration
Course illustration

All Rights Reserved.