Host Your Site on the Cloud

I’ve recently been rethinking my web hosting strategy and looking at the alternative options open to me for hosting the sites I look after. Up until this year the sites I built were either based on Joomla or WordPress, I have 2 reseller accounts with half of my sites on each. As part of my aim to slim down my monthly expenses I wanted to find alternatives and reduce my costs.

I’ve also gone back to learning HTML after many years. Joomla and WordPress are sufficiently advanced for most users that coding is unnecessary unless you really want to get involved. I originally started hand coding web sites after picking up the first issue of .Net magazine in the mid 1990’s. At that time I was using Notepad on Windows was my only tool and tested my fledgling code with Netscape Navigator. Nowadays I had access to a lot more interesting technologies that I wanted to work with and needed to update my skills.

Due to my interest in building my own sites I had a lot of new possibilities to add to my list of options. I could continue using dynamic sites, which were usually blogs or Content Management Systems that need MySQL databases to back them up or simpler static sites built with HTML5 with CSS3 and JavaScript.

In this article I’ll have a look at some of the different ways to host a website starting with traditional web hosting, then look at different types of cloud services such as Amazon Web Services and Google App Engine, I also found some low cost hacks involving Dropbox and Google Drive. I’ve also found some other alternatives such as using Github to host a site as well as software as a service providers.

##Index:

###Traditional Hosting

###Cloud Hosting


##Traditional Hosting Traditional hosting to me is where you have access to a server either hardware or software and you have either bought it and are running it your self or are renting it from a hosting provider

##Self Hosting It is possible for you to set up a web server on a spare PC or laptop and connect it to the internet yourself. This has the advantage of being a low cost solution if you have spare hardware like an old PC you have no other use for. However if you are connecting through your broadband connection you will need to get a fixed IP address assigned to your router and configure the router to pass traffic through to the server. You will then need to make sure it doesn’t get accidentally turned off by a family member, pet or house guest. Additionally you are now responsible for the security of that server and that is a specialism all to itself. If you do get this wrong you are potentially opening a door to everyone of ill intent on the Internet and giving them access to your network and all the devices connected to it. Self hosting is always good to experiment with if you have somewhere to keep the server. It can allow you to gain experience and generally mess around with managing your own hardware, however there are in my opinion many better ways to set up a site you intend to make public and get visitors coming to.

##Colocating Ok this one did surprise me when I found that it existed. Another Jekyll fan, Brett Terpstra, who specialises in the areas of design, programming, hardware hacking, personal productivity and other things that make him unpopular at parties. He is the creater of the applications Marked and nvAlt as well as a lot of other useful tools serves his site from this service. Mac Mini Colocation allows you to place your hardware in their data centre and they will charge for the space and maintenance, you can then remote into it and host whatever you like there.

##Service Provider Hosting Service provider hosting is by far the most popular way to host a website. A web hosting company can offer an all in one package for you to build your website on with all the necessary tools to make it work

Packages typically range in price from $4-$15/month, these packages also include useful extras like the ability to host more than one website. They will provide one or more SQL servers so you can host dynamic sites, like WordPress or Joomla. They may even provide multiple email accounts, domain registration services and “one-click” installation of your blogging or content management software.

This type of low cost hosting solution is usually a ‘virtual server’ where your service provider is providing a hardware server but dividing it up into multiple software servers, one for each customer, that share the same hardware resources.

These are time tested solutions and due to their ubiquity are now very cost effective. For an individual, hosting a blog or an information site for a small company, these will usually be quite sufficient. There are a few drawbacks though, if you do get very popular you can run into service provider bandwidth caps where you are charged automatically if you go over the agreed limit. When I checked as I was writing this some of the bigger service providers are offering some packages with unlimited webspace and unlimited bandwidth so you may want to shop around.

The biggest drawbacks to this type of solution is scalability, if you need to respond to increasing traffic you may need to add additional servers, increase server size and add load balancing to meet demand. Also it’s not just the amount of visitors it is also the size of the files that are being accessed. Even when I had a small number of rich media elearning courses the video and Flash animation files caused problems for me when serving a global audience as I’ve previously mentioned in my article on “Building a LMS on the Cloud”. Having a single server solution located in a specific geographic location causes problems with responsiveness especially with multiple people trying access the same file at the same time if your audience is half a world away from the service providers datacentre.

