How to delete a s3 version from a bucket using boto and python

Viewed 5758

When I try to delete a bucket using the lines:

conn = boto.connect_s3(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)

print conn.delete_Bucket('BucketNameHere').message

It tells me the bucket I tried to delete is not empty.

The bucket has no keys in it. But it does have versions.

How can I delete the versions?

I can see the list of versions using bucket.list_versions()

Java has a deleteVersion Method on its s3 connection. I found that code here:

http://bytecoded.blogspot.com/2011/01/recursive-delete-utility-for-version.html

He does this line to delete the version:

s3.deleteVersion(new DeleteVersionRequest(bucketName, keyName, versionId));

Is there anything comparable in boto?

1 Answers
Related