Databases Reference
In-Depth Information
all the web pages in only part of the web were stored in a single key-value store system,
there might be billions or trillions of key-value pairs. But each key would be unique,
like a
URL
to a web page is unique.
The ability to use a
URL
as a key allows you to store all of the static or unchanging
components of your website in a key-value store. This includes images, static
HTML
pages,
CSS
, and JavaScript code. Many websites use this approach, and only the
dynamic portions of a site where pages are generated by scripts are
not
stored in the
key-value store.
4.1.5
Use case: Amazon simple storage service (S3)
Many organizations have thousands or millions of digital assets they want to store.
These assets can include images, sound files, and videos. By using Amazon Simple
Storage Service, which is really a key-value store, a new customer can quickly set up a
secure web service accessible to anyone as long as they have a credit card.
Amazon S3, launched in the U.S. in March 2006, is an online storage web service
that uses a simple
REST
API
interface for storing and retrieving your data, at any time,
from anywhere on the web.
At its core, S3 is a simple key-value store with some enhanced features:
It allows an owner to attach metadata tags to an object, which provides addi-
tional information about the object; for example, content type, content length,
cache control, and object expiration.
It has an access control module to allow a bucket/object owner to grant rights
to individuals, groups, or everyone to perform put, get, and delete operations
on an object, group of objects, or bucket.
At the heart of S3 is the
bucket
. All objects you store in S3 will be in buckets. Buckets
store key/object pairs, where the key is a string and the object is whatever type of data
you have (like images,
XML
files, digital music). Keys are unique within a bucket,
meaning no two objects will have the same key-value pair. S3 uses the same
HTTP
REST
verbs (
PUT
,
GET
, and
DELETE
) discussed earlier in this section to manipulate objects:
New objects are added to a bucket using the
HTTP
PUT
message.
Objects are retrieved from a bucket using the
HTTP
GET
message.
Objects are removed from a bucket using the
HTTP
DELETE
message.
To access an object, you can generate a
URL
from the bucket/key combination; for
example, to retrieve an object with a key of
gray-bucket
in a bucket called
testbucket
,
The result on your screen would be
the image shown in figure 4.9.
In this section, we looked at key-value
store systems and how they can benefit
an organization, saving them time and
money by moving the focus from archi-
Figure 4.9
This image is the
result of performing the
http://testbucket.s3
.png
GET request from an
Amazon S3 bucket.