title: Configuring AWS S3 as an image server
body: <p>I'm looking to use AWS S3 as an image server for my java application. At any point in time we could be hosting over a million images, so my question is along the lines of storing the images. </p>
  
  <ol>
  <li><p>I'm my current application, I store them in nested directories</p>
  
  <p>Example</p>
  
  <pre><code>domain.com/63/45/1d/d435.jpg
  </code></pre>
  
  <p>So should I continue to store images in directories like that? or is it better to store them in the root folder? I'm not sure how AWS scales it's S3 instances, so I want to be sure I do it correctly. </p></li>
  <li><p>What is a bucket? is a bucket just the storage instance in my S3 instance?</p></li>
  <li><p>What is the key being passed into <code>PutObjectRequest</code>? I'm not sure if this is how you provide the directories assuming credentials are passed into AmazonS3Client. </p></li>
  <li><p>When reading from the s3 instance, is it best to point a <code>cname</code> record such as <code>images.domain.com</code> to my S3 instance and pull the images directly? If so, would you need to configure the S3 instance as static web hosting?</p></li>
  </ol>