Amazon S3 and Cloudfront with Java API

I am currently using S3 with the Java API to retrieve objects and their contents. I created the Cloudfront distribution using the AWS console, and I installed my S3 bucket with my objects as the start of the Bucket. But I did not notice any improvement in download performance, and I noticed that in the console window, the URL refers to s3:

INFO: Request to Send: GET https://mybucket.s3.amazonaws.com /picture.jpg headings: (Range: bytes = 5001-1049479, Content-Type : application / x-www-form-urlencoded; charset = utf -8,)

whereas in the Getting Started tutorial for Cloudfront, the URL should be:

http: // (domain name) /picture.jpg

where (domain name) is specific to the Cloudfront distribution. Thus, the Java API still receives the file from S3, and not through the cloud

Is there anyway using the Java API for S3 to upload files via Cloudfront? If not, then what is the best approach I should use to get objects via cloudfront in my java program? I am still new to this, any help is much appreciated!

+5
source share
2 answers

The JAVA API for S3 cannot be used to interact with Cloudfront.

, HTTP- ( ). http://(cloud )/picture.jpg .

+1
URL url = new URL(your_cloudfront_url);
InputStream in = url.openStream();

, S3 24 . , - getObject(bucketName, key).

0

All Articles