public
Description: personal scripts
Homepage:
Clone URL: git://github.com/mackstann/bin.git
bin / mks3bucket
100755 20 lines (13 sloc) 0.386 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl -w
 
use Net::Amazon::S3;
 
my $s3 = Net::Amazon::S3->new({
    aws_access_key_id => $ARGV[1],
    aws_secret_access_key => $ARGV[2],
    retry => 1
});
 
 
$s3->add_bucket({bucket => $ARGV[0]})
    or die "failed: " . $s3->errstr;
 
my $response = $s3->buckets;
foreach my $bucket ( @{ $response->{buckets} } ) {
    print "You have a bucket: " . $bucket->bucket . "\n";
}