Skip to content

Instantly share code, notes, and snippets.

@pirasakat
Created November 20, 2012 03:35
Show Gist options
  • Select an option

  • Save pirasakat/4115785 to your computer and use it in GitHub Desktop.

Select an option

Save pirasakat/4115785 to your computer and use it in GitHub Desktop.
PHP script to list bucket names on Amazon S3
#!/usr/bin/php
/*
Script to list buckets for Amazon S3
Usage
$ ./aws_s3_list_buckets.php bucket_name
*/
<?php
error_reporting(E_ALL);
require_once('sdk.class.php');
$s3 = new AmazonS3();
$buckets = $s3->get_bucket_list();
foreach ($buckets as $bucket)
{
print($bucket . "¥n");
}
exit(0);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment