Created
May 5, 2012 16:51
-
-
Save sourishkrout/2603993 to your computer and use it in GitHub Desktop.
Small node.js utility to reset s3 buckets and their contents to a private state.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function() { | |
var awssum = require('awssum') | |
var amazon = awssum.load('amazon/amazon') | |
var s3Service = awssum.load('amazon/s3') | |
var opts = require('nomnom').parse() | |
var _ = require('underscore') | |
_.each(amazon, function(region) { | |
// List operations return buckets regardless of their origin. Iterating over the regions seems to be redundant. | |
if (typeof region === 'string' && region === 'us-east-1') { | |
var s3 = new s3Service(opts['access_key_id'], opts['secret_access_key'], opts['aws_account_id'], region) | |
s3.ListBuckets(function(err, data) { | |
if (err) { | |
console.log(err) | |
return | |
} | |
var buckets = data.Body.ListAllMyBucketsResult.Buckets.Bucket | |
_.each(buckets, function(bucket) { | |
console.log(bucket.Name) | |
}) | |
}) | |
} | |
}, amazon) | |
var conceal = function(bucket) { | |
// Make bucket and all its contents private. | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment