title: Questions about using Amazon CloudFront and/or S3 as an image server (vs standard Apache server)
body: <p>Currently, I have a website which serves dynamic (PHP-MySQL) content from an Apache server, and serves static content (JavaScript, images) from a separate Lighthttpd server.</p>
  
  <p>For reasons of scale I would like to use Amazon Cloudfront and possibly S3. To be honest I'm not entirely sure how S3 or CloudFront work. I'm used to the normal server behaviour of "upload a file... it becomes available" and S3 "buckets" and CloudFront edge-mirroring are daunting.</p>
  
  <p>I need a better understanding of how this works and have some questions:</p>
  
  <p>1) I don't want to store any images on my own servers. I want them to be entirely in the cloud. Am I correct that this means I will need to use S3 for storage as an "origin server"? Will CloudFront on its own not be enough? Is CloudFront just the edge-CDN service?</p>
  
  <p>2) We currently upload images via a PHP script which FTPs them to our image server, or via manual FTP upload. How will that change if I use S3? I heard you can't FTP to it? :(</p>
  
  <p>3) If using S3, can I still create hierarchical directories and store images inside these? The images are stored various folders deep and I can't afford to change the code, but I heard S3 was a flat "bucket"?</p>
  
  <p>4) Finally, I heard that with CloudFront, if a file changes, you have to issue an invalidation request, which costs money. Is this because CloudFront is caching the image from the origin? I'm not used to this as in my current setup I just replace an image via FTP and it updates! Is there no way to imitate this classic behaviour?</p>
  
  <p>Sincerest thanks for help.</p>