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

Bucket operations

All objects in S3 system are stored in buckets. Bucket has to be created before any storage operation. Bucket name is unique in the system, so you can not have bucket named the same as someone else's bucket.

Bucket name can contain lowercase letters, digits, periods (.), underscores (_), and dashes (-). No other symbols allowed. Bucket name should start with letter or digit, and be 3 to 255 characters long. Names looking like an IP address (e.g. "") are not allowed.

  • createBucket() creates a new bucket.

  • cleanBucket() removes all objects that are contained in a bucket.

  • removeBucket() removes the bucket from the system. The bucket should be empty to be removed.

    Example 770. Zend_Service_Amazon_S3 Bucket Removal Example

    require_once 'Zend/Service/Amazon/S3.php';

    $s3 = new Zend_Service_Amazon_S3($my_aws_key$my_aws_secret_key);


  • getBuckets() returns the list of the names of all buckets belonging to the user.

    Example 771. Zend_Service_Amazon_S3 Bucket Listing Example

    require_once 'Zend/Service/Amazon/S3.php';

    $s3 = new Zend_Service_Amazon_S3($my_aws_key$my_aws_secret_key);

    $list $s3->getBuckets();
    $list as $bucket) {
    "I have bucket $bucket\n";

  • isBucketAvailable() check if the bucket exists and returns TRUE if it does.

Zend Framework