AWS AmazonS3 documentation change
Summary
Updated Java SDK examples to use S3Client instead of deprecated TransferManager, removed detailed code samples, and added links to API reference documentation
Security assessment
The changes modernize SDK usage examples but do not address specific security vulnerabilities or introduce new security features. While aborting multipart uploads is a security hygiene practice to prevent orphaned uploads, the documentation update itself focuses on API usage patterns rather than disclosing/fixing a security issue.
Diff
diff --git a/AmazonS3/latest/userguide/abort-mpu.md b/AmazonS3/latest/userguide/abort-mpu.md index 78654bf9b..78b069c5c 100644 --- a//AmazonS3/latest/userguide/abort-mpu.md +++ b//AmazonS3/latest/userguide/abort-mpu.md @@ -22 +22 @@ Java -The `TransferManager` class provides the `abortMultipartUploads` method to stop multipart uploads in progress. An upload is considered to be in progress after you initiate it and until you complete it or stop it. You provide a `Date` value, and this API stops all the multipart uploads on that bucket that were initiated before the specified `Date` and are still in progress. +To stop multipart uploads in progress using the AWS SDK for Java, you can abort uploads that were initiated before a specified date and are still in progress. An upload is considered to be in progress after you initiate it and until you complete it or stop it. @@ -24 +24 @@ The `TransferManager` class provides the `abortMultipartUploads` method to stop -The following tasks guide you through using the high-level Java classes to stop multipart uploads. +To stop multipart uploads, you can: @@ -26,3 +26 @@ The following tasks guide you through using the high-level Java classes to stop -High-level API multipart uploads stopping process - -1 | Create an instance of the `TransferManager` class. +1 | Create an S3Client instance. @@ -30,29 +28 @@ High-level API multipart uploads stopping process -2 | Run the `TransferManager.abortMultipartUploads` method by passing the bucket name and a `Date` value. - -The following Java code stops all multipart uploads in progress that were initiated on a specific bucket over a week ago. For instructions on how to create and test a working sample, see [Getting Started](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/getting-started.html) in the AWS SDK for Java Developer Guide. - - - import java.util.Date; - - import com.amazonaws.AmazonClientException; - import com.amazonaws.auth.profile.ProfileCredentialsProvider; - import com.amazonaws.services.s3.transfer.TransferManager; - - public class AbortMPUUsingHighLevelAPI { - - public static void main(String[] args) throws Exception { - String existingBucketName = "*** Provide existing bucket name ***"; - - TransferManager tm = new TransferManager(new ProfileCredentialsProvider()); - - int sevenDays = 1000 * 60 * 60 * 24 * 7; - Date oneWeekAgo = new Date(System.currentTimeMillis() - sevenDays); - - try { - tm.abortMultipartUploads(existingBucketName, oneWeekAgo); - } catch (AmazonClientException amazonClientException) { - System.out.println("Unable to upload file, upload was aborted."); - amazonClientException.printStackTrace(); - } - } - } +2 | Use the client's abort methods by passing the bucket name and other required parameters. @@ -63,0 +34,2 @@ You can also stop a specific multipart upload. For more information, see Using t +For examples of how to abort multipart uploads with the AWS SDK for Java, see [Cancel a multipart upload](https://docs.aws.amazon.com/AmazonS3/latest/API/s3_example_s3_AbortMultipartUpload_section.html) in the _Amazon S3 API Reference_. + @@ -125,11 +97 @@ Java -The following Java code example stops an in-progress multipart upload. - - - InitiateMultipartUploadRequest initRequest = - new InitiateMultipartUploadRequest(existingBucketName, keyName); - InitiateMultipartUploadResult initResponse = - s3Client.initiateMultipartUpload(initRequest); - - AmazonS3 s3Client = new AmazonS3Client(new ProfileCredentialsProvider()); - s3Client.abortMultipartUpload(new AbortMultipartUploadRequest( - existingBucketName, keyName, initResponse.getUploadId())); +To stop a specific in-progress multipart upload using the AWS SDK for Java, you can use the low-level API to abort the upload by providing the bucket name, object key, and upload ID. @@ -139 +101,3 @@ The following Java code example stops an in-progress multipart upload. -Instead of a specific multipart upload, you can stop all your multipart uploads initiated before a specific time that are still in progress. This clean-up operation is useful to stop old multipart uploads that you initiated but did not complete or stop. For more information, see Using the AWS SDKs (high-level API). +Instead of aborting a specific multipart upload, you can stop all multipart uploads initiated before a specific time that are still in progress. This clean-up operation is useful to stop old multipart uploads that you initiated but did not complete or stop. For more information, see Using the AWS SDKs (high-level API). + +For examples of how to abort a specific multipart upload with the AWS SDK for Java, see [Cancel a multipart upload](https://docs.aws.amazon.com/AmazonS3/latest/API/s3_example_s3_AbortMultipartUpload_section.html) in the _Amazon S3 API Reference_.