6
votes

I have an S3 bucket with versioning enabled. The bucket has few files which have versions. I have written a sample golang program which can do the following:

  • GetBucketVersioning - It is able to get bucket versioning status i.e., Enabled
  • ListObjects - It is able to list the bucket objects
  • DeleteObjects - It is able to delete the bucket objects (but it just adds 'Delete Marker' only to the latest version of each object. The version history of the objects still remain undeleted)
  • DeleteBucket: This operation fails with the error message:

"BucketNotEmpty: The bucket you tried to delete is not empty.
You must delete all versions in the bucket."

Could you advise how to force delete ALL VERSIONS of ALL OBJECTS in an S3 bucket so that I can ultimately delete the entire bucket, using aws-sdk-go, please?

1
Delete all the object versions first. Example in Java: docs.aws.amazon.com/AmazonS3/latest/dev/…jarmod

1 Answers

0
votes

This seem to be impossible using the golang sdk. They didn't implement a delete version function.