title: How to set up AWS Elastic Beanstalk with Cloudfront For Image and Video Hosting on PHP Stack
body: <p>I am trying to set up an architecture in the Amazon Cloud that will enable me to have my dynamic php files hosted on Elastic Beanstalk and my static files and video content hosted on Amazon Cloudfront CDN.    </p>
  
  <p>I have this current file structure at the moment and I have uploaded and deployed my app through the AWS.</p>
  
  <p>I am also using my own domain name as well.</p>
  
  <pre><code>app/
  |    index.php
  |    otherfiles.php
  |    
  |____images/ 
  |        image1.jpg 
  |
  |____js/
  |        scripts.js
  |
  |____css/
  |        stylesheet.css
  |
  |____videos/
           movie1.mp4
  </code></pre>
  
  <p>I have also created some folders in my s3 bucket that map to the folders in the app.  So I have a js folder an image folder, movies and so on.</p>
  
  <p>My question is how do I set up the S3 buckets so that requests to mydomain.com/images/image1.jpg map to the bucket and folder and image that is in my s3 bucket?</p>
  
  <p>Also is content that is delivered through the Cloudfront CDN only available through the S3 buckets?  </p>
  
  <p>I understand that AWS is a massive subject but I just need a conceptual overview of how this could be implemented.</p>
  
  <p>Many Thanks in advance</p>