AWS AmazonS3 documentation change
Summary
Replaced inline Java code example with a link to external SDK example repository
Security assessment
Change only affects code sample presentation format without modifying security-related content or introducing security features. No evidence of security vulnerability being addressed.
Diff
diff --git a/AmazonS3/latest/s3-outposts/S3OutpostsUploadObjects.md b/AmazonS3/latest/s3-outposts/S3OutpostsUploadObjects.md index 45eadfccd..472f443db 100644 --- a//AmazonS3/latest/s3-outposts/S3OutpostsUploadObjects.md +++ b//AmazonS3/latest/s3-outposts/S3OutpostsUploadObjects.md @@ -31,47 +31 @@ SDK for Java -The following example puts an object into an S3 on Outposts bucket by using the SDK for Java. To use this example, replace each ``user input placeholder`` with your own information. - - - import com.amazonaws.AmazonServiceException; - import com.amazonaws.SdkClientException; - import com.amazonaws.services.s3.AmazonS3; - import com.amazonaws.services.s3.AmazonS3ClientBuilder; - import com.amazonaws.services.s3.model.ObjectMetadata; - import com.amazonaws.services.s3.model.PutObjectRequest; - - import java.io.File; - - public class PutObject { - public static void main(String[] args) { - String accessPointArn = "*** access point ARN ***"; - String stringObjKeyName = "*** String object key name ***"; - String fileObjKeyName = "*** File object key name ***"; - String fileName = "*** Path to file to upload ***"; - - try { - // This code expects that you have AWS credentials set up per: - // https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html - AmazonS3 s3Client = AmazonS3ClientBuilder.standard() - .enableUseArnRegion() - .build(); - - // Upload a text string as a new object. - s3Client.putObject(accessPointArn, stringObjKeyName, "Uploaded String Object"); - - // Upload a file as a new object with ContentType and title specified. - PutObjectRequest request = new PutObjectRequest(accessPointArn, fileObjKeyName, new File(fileName)); - ObjectMetadata metadata = new ObjectMetadata(); - metadata.setContentType("plain/text"); - metadata.addUserMetadata("title", "someTitle"); - request.setMetadata(metadata); - s3Client.putObject(request); - } 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 upload an object to an S3 Outposts bucket with the AWS SDK for Java, see [PutObjectOnOutpost.java](https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/s3/src/main/java/com/example/s3/outposts/PutObjectOnOutpost.java) in the _AWS SDK for Java 2.x Code Examples_.