Parse a Virtual-Hosted Style S3 URL

Learn how to parse the most common S3 URL format where the bucket name is part of the hostname. Extract bucket, key, and region from virtual-hosted style URLs.

Virtual-Hosted Style

Detailed Explanation

Virtual-Hosted Style: The Default S3 URL Format

Virtual-hosted style is the recommended and default URL format for Amazon S3. In this format, the bucket name appears as a subdomain of the S3 endpoint hostname.

URL Structure

https://BUCKET.s3.REGION.amazonaws.com/KEY

Example

https://my-app-assets.s3.us-west-2.amazonaws.com/images/logo.png

Parsed Components

Component Value
Bucket my-app-assets
Key images/logo.png
Region us-west-2
Style Virtual-Hosted

Why Virtual-Hosted Style?

AWS made virtual-hosted style the default for several reasons:

  1. DNS-based routing — S3 can route requests to the correct regional endpoint based on the bucket name in the hostname.
  2. SNI support — Enables HTTPS with bucket-specific certificates.
  3. Deprecation of path style — Since September 2020, newly created buckets only support virtual-hosted style for path-style requests to the global endpoint.

Important Notes

  • The bucket name must be DNS-compliant: lowercase, no underscores, 3-63 characters.
  • Some older buckets with dots in their name (e.g., my.bucket.name) may not work with virtual-hosted style over HTTPS due to certificate wildcard matching limitations.
  • The region portion is required for regional endpoints but optional when using the global endpoint (s3.amazonaws.com).

Use Case

Debugging access denied errors by verifying that the bucket name and region in a CloudFront origin URL match the actual S3 bucket configuration.

Try It — AWS S3 URL Parser

Open full tool