Skip to content
Advertisement

Why are my Amazon S3 images loading slow?

It seems like the images read from amazon s3 load really slow. I had the images on the same server as the website and it loaded super fast. Is it loading slow cause it has to access it from s3 now?

Is there nothing i can really do about it ??

Using this to read the image files:

$secure_link = gs_prepareS3URL("myAmazon."/thumb/thumb_".$id, $bucket);
    readfile($secure_link);

Function is from : http://www.richardpeacock.com/blog/2010/07/amazon-aws-s3-query-string-authentication-php

Advertisement

Answer

If you’re embedding the images, you should serve them through Amazon CloudFront (Amazon’s CDN Service). CloudFront loads the image/file from S3 (or a custom origin) then caches it on their edge servers.

CloudFront Tutorial – http://www.hongkiat.com/blog/amazon-cloudfront-how-to-setup-cloudfront-to-work-with-s3/

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement