Advanced Rails - Building Industrial-Strength Web Apps in Record Time

(Tuis.) #1
Case Study: Amazon S3 | 231

Action Web Service


Action Web Service (AWS) is a client and server library for SOA Pand XML-R PC
web services. It used to be the default web service component in Rails, but it has
actually since been dropped from Rails 2.0 in favor of ActiveResource and RESTful
interfaces.


AWS is still being maintained as a separate library, and is still a good choice for those
who need to interoperate with SOA Por XML-R PC applications. It is discouraged for
greenfield development, though; current best practices support the use of RESTful
HTT Parchitectures. Thus, we will not go into detail here on its usage. A PI Docu-
mentation for AWS is available athttp://aws.rubyonrails.org/, and the library itself
can be installed as a gem (gem install actionwebservice).


Case Study: Amazon S3


Amazon S3 (Simple Storage Service) is an online file-storage web service provided by
Amazon. It is unique among online storage services in several ways:



  • It has a no-minimum pricing structure. Storage is billed by the GB-month, band-
    width is billed by the GB, and there is an additional charge perGET,PUT, andLIST
    request.

  • There is no web interface to create objects; the only full mode of access is
    through the API.

  • It is generally agreed that the S3 API is the first large public API that calls itself
    RESTful and actually lives up to the principles of REST.

  • In addition to the rich HTT Pweb service interface, S3 can serve objects over
    plain HTT P(without any custom HTT Pheaders) and BitTorrent. Many organi-
    zations use S3 as a storage network for their static content because it can serve
    images, CSS, and JavaScript just as well as a standard web server.


The full documentation for the S3 API is athttp://aws.amazon.com/s3. We will now
look into the basic architecture of S3, its concepts, and its set of operations.


Concepts and Terminology


S3 is used to storeobjects, which are streams of data with akey(a name) and
attached metadata. They are like files in many ways. Objects are stored inbuckets,
which also have a key. Buckets are like filesystem directories, with a few differences:



  • Bucket names must be unique across the entire S3 system. You cannot pick a
    bucket name that has already been chosen by someone else.

  • Bucket names must be valid DNS names (alphanumeric plus underscore, period,
    and dash).

Free download pdf