delete s3 bucket aws cli code example

Example 1: aws s3 rm

aws s3 rm --recursive s3://your_bucket_name/foo/

Example 2: nodejs aws s3 bucket delete item

var params = {  Bucket: 'your bucket', Key: 'your object' };

s3.deleteObject(params, function(err, data) {
  if (err) console.log(err, err.stack);  // error
  else     console.log();                 // deleted
});

Example 3: how to delete a folder from aws s3 bucket using commands

aws s3 rm s3://test-bucket --recursive --exclude="*" --include="data/*.*"

Tags:

Go Example