Skip to content
This repository has been archived by the owner on May 28, 2020. It is now read-only.

Buckets

pfig edited this page Dec 11, 2011 · 2 revisions

LWP 6.x

As of LWP 6.x, LWP::UserAgent will refuse the certificate (quite rightly) if the bucket name contains dots (as the virtual host will be a.b.s3.amazonaws.com, which doesn't match *.amazonaws.com). A possible solution is to use path-based access instead of virtual hosts (CPAN bug #66644), but see below.

Path-based access

There are a few caveats when accessing a bucket with the path-based approach, as opposed to the virtual host.

You need to cal the API using the region-specific endpoint where the bucket was created

Amazon has this to say:

Amazon S3 supports virtual-hosted-style and path-style access in all Regions. The path-style syntax, however, requires that you use the region-specific endpoint when attempting to access a bucket. For example, if you have a bucket called mybucket that resides in the EU, you want to use path-style syntax, and the object is named puppy.jpg, the correct URI is http://s3-eu-west-1.amazonaws.com/mybucket/puppy.jpg. You will receive a “PermanentRedirect” error, an HTTP response code 301, and a message indicating what the correct URI is for your resource if you try to access a non US Standard bucket with path-style syntax using:

Buckets created using CreateBucketConfiguration cannot be accessed through a path-based request

Amazon's note about this is here.