Amazon Java SDK : creating connection with S3

27 views Asked by At

I am using below code to upload file to S3 bucket.

bucket name is execute-got-proj

with this bucket name i observed that SDK is trying to established connection with execute-got-proj.s3.amazonaws.com

I believe SDK add s3.amazonaws.com in the end to create URI.

however if i give bucket name as execute-got-proj.vpce-0ec9043449c454d4c8-gt6dduv3.s3.us-east-1.vpce.amazonaws.com

then it is trying to established connection with s3.amazonaws.com.

I couldnt understand the reason. Can anyone please help to understand ?

AmazonS3 amazonS3 = AmazonS3ClientBuilder.standard().withRegion(region)
                .withCredentials(
                        new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)))
                .build();
                
.........           
uploadUrl = amazonS3.getUrl(bucketName, compressFileName).toString();
0

There are 0 answers