AWS Security ChangesHomeSearch

AWS AmazonS3 documentation change

Service: AmazonS3 · 2025-08-22 · Documentation low

File: AmazonS3/latest/userguide/delete-bucket.md

Summary

Replaced detailed Java code example with a link to API reference documentation and simplified procedural instructions

Security assessment

The change removes implementation details about deleting bucket objects/versions but doesn't address any specific security vulnerability. While proper bucket deletion is important for security hygiene, this appears to be a documentation simplification rather than a response to a security issue. No CVEs, vulnerabilities, or security advisories are referenced in the changes.

Diff

diff --git a/AmazonS3/latest/userguide/delete-bucket.md b/AmazonS3/latest/userguide/delete-bucket.md
index 5dd08efb9..470edcccb 100644
--- a//AmazonS3/latest/userguide/delete-bucket.md
+++ b//AmazonS3/latest/userguide/delete-bucket.md
@@ -68 +68 @@ If the bucket contains any objects, empty the bucket before deleting it by choos
-The following example shows how to empty and delete a general purpose bucket by using the AWS SDK for Java. The code first deletes all objects in the general purpose bucket, and then it deletes the bucket. 
+To empty and delete a general purpose bucket using the AWS SDK for Java, you must first delete all objects in the general purpose bucket, and then delete the bucket. 
@@ -75 +75 @@ Java
-The following Java example deletes a bucket that contains objects. The example deletes all objects, and then it deletes the bucket. The example works for buckets with or without versioning enabled.
+To delete a bucket that contains objects using the AWS SDK for Java, you must delete all objects first, and then delete the bucket. This approach works for buckets with or without versioning enabled.
@@ -81,82 +81 @@ For buckets without versioning enabled, you can delete all objects directly and
-For instructions on creating and testing a working sample, see the [AWS SDK for Java 2.x Developer Guide](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/home.html).
-    
-    
-    import com.amazonaws.AmazonServiceException;
-    import com.amazonaws.SdkClientException;
-    import com.amazonaws.auth.profile.ProfileCredentialsProvider;
-    import com.amazonaws.regions.Regions;
-    import com.amazonaws.services.s3.AmazonS3;
-    import com.amazonaws.services.s3.AmazonS3ClientBuilder;
-    import com.amazonaws.services.s3.model.*;
-    
-    import java.util.Iterator;
-    
-    public class DeleteBucket2 {
-    
-        public static void main(String[] args) {
-            Regions clientRegion = Regions.DEFAULT_REGION;
-            String bucketName = "*** Bucket name ***";
-    
-            try {
-                AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
-                        .withCredentials(new ProfileCredentialsProvider())
-                        .withRegion(clientRegion)
-                        .build();
-    
-                // Delete all objects from the bucket. This is sufficient
-                // for unversioned buckets. For versioned buckets, when you attempt to delete
-                // objects, Amazon S3 inserts
-                // delete markers for all objects, but doesn't delete the object versions.
-                // To delete objects from versioned buckets, delete all of the object versions
-                // before deleting
-                // the bucket (see below for an example).
-                ObjectListing objectListing = s3Client.listObjects(bucketName);
-                while (true) {
-                    Iterator<S3ObjectSummary> objIter = objectListing.getObjectSummaries().iterator();
-                    while (objIter.hasNext()) {
-                        s3Client.deleteObject(bucketName, objIter.next().getKey());
-                    }
-    
-                    // If the bucket contains many objects, the listObjects() call
-                    // might not return all of the objects in the first listing. Check to
-                    // see whether the listing was truncated. If so, retrieve the next page of
-                    // objects
-                    // and delete them.
-                    if (objectListing.isTruncated()) {
-                        objectListing = s3Client.listNextBatchOfObjects(objectListing);
-                    } else {
-                        break;
-                    }
-                }
-    
-                // Delete all object versions (required for versioned buckets).
-                VersionListing versionList = s3Client.listVersions(new ListVersionsRequest().withBucketName(bucketName));
-                while (true) {
-                    Iterator<S3VersionSummary> versionIter = versionList.getVersionSummaries().iterator();
-                    while (versionIter.hasNext()) {
-                        S3VersionSummary vs = versionIter.next();
-                        s3Client.deleteVersion(bucketName, vs.getKey(), vs.getVersionId());
-                    }
-    
-                    if (versionList.isTruncated()) {
-                        versionList = s3Client.listNextBatchOfVersions(versionList);
-                    } else {
-                        break;
-                    }
-                }
-    
-                // After all objects and object versions are deleted, delete the bucket.
-                s3Client.deleteBucket(bucketName);
-            } catch (AmazonServiceException e) {
-                // The call was transmitted successfully, but Amazon S3 couldn't process
-                // it, so it returned an error response.
-                e.printStackTrace();
-            } catch (SdkClientException e) {
-                // Amazon S3 couldn't be contacted for a response, or the client couldn't
-                // parse the response from Amazon S3.
-                e.printStackTrace();
-            }
-        }
-    }
-    
-    
+For examples of how to delete a bucket with the AWS SDK for Java, see [Delete a bucket](https://docs.aws.amazon.com/AmazonS3/latest/API/s3_example_s3_DeleteBucket_section.html) in the _Amazon S3 API Reference_.