Changing the delivery of IT

Tony Bishop

Subscribe to Tony Bishop: eMailAlertsEmail Alerts
Get Tony Bishop: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Blog Feed Post

How to host Media Files on Amazon S3 and CloudFront with CloudBerry Explorer (part 2)

This is a second part of our article on how to host content of your website on Amazon S3.  In this post we will discuss the advantages of storing media content of your website using Amazon CloudFront service and how CloudBerry Explorer can help.

Overview

If you want to learn how to get your Amazon S3 account you can read our previous post here .  I also highly recommend reading the first part of this article that explains why you may want to host your media content on Amazon S3 and how to do that with CloudBerry Explorer.

In this article we will go beyond that and explain how you can configure Amazon CloudFront distributions for S3 buckets and setup CNAMEs for CloudFront distributions.

If you don’t have Amazon S3 account just yet it takes just a couple of minutes to create one. We have a special blog post about it that you can find here . You can download CloudBerry Explorer freeware S3 client here

What is Amazon CloudFront

CloudFront is another Amazon service that works in conjunction with S3 and allows for efficient content distribution. The content is published to data centers in multiple geographical zones and the user download content from the server that requires fewer network hops. All these happen transparently to the end user and the publisher pay a small per usage base fee.

Note that you have to sign-up for Amazon CloudFront service separately to be able to use it.


Creating CloudFront Distribution

Let’s assume that we want to use a bucket called cimages to store our media files. A good thing about CloudFront distributions is that it doesn’t have any limitations as to how you name your bucket. So any valid bucket name will work just fine.  

If you are wondering what valid buckets name are you can check Amazon S3 documentation here

To create a distribution select a bucket and click Distribution button on the toolbar.


This will take you to the dialog where you will have to click create link


This will take you to another dialog where you can specify CNAMEs for your distribution, in our example it will be images.mysite.com, optional comment, and don’t forget to check the Enable Distribution checkbox.  Click ok to create a distribution.



 

At this point Amazon will propagate the content from you S3 bucket to servers in multiple geographical locations. It may take some time.

Configuring CNAMEs

As in the part one it is likely you want to refer to your images using the nice URL like

http://media.mysite.com /Picture004.jpg

And just like before all you have to do is to configure appropriate CNAME in your hosting provider control panel. I use 1&1 but every hosting provider offers a way to create CNAMEs and you will just have to find out the details.  

Configuring CNAMEs for CloudFront distributions is a little different.  First you have to find the correct alias. Go to the properties screen for a bucket configured for CloudFront distribution and find Domain Name property. Copy the URL.

 


Go to your hosting provider control panel (I use 1&1 for this example) and enter your distribution domain name as an alias for your domain (images.mysite.com for our example).


 

It usually takes some time for DNS configuration to take effect, so the changes will not be available immediately.

Generating URLs with CNAME

 

Specifying CNAMEs for CloudFront enabled bucket is a little easier than for regular S3 buckets.  Open the Web URL dialog box that you are already familiar with. Now you can see that there is a drop down list with several options.  You can choose

Origin URL – the URL of S3 bucket itself. It is very unlikely that you should want to use it as you will lose the benefits of CloudFront and you media content will be served from a regular S3 bucket.

Domain name – automatically assigned domain to your CloudFront distribution. Use this one if you don’t have CNAME configured.

CNAME – this is your actual CNAME that you’ve just configured. This is actually the one that you want to use.


 

That’s it. Now you are ready to update your html code with new URLs and improve the scalability of your web server and serve your media content faster by taking advantage of Amazon S3 and Amazon CloudFront services.

 

How much faster my media content will be served if I enable CloudFront

This is a valid question. Even though I didn’t make my own research there are numerous of blog posts around the internet, showing how fast the content is served from CloudFront edge servers. I will refer to the blog posts made by Jason Byrne Cloudfront is Simply Marvelous and Cloudfront is Still 34x Faster than S3 Alone!

Jason’s experiment shows that CloudFront is 34 times faster than when you serve images from S3 and 14 times faster than his web server.  

 

Conclusion

As you could see Amazon S3 in particular coupled with CloudFront offers a great solution for hosting your media content while decreasing the load of your primary web server and serving the content in extremity fast fashion. There are some obvious advantages including pay as you go model and unlimited scalability. On the other hand CloudBerry Explorer freeware can help copy files to S3 account, create CloudFront distributions, configure your files to be accessible by web browser and automate the whole process. 

Read the original blog entry...

More Stories By Alexandra Brown

Marketing Manager at CloudBerry Lab, the company that specialize on tool that makes Cloud Computing adoption easier. CloudBerry Lab is established in 2008 by a group of experienced IT professionals with the mission to help organization in adopting Cloud computing technologies by closing the gap between Cloud vendors propositions and consumer needs through development of innovative low costs solutions.