##Hosting in the Cloud Well you have no doubt heard of the cloud and you can host stuff there right? I’m slowly migrating my sites to cloud based services but I’m choosing different types of service depending on what I’m trying to do. There are a number of factors to take into account not the least being cost, some scenarios are way cheaper than traditional solutions, others are more expensive. Let me look at each so you can see the differences. Let’s first start with the grand daddy of cloud providers Amazon Web Services which has many different options depending on what you need.

##Amazon Web Services AWS To build the Amazon.com website to allow it to become the western worlds online shopping mall of choice, meant that Amazon had to build significant infrastructure to be able to serve the planet. In 2003 two Amazon engineers presented a white paper suggesting this infrastructure could be used to build and sell a set of services that could be used by the public, in 2006 AWS was launched.

Since then it has become the largest and most widely used platform in the cloud category known as “Infrastructure as a Service”, basically a service where customers don’t need to buy or rent a specific server or virtual server but where individual components could be rented based on how much we use them. You will need a credit card to sign up for the service and you are just charged for the services you use on a pay as you go basis.

I’ll start with the more flexible developer solutions and finish with some of lower cost services.

###EC2 Elastic Compute Cloud or EC2 is a similar concept to the virtual server except it isn’t necessarily a web server you are using as it can have almost any software you want installed on it. If you are intending to use it for a WordPress site you will need to also install Apache, MySQL and PHP, this is known as a LAMP stack, the “L” stands for Linux which is the operating system of the server.

If you are not up for administering a Linux server and figuring out how to install it all, you can go to AWS Marketplace and get a pre-configured, ready to run image with WordPress installed on Amazon EC2. There are many vendors on the marketplace who put together different server configurations and make them available for a fee, or in some cases for free. You will still have to figure out how to log into it and make it accessible to the internet.

One of the advantages of EC2 is you can turn it off when you are not using it, this may not help you if it is your blog but if it is a test site it could be useful.

####Images and Instances There is some cloudy terminology that should be cleared up in relation to this technology. All of the files, folders, applications and configurations that make up your server can be stored as an ‘image’ which is ready to be deployed. An image is a snapshot of a working server that can be stored, duplicated and reused for new working servers when needed. A copy of this image can be deployed onto an EC2 instance. An instance is the Amazon name for a “virtual machine” or “virtual server”. In this context you can have your image instanciated as different servers. The image is the stored version of your server, a rubber stamp, ready to be reused as one or more instances when needed.

The idea behind this model is to allow developers to automatically add additional servers to handle more load based on demand. If your site receives so much traffic that it exceeds the capability of one server, you can add a second or third or many. For our purposes we may want to take a snapshot of a server as a backup and redeploy it if something goes wrong, or use it as the base for use another server for something else. Once your application architecture grows beyond a single instance the complexity increases and requires a deeper knowledge to design and manage.

One thing to consider if you are planning on hosting multiple websites is to use the same server to host all of those sites. That would keep the server costs down instead of having a separate EC2 instance for each website, you may need to choose a larger instance type depending on how many sites you are running.

####EC2 Cloud Costs AWS EC2 provides different instance types, each with different features, starting with a micro instance which costs $0.02/hour or $14.40/month, these are suitable for testing or for hosting small websites. Images scale up from there starting with a small instance at $0.06/hour or $43.20/month, all the way up to the most expensive instance type which costs $1.00/hour. If this is something you want to try out then Amazon offers a micro instances free for the first 750 hours as part of their Free Usage Tier scheme.

####Scaling your Infrastructure If you think that you may want to scale up your infrastructure in time, because you are getting a lot of visitors, hosting multiple sites or doing some processor intensive activities, you have many options with AWS. Amazon doesn’t regard EC2 a “virtual server” but regards each instance as a node in the architecture. Your website may grow so you need to add additional EC2 instances and configure an Amazon Elastic Load Balancer to distribute the traffic across those instances. In this scenario you will want to consider having a separate MySQL database, you could put this on to an EC2 instance but Amazon Relational Database Service is better for this as your database will be automatically backed up for you and automatically patched.

