Need a break from coding? - Then try a boating holiday in Europe.

Host large video files on Amazon S3, and serve them via a sub domain of your web site.

Published 10.July.2008

Introduction

Last week I talked about creating video demonstrations for your software products, and I mentioned that if your videos become really popular you should consider hosting them on Amazon's S3 service, as it can handle the large load and deliver the video to your visitors much quicker, and usually more cost effectively than your current hosting account can handle. In this short article I will show you how to upload your videos to S3, change the access control settings, and configure your DNS to point a sub domain of your web site to your Amazon S3 account.

Step 1 - Get an Amazon S3 account

If you don't already have an Amazon S3 account, then sign-up for one, it's very cheap storage and if nothing else it's useful as an off site backup storage solution for your important data files.

Step 2 - Create a bucket within your account to store your videos

There are lots of tools that let you interact with your Amazon S3 account, but if your already using the FireFox browser, then you should get a copy of the Amazon S3 Firefox Organizer; which makes this whole process much easier. Once you have configured S3 Firefox Organizer with your S3 account credentials, you will be presented with two panes. The left hand pane shows your local computers hard disk, and the right hand pane shows your S3 account.

Firefox Organizer Bucket Naming Dialog

fig 1 - click to enlarge.

You need to create a bucket, S3 speak for directory or folder, within your account to store your video files. To do this, right click the mouse within the right hand pane of Firefox Organizer, and you get a pop-up menu with several options. Selecting the create directory option, you will be presented with the screen dialog shown in fig 1.

You need to enter your domain name with your chosen sub-domain prefix into the folder name field. It is important that you enter everything in lower case, as it helps the DNS mapping shown in step 4. In this example I have chosen my sub-domain to be called media, so that resulting videos can be served as :

http://media.base64.co.uk/video-file-name.swf

Step 3 - Uploading your videos and changing the ACL preferences

Uploading your video files into this newly created bucket is very easy from within S3 Firefox Organizer, you can simply drag your video files from your local hard disk in the left hand pane, to the right hand pane, and your file will be uploaded to the Amazon S3 service.

Firefox Organizer ACL Preferences Dialog

fig 2 - click to enlarge.

By default any file that is uploaded to S3 is only accessible to the account holder, so if you want to make the video file accessible via the web to everybody, then you need to right mouse click on the video file, and select the Edit ACL menu option.

You can set the access control preferences for the file from the screen shown in fig 2, ensuring that the everyone user name profile has read access ticked.

Once this is done you can now link to the file from your web site, if you right mouse click on the video file and select the Copy URL to Clipboard menu option, and paste the URL into your web page, you will have access to file.

In my example the resulting URL is:

https://media.base64.co.uk.s3.amazonaws.com/jpeg2ico400.swf

Step 4 - Mapping a sub domain of your web site, to your S3 account

However, this resulting URL doesn't look very professional, so the last step in the process is to map a sub domain of your web site onto your S3 account. You will need to use the control panel provided by your hosting company to go in and set-up a CNAME DNS entry. If your hosting company does not allow this feature, then I recommend you think about moving to a more professional hosting company, like Pair Networks.

In my example I set-up a sub domain CNAME record called media to point to s3.amazonaws.com

DNS CNAME settings

After the DNS settings have had time to propagate, the process is complete. I can now link to my video in the format of :

http://media.base64.co.uk/jpeg2ico400.swf

and I get all the benefits of having the video delivered from a high quality, highly scalable, fast hosting service in Amazon S3, yet the file looks like it is hosted at my web site.

What Next?

Bookmark this article at :-

If the information you have found here helps to strengthen your business, or has saved you lot's of time, and you'd like to show your appreciation, consider making a small donation.