S3 버킷의 객체 복사에 대한 REST 기반 액세스에 대한 현재 코드가 작동하지 않습니다. 내 S3 버킷은 https 액세스를 위해 구성되었으며 sse를 사용할 수 있습니다. 작동 시키려면 아래 코드를 어떻게 수정해야합니까? 현재 'AmazonClientException을 발견했습니다.'라는 오류 메시지가 표시됩니다. 이는 네트워크에 액세스 할 수없는 것과 같이 클라이언트가 S3과 통신하는 동안 오류가 발생했음을 의미합니다. mybucket.s3.amazonaws.com '를 해결https 연결을 사용하는 Amazon S3 SDK
@PUT
@Path("/copy/{bucketName}")
public void copyObject(@PathParam("bucketName") String bucketName, @QueryParam("fromPath") String fromPath,
@QueryParam("toPath") String toPath) throws AmazonClientException {
AmazonS3 s3client = new AmazonS3Client(new DefaultAWSCredentialsProviderChain());
try {
CopyObjectRequest copyObjRequest = new CopyObjectRequest(bucketName, fromPath, bucketName, toPath);
System.out.println("Copying object.");
s3client.copyObject(copyObjRequest);
} catch (AmazonServiceException ase) {
System.out.println("Caught an AmazonServiceException, " + "which means your request made it "
+ "to Amazon S3, but was rejected with an error " + "response for some reason.");
System.out.println("Error Message: " + ase.getMessage());
System.out.println("HTTP Status Code: " + ase.getStatusCode());
System.out.println("AWS Error Code: " + ase.getErrorCode());
System.out.println("Error Type: " + ase.getErrorType());
System.out.println("Request ID: " + ase.getRequestId());
} catch (AmazonClientException ace) {
System.out.println("Caught an AmazonClientException, " + "which means the client encountered "
+ "an internal error while trying to " + " communicate with S3, "
+ "such as not being able to access the network.");
System.out.println("Error Message: " + ace.getMessage());
}
}
사용중인 SDK 및 버전은 무엇입니까? – error2007s
양동이에 버킷 이름에 점이 없습니까? –