####Serving up Video If you intend to serve up larger files or live video to a global audience then you’ll want to use a content distribution network AWS has one called Cloudfront. A content distribution network is a large distributed system of servers deployed in multiple data centers across the Internet. A CDN is designed to serve content to end-users with high availability and high performance. One of the many advantages here is that this is a developer solution that has almost infinite scalability. Netflix for example is built on AWS as is the entire Amazon.com web site. You too can serve your content to the world the same way that Netflix and Amazon does!

###Amazon Simple Storage Solution S3 Amazon S3 is a file storage solution, you can back up files here, you can create a cloud based file server, or use it to host the static parts of your website like the HTML, graphics and media files. Its a highly reliable, very fast storage service.

If you want a site hosted at low cost then hosting it on S3 is very low cost, some of my sites cost only $0.03/month, contrast that with the $0.02/hour for the EC2 micro instance type. The drawback here is that you can’t host a dynamic site like WordPress or Joomla. This doesn’t mean you can’t host a blog on S3 you just can’t host a dynamic one. There are static blogging platforms like Jekyll which this site is hosted on and I’ve written about here

Converting my websites so I can host them on S3 has saved me a lot of money on sites which don’t really need WordPress or Joomla. Another approach I’ve taken in one case is to buy a static HTML template and use that as a base for a site. I’ve recently started using Twitter Bootstrap as my favourite front end of the moment and I’m using that for static websites, Jekyll sites in addition to using it for enterprise grade applications as the user interface.

I currently have around 20 domins ranging from small information sites to larger scale applications with thousands of users and I am moving all of them off of traditional hosting solutions to the cloud, some of them I’ll prune but I do keep having new ideas and coming up with new domains to support them. However Amazon Web Services isn’t the only answer and I’m sending some of them to different cloud providers.

###Software as a Service If you don’t want the aggravation of managing your own server you could use a service like Wordpress.com, Blogger.com and the new cool kid on the block Squarespace.com. These all offer templates and custom domains. These are typically low cost and have some great customizable templates. I have one site which needs to be managed and updated daily by non technical staff, where there will be website components that need adjusting on a regular basis as well as multi user blog content. All this for $8/month and one I will hopefully not have to manage personally, touch or even set up.

###Dropbox hosting One free way to host a static site is to use Dropbox. Get a free dropbox account, create your website in a folder called “site” (or whatever you like) in the public dropbox folder. Once done right click on the index.html file and select Dropbox > Copy Public Link This is then the public link to your homepage. You could even point a custom domain to this URL instead of having a dropbox like URL.

###Google Drive hosting Dropbox isn’t the only cloud storage service that is able to host your website for free. With Google Drive you create your static site and zip it into a zip file. You can then use a Google script to upload the file to your Google Drive there is a tutorial here

###Google App Engine If you think the last 2 examples are a bit of a hack you’d be right! If you are looking for another service that’s more robust then try Google App Engine it is designed as a Platform as a Service (PaaS) solution and you can host your site there static or otherwise. PaaS basically means you don’t get to see the underlying hardware like you do with AWS and you are only exposed to the elements you need to be to run your website or application.

If you want to host a static site then you wouldn’t be the first, This site was created by Accenture and was running up until recently officialroyalwedding2011.org and may have seen some traffic! If your site is static and your traffic is low then you may have nothing to pay as you get 1Gb of storage and 1Gb/day of bandwidth for free. There is a tutorial available here

If you want to use App Engine to host a WordPress site you can, it will require you to be more of a developer though. You need to set up a local webserver and SQL database on your laptop then publish it to App Engine There is a Google tutorial here and even an App Engine specific WordPress plugin built to help You can have up to 1 front end instance for free and the Cloud SQL database is currently $0.025/hour

###Github GitHub is a web-based hosting service for software development projects that use the Git revision control system. This will no doubt be a little obscure if you are not a developer. You will need to get your head around the concept of Git and be happy to use a text based interface, but the service is free. If you plan on doing some development work or want to be able to roll back to an older version of your site or have multiple people working on the same site code then it could be quite useful. There is a short tutorial here

###Final word This is obviously not the definitive guide to hosting your website, I’ve not covered domain registration or covered all of the cloud providers but it should give you a starting point if you want to understand some of the options. If you have any better ideas, other cloud experiences or even some more great hacks please put them in the comments.