Introduction to Amazon S3
Topics
This introduction to Amazon S3 is intended to give you a detailed summary of this web service. After reading this section, you should have a good idea of what it offers and how it can fit in with your business.
Overview of Amazon S3
Amazon S3 is storage for the Internet. It is designed to make web-scale computing easier for developers.
Amazon S3 has a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites. The service aims to maximize benefits of scale and to pass those benefits to developers.
Advantages to Amazon S3
Amazon S3 is intentionally built with a minimal feature set that focuses on simplicity and robustness. Following are some of advantages of the Amazon S3 service:
-
Create Buckets—Create and name a bucket that stores data
Buckets are the fundamental container in Amazon S3 for data storage.
-
Store data in Buckets—Store an infinite amount of data in a bucket
Upload as many objects as you like into an Amazon S3 bucket. Each object can contain up to 5 GB of data. Each object is stored and retrieved using a unique developer-assigned key.
-
Download data—Download your data or enable others to
Download your data any time you like or allow others to do the same.
-
Permissions—Grant or deny access to others who want to upload or download data into your Amazon S3 bucket
Grant upload and download permissions to three types of users. Authentication mechanisms to ensure that data is kept secure from unauthorized access.
-
Standard interfaces—Use standards-based REST and SOAP interfaces designed to work with any Internet-development toolkit.
Amazon S3 Concepts
Topics
This section describes key concepts and terminology you need to understand to use Amazon S3 effectively. They are presented in the order you will most like encounter them.
Buckets
A bucket is simply a container for objects stored in Amazon S3. Every object is
contained within a bucket. For example, if the object named
photos/puppy.jpg
is stored in the johnsmith
bucket,
then it is addressable using the URL
http://johnsmith.s3.amazonaws.com/photos/puppy.jpg
Buckets serve several purposes: they organize the Amazon S3 namespace at the highest level, they identify the account responsible for storage and data transfer charges, they play a role in access control, and they serve as the unit of aggregation for usage reporting.
For more information about buckets, see Working with Amazon S3 Buckets.
Objects
Objects are the fundamental entities stored in Amazon S3. Objects consist of object data and metadata. The data portion is opaque to Amazon S3. The metadata is a set of name-value pairs that describe the object. These include some default metadata such as the date last modified, and standard HTTP metadata such as Content-Type. The developer can also specify custom metadata at the time the Object is stored.
Keys
A key is the unique identifier for an object within a bucket. Every object in a bucket has exactly one key. Since a bucket and key together uniquely identify each object, Amazon S3 can be thought of as a basic data map between "bucket + key" and the object itself. Every object in Amazon S3 can be uniquely addressed through the combination of the web service endpoint, bucket name, and key, as in http://doc.s3.amazonaws.com/2006-03-01/AmazonS3.wsdl, where "doc" is the name of the bucket, and "2006-03-01/AmazonS3.wsdl" is the key.
Operations
Amazon S3 offers APIs in REST and SOAP. Following are the most common operations you'll execute through the API.
Common Operations
-
Create a Bucket—Create and name your own bucket in which to store your objects.
-
Write an Object—Store data by creating or overwriting an object.
When you write an object, you specify a unique key in the namespace of your bucket. This is also a good time to specify any access control you want on the object.
-
Read an Object—Read data back.
You can choose to download the data via HTTP or BitTorrent.
-
Deleting an Object—Delete some of your data.
-
Listing Keys—List the keys contained in one of your buckets.
You can filter the key list based on a prefix.
Details on this and all other functionality are described in detail later in this guide.
Amazon S3 Application Programming Interfaces (API)
The Amazon S3 architecture is designed to be programming language-neutral, using our supported interfaces to store and retrieve objects.
Amazon S3 provides a REST and a SOAP interface. They are similar, but there are some differences. For example, in the REST interface, metadata is returned in HTTP headers. Because we only support HTTP requests of up to 4 KB (not including the body), the amount of metadata you can supply is restricted.
The REST Interface
The REST API is an HTTP interface to Amazon S3. Using REST, you use standard HTTP requests to create, fetch, and delete buckets and objects.
You can use any toolkit that supports HTTP to use the REST API. You can even use a browser to fetch objects, as long as they are anonymously readable.
The REST API uses the standard HTTP headers and status codes, so that standard browsers and toolkits work as expected. In some areas, we have added functionality to HTTP (for example, we added headers to support access control). In these cases, we have done our best to add the new functionality in a way that matched the style of standard HTTP usage.
The SOAP Interface
The SOAP API provides a SOAP 1.1 interface using document literal encoding. The most common way to use SOAP is to download the WSDL (go to http://doc.s3.amazonaws.com/2006-03-01/AmazonS3.wsdl), use a SOAP toolkit such as Apache Axis or Microsoft .NET to create bindings, and then write code that uses the bindings to call Amazon S3.
Amazon S3 Data Consistency Model
Updates to a single key are atomic. For example, if you PUT to an existing key, a subsequent read might return the old data or the updated data, but it will never write corrupted or partial data.
Amazon S3 achieves high availability by replicating data across multiple servers within Amazon's data centers. After a "success" is returned, your data is safely stored. However, information about the changes might not immediately replicate across Amazon S3 and you might observe the following behaviors:
-
A process writes a new object to Amazon S3 and immediately attempts to read it. Until the change is fully propagated, Amazon S3 might report "key does not exist."
-
A process writes a new object to Amazon S3 and immediately lists keys within its bucket. Until the change is fully propagated, the object might not appear in the list.
-
A process replaces an existing object and immediately attempts to read it. Until the change is fully propagated, Amazon S3 might return the prior data.
-
A process deletes an existing object and immediately attempts to read it. Until the deletion is fully propagated, Amazon S3 might return the deleted data.
-
A process deletes an existing object and immediately lists keys within its bucket. Until the deletion is fully propagated, Amazon S3 might list the deleted object.
Note | |
---|---|
Amazon S3 does not currently support object locking. If two puts are simultaneously made to the same key, the put with the latest time stamp wins. If this is an issue, you will need to build an object-locking mechanism into your application. Updates are key-based; there is no way to make atomic updates across keys. For example, you cannot make the update of one key dependent on the update of another key unless you design this functionality into your application. |
Related Amazon Web Services
Once we load your data into AWS you can use it with all AWS services. The following services are the ones you might use most frequently:
-
Amazon ElasticCompute Cloud—This web service provides virtual compute resources in the cloud.
For more information, go to Amazon ElasticCompute Cloud.
-
Amazon Elastic MapReduce—This web service enables businesses, researchers, data analysts, and developers to easily and cost-effectively process vast amounts of data.
It utilizes a hosted Hadoop framework running on the web-scale infrastructure of Amazon Elastic Compute Cloud (Amazon EC2) and Amazon Simple Storage Service (Amazon S3). For more information, go to Amazon Elastic MapReduce.
-
Amazon Import/Export—This service enables you to mail a storage device, such as a RAID drive, to Amazon so that we can upload your (terabytes) of data onto Amazon S3. For more information, go to AWS Import/Export Developer Guide>.