4
votes

Just for understanding.

  1. How to configurate CF? Is this an EC2 instance?

  2. I should to upload files to server and load balancing work will be done by Amazon? (I mean that I have only one CF instance and if load will grow Amazon will add another instance?

  3. How can I upload files? Can I make git repository and commit files?

  4. If I have another EC2 instance with web application is there any way to get access to my files at Cloud Front through file system? I mean if I can to use something like php: file_get_contents('/cloud_front/images/some_image.png')

  5. What links should I use to get, for example, images at Clod Front server? I mean that may be there are urls like http://distilleryimage10.s3.amazonaws.com/d2e89af606cc11e3b81c22000a1fbca3_6.jpg to get file access. So how can I generate this url? Any API?

Thanks for your time.

1

1 Answers

4
votes

CloudFront is a Content Delivery Netwerk. You can not upload (single) files. Instead, it makes a copy of your existing files (that you host on S3 or something similar) when that file is requested.

  1. Someone from the Netherlands requests /image.jpg.
  2. CloudFront realizes that the file isn't yet copied to the AMS CloudFront datacenter.
  3. CloudFront copies the file from your datasource (e.g. S3) to the AMS datacenter.
  4. CloudFront sends you the file.

This is overkill when a particular file is only accessed a few times. However, if a file is accessed over a thousand times, it can be cheaper and faster to store a copy on CloudFront (this is done automatically, you cannot select individual files) because the roundtrip a computer makes when connecting to the CloudFront datacenter (e.g. AMS) is much shorter than when connecting to your S3 files (e.g. in the worst case US west).

Do note that CloudFront is not one datacenter, so it's also not really suitable if your files are accessed often, but all from different locations (so that after all, every file is only accessed once or so at a CF datacenter).