Prev | Current Page 351 | Next

Brad Ediger

"Advanced Rails"

html. Slash characters, though they often designate hierarchy in URIs, are
treated like any other character in object keys. We can even query keys by prefix,
so we can ask to list keys starting with blog/2007/01/05.
Amazon provides three different URI templates by which objects can be accessed. These
are genuine RESTful URIs; they refer to the resources themselves, and nothing else:
??? http://s3.amazonaws.com/bucketkey/objectkey
??? http://bucketkey.s3.amazonaws.com/objectkey
??? http://bucketkey/objectkey
This last URI is an example of a virtual hosted bucket; by using a DNS name as a
bucket key, and pointing that DNS name at s3.amazonaws.com. via a CNAME, S3 will
recognize the bucket key from the Host header and serve the appropriate object. This
makes it possible to serve an entire domain from S3, nearly transparently. If we create
a bucket called images.example.com, place a JPEG photo in it as an object called
hello.jpg, and ensure the proper CNAME is set up pointing images.example.com. to
s3.amazonaws.com., then our image is accessible at http://images.example.com/hello.jpg
with a standard web browser, just as if we had an HTTP server serving that URI.
Authentication
Because Amazon was not tied to the limitations of existing HTTPclients, it did not
have to bow to the limitations of HTTPBasic or Digest authentication in web browsers
when creating S3. The S3 authentication protocol is a thin layer, adding an
HMAC signature to each request.


Pages:
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363