Parse a Path-Style S3 URL
Understand the legacy path-style S3 URL format where the bucket name is the first segment of the URL path. Learn when path-style is still required.
Path Style
Detailed Explanation
Path-Style URLs: The Legacy Format
In path-style URLs, the bucket name is the first segment of the URL path rather than a subdomain of the hostname. While AWS has deprecated this format for new buckets, it remains important to understand for working with legacy systems.
URL Structure
https://s3.REGION.amazonaws.com/BUCKET/KEY
Example
https://s3.us-east-1.amazonaws.com/legacy-data-bucket/exports/users.csv
Parsed Components
| Component | Value |
|---|---|
| Bucket | legacy-data-bucket |
| Key | exports/users.csv |
| Region | us-east-1 |
| Style | Path Style |
Deprecation Timeline
- September 30, 2020: AWS announced that new buckets will only support virtual-hosted style requests via the global
s3.amazonaws.comendpoint. - Existing buckets: Path-style requests continue to work for buckets created before the cutoff date.
- Regional endpoints: Path-style requests to region-specific endpoints (
s3.REGION.amazonaws.com) continue to work for all buckets.
When Path Style Is Still Needed
- Bucket names with dots — e.g.,
my.bucket.v2— cannot use virtual-hosted style over HTTPS because the SSL certificate for*.s3.amazonaws.comdoes not match multi-level subdomains. - S3-compatible services — Many on-premises or third-party S3-compatible systems (MinIO, Ceph, etc.) use path-style by default.
- Testing and development — LocalStack and similar tools often use path-style URLs.
Converting to Virtual-Hosted Style
Path-style:
https://s3.us-east-1.amazonaws.com/my-bucket/file.txt
Virtual-hosted:
https://my-bucket.s3.us-east-1.amazonaws.com/file.txt
Use Case
Migrating an application from path-style to virtual-hosted style URLs before AWS fully deprecates path-style access, ensuring all references in configuration files, CDN origins, and application code are updated.