PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Zend Framework 101: Zend_Service_Amazon_S3

Amazon S3 Buckets

All data stored in Amazon S3 is stored in buckets. A bucket is a collection of data - think of each bucket as a separate drive on your computer.

Before you can store any data on Amazon S3, you must create a bucket. Each account can have up to 100 buckets. Once the bucket has been created, all subsequent operations (such as reading, writing or deleting files) occur on a single bucket.

Caution: Buckets share a common namespace with all users of Amazon S3. For example, if you try to create a bucket called test, you probably won't be able to since somebody else has probably already taken that name. If you are going to automate creation of buckets, you should use a consistent naming scheme, and should also handle failures should the requested name not be available. If you're going to store files for a specific domain name, perhaps the name of the bucket could be the same as the domain name.

Every file you store in an Amazon S3 bucket is called an object. Every object has a unique key, which is the value you use to reference the object (e.g. to download or delete the file). You can use any naming structure you like, but if you want to store files in a hierarchical manner (such as files and folders), you can name your objects accordingly.

For instance, if you want to store a file called logo.png in a directory called images, you might give that object a key of images/logo.png.

In This Article



Bonus listings: 2 available