Copying an object to an Amazon S3 compatible storage on Snowball Edge bucket on a Snowball Edge - Amazon Snowball Edge Developer Guide
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Copying an object to an Amazon S3 compatible storage on Snowball Edge bucket on a Snowball Edge

The following example uploads a file named sample-object.xml to an Amazon S3 compatible storage on Snowball Edge bucket that you have write permissions for using the Amazon CLI. To use this command, replace each user input placeholder with your own information.

aws s3api put-object --bucket sample-bucket --key sample-object.xml --body sample-object.xml --endpoint-url s3api-endpoint-ip --profile your-profile

The following Amazon S3 compatible storage on Snowball Edge example copies an object into a new object in the same bucket using the SDK for Java. To use this command, 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.CopyObjectRequest; add : import java.io.IOException; public class CopyObject { public static void main(String[] args) { String bucketName = "*** Bucket name ***"; String sourceKey = "*** Source object key ***"; String destinationKey = "*** Destination object key ***"; 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(); // Copy the object into a new object in the same bucket. CopyObjectRequest copyObjectRequest = new CopyObjectRequest(sourceKey, destinationKey); s3Client.copyObject(copyObjectRequest); CopyObjectRequest copyObjectRequest = CopyObjectRequest.builder() .sourceKey(sourceKey) .destinationKey(destKey) .build(); } 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(); } } }