title: Amazon S3 security through Cloudfront
body: <p>I'm want to play videos to users of my site who have a login. The videos are stored on S3 and I'm about to make some changes to serve them through Cloudfront. The videos are publicly available now, but I'd like to restrict access so that users need to log in to my website to view the videos in an HTML5 video player. I also need to limit access to certain folders in S3 based on the company of the user. </p>
  
  <p>The main thing that has me wondering how to do this is the per folder access. I'm not sure if this will be relevant but, the video url's are pulled into the page via an ajax request then the HTML5 video player get's created by javascript, so the whole page isn't generated at once on the server. If the user remains on the page, they can ajax refresh the video list. </p>
  
  <p>I'm looking at <a href="http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html" rel="nofollow">Authentication Requests</a> and at <a href="http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html" rel="nofollow">Query Strings</a> at the moment as well as this <a href="http://blogs.aws.amazon.com/security/post/Tx1P2T3LFXXCNB5/Writing-IAM-policies-Grant-access-to-user-specific-folders-in-an-Amazon-S3-bucke" rel="nofollow">tutorial on folder access</a>, but it's very old. </p>
  
  <p>Am I looking in the right direction to try and do what I'm after? I'm new to AWS and would like some tips on the direction to look in. </p>
  
  <p>The website is on an ec2 and is written in Django.</p>