{"id":414,"date":"2010-09-29T12:30:46","date_gmt":"2010-09-29T11:30:46","guid":{"rendered":"http:\/\/craig.dubculture.co.nz\/blog\/?p=414"},"modified":"2010-09-29T14:46:29","modified_gmt":"2010-09-29T13:46:29","slug":"clouded-house-how-we-moved-our-service-to-amazon-ec2-without-it-even-knowing-and-how-you-can-too","status":"publish","type":"post","link":"http:\/\/craig.dubculture.co.nz\/blog\/2010\/09\/29\/clouded-house-how-we-moved-our-service-to-amazon-ec2-without-it-even-knowing-and-how-you-can-too\/","title":{"rendered":"Clouded House: How we moved our service to Amazon EC2 without it even knowing, and how you can too"},"content":{"rendered":"<div style=\"float: right;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignright size-full wp-image-483\" title=\"Jetpack Moo\" src=\"http:\/\/craig.dubculture.co.nz\/blog\/wp-content\/uploads\/2010\/09\/jetpackmoo.png\" alt=\"\" width=\"251\" height=\"215\" \/><\/div>\n<p>At the <a href=\"http:\/\/www.symbian.org\/\">Symbian Foundation<\/a>, we run a number of <a href=\"http:\/\/developer.symbian.org\/wiki\/index.php\/Open_source_software_used_by_the_Symbian_Foundation\">open-source applications and utilities<\/a> written both in-house and by our member companies to support the Foundation's goals of building and promoting the Symbian platform. We have servers running LAMP<sup><a href=\"#footnote_0_414\" id=\"identifier_0_414\" class=\"footnote-link footnote-identifier-link\" title=\"using the extended definition to include PHP, Perl and Python\">1<\/a><\/sup> applications such as <a href=\"http:\/\/www.symfony-project.org\/\">Symfony<\/a>, <a href=\"http:\/\/drupal.org\/\">Drupal<\/a>, <a href=\"http:\/\/www.mediawiki.org\">MediaWiki<\/a>, <a href=\"http:\/\/www.bugzilla.org\/\">Bugzilla<\/a> and <a href=\"http:\/\/mercurial.selenic.com\/\">Mercurial<\/a>. \u00a0We also run some Tomcat applications such as <a href=\"http:\/\/hub.opensolaris.org\/bin\/view\/Project+opengrok\/WebHome\">OpenGrok<\/a> and <a href=\"http:\/\/www.qmetric.org\/BugzillaMetrics\/index.html\">Bugzilla\u00a0Metrics<\/a>.<\/p>\n<p>When the Foundation was set up we contracted a company to provide hosting services for us, which were provided on VMware ESX, on dedicated servers in a London datacenter. For various reasons, we decided some months ago it was time to part ways with our current hosting provider.\u00a0This gave us the chance to make some moves we've been wanting to make for some time; a break from the now-unsupported PHP 5.2 to PHP 5.3 for our LAMP applications, a move to <a href=\"http:\/\/www.ubuntu.com\/\">Ubuntu<\/a> for the operating system, introducing some great <a href=\"http:\/\/www.puppetlabs.com\/\">configuration management<\/a> and <a href=\"http:\/\/marionette-collective.org\/\">automation<\/a> tools (more on those later), and removing some closed source components. It also had the side effect of allowing us to repurpose a rather large sum of money!<\/p>\n<p>The goal in moving our infrastructure was to make the move seamless to the end user; I suspect that if you are reading this and you're an active user of Symbian's web applications, you couldn't even tell me what day this move was made. This project was undertaken with only minimal involvement from our web team, so there was no rewriting of the applications to use file storage in S3; we had to provide a system that worked the same as the previous hosting. This was my challenge, and it was a lot of fun.<\/p>\n<h3>What is AWS?<\/h3>\n<p>In updating <a href=\"http:\/\/www.awsug.com\/about\/\">the About page<\/a> for the <a href=\"http:\/\/www.awsug.com\/\">UK AWS users group<\/a>, I wrote:<\/p>\n<blockquote><p>Amazon Web Services (AWS) is a cloud-based infrastructure platform, offering services such as computing capacity , database and storage, available on demand, priced as a utility, and controlled by web services.<\/p><\/blockquote>\n<p>People who like hard-to-pronounce acronyms<sup><a href=\"#footnote_1_414\" id=\"identifier_1_414\" class=\"footnote-link footnote-identifier-link\" title=\"technically, an initialism, unless you want to get quite rude\">2<\/a><\/sup> have invented the new category of <em>infrastructure as a service (IaaS) <\/em>in order to separate AWS from other \"cloud computing\" offerings such as <abbr title=\"Platform as a service\">PaaS<\/abbr> (think Google App Engine) or <abbr title=\"Software as a service\">SaaS<\/abbr> (Salesforce.com). Through a web service call, you say \"I want you to give me a VM\"; it returns you the ID of your VM, and starts charging you for it. \u00a0The AWS offerings range from the low-level (VMs, disk, static IPs) to the high-level (message queues, MySQL databases)<\/p>\n<p>Amazon invented this category and are the market leader; there are competitors, such as <a href=\"http:\/\/www.rackspacecloud.com\/\">Rackspace Cloud<\/a> and\u00a0<a href=\"http:\/\/www.gogrid.com\/\">GoGrid.com<\/a>, but after some initial experimentation, the decision to go with Amazon was easy to make.<\/p>\n<p>Lock-in isn't too much of a concern when you're just renting infrastructure - you have root access, and you put it all there yourself, so you know you could pick it up and re-implement it anywhere else if you chose. \u00a0(If we were using S3, it might be a concern.) However, you know you're the winner when you have an open source implementation of your API; the <a href=\"http:\/\/open.eucalyptus.com\/\">Eucalyptus project<\/a> implements the\u00a0AWS APIs and lets you run your own \"private cloud\" on your own hardware. Eucalyptus powers Canonical's <a href=\"http:\/\/www.ubuntu.com\/cloud\/private\">Ubuntu Enterprise Cloud<\/a>, which is a great way to get started without needing a credit card.<\/p>\n<h3>Does my application need the cloud?<\/h3>\n<p>If you are building an application from scratch, it's hard to say no to what cloud computing offers. You can scale from one machine all the way up to <a href=\"http:\/\/highscalability.com\/blog\/2010\/3\/10\/how-farmville-scales-the-follow-up.html\">Farmville<\/a>.\u00a0Netcraft, while they're not busy confirming the death of things, claim that <a href=\"http:\/\/news.netcraft.com\/archives\/2010\/05\/14\/may_2010_web_server_survey.html\">365,000 web sites are hosted on EC2<\/a> as of May this year. It's also <a href=\"http:\/\/cloud.gigaom.com\/2010\/08\/16\/how-computing-impacts-the-cash-needs-of-startups\/\">much better for your cashflow<\/a>.<\/p>\n<p>If you're migrating an existing application, your application doesn't run in the cloud today, so it obviously doesn't <em>need<\/em> what the cloud offers. However, rebuilding an application for a cloud environment (as opposed to just picking the disks up and putting them on virtualised hardware) makes you rebuild things in a way that should, if you do it right, make scaling easy.<\/p>\n<p>Even if you don't need the scalability, think of the potential upsides; you can turn a machine on just to do some processing, and then turn it off again when you're finished.<\/p>\n<p>Because we migrated an existing infrastructure, we aren't really using EC2 as anything more than a <abbr title=\"Virtual Private Server\">VPS<\/abbr> provider. Albeit, a\u00a0<strong>super<\/strong>-VPS provider where you can turn instances on and off yourself, clone and snapshot them, and scale them up and down your will. Now we have moved into the cloud, should our developers wish, they can use whatever other services take their fancy.<\/p>\n<h3>Economics<\/h3>\n<p>If you're running an application that runs 24x7, economically, cloud computing isn't necessarily going to be better, as <a href=\"http:\/\/www.theregister.co.uk\/2010\/08\/21\/gill_on_amazon_ec2\/\">Google's Vijay Gill commented recently<\/a>.\u00a0If your business relies on having thousands of servers, then you can probably benefit from the economies of scale of having your own setup, and if it's your core competency, you probably shouldn't outsource that. However, his figures don't consider the cost of reserved instances, which generally drop the per-unit cost of EC2 instances by at least half.<\/p>\n<p>(I suspect Gill would suggest people with smaller needs use Google's PaaS offering, <a href=\"http:\/\/code.google.com\/appengine\/\">App Engine<\/a>, which requires rewriting your application, and using either Python or Java. This series suggests that you don't have the ability or remit to do this.)<\/p>\n<p>When I first drafted this article, I wrote \"EC2 can't scale as low as <a href=\"http:\/\/www.linode.com\/\">Linode's $20\/month plan<\/a>\": since then however, Amazon have <a href=\"http:\/\/aws.amazon.com\/about-aws\/whats-new\/2010\/09\/09\/announcing-micro-instances-for-amazon-ec2\/\">announced \"micro\" instances<\/a>, which cost next-to-nothing (when reserved, about $14\/mo). The support is not exactly <a href=\"http:\/\/www.rackspace.co.uk\/rackspace-home\/fanatical-support\/\">Fanatical<\/a> - like many open source things, your support options are best-effort in the forums, or purchasing\u00a0<a href=\"http:\/\/aws.amazon.com\/premiumsupport\/\">Premium Support, at 10\/20% of your monthly spend<\/a>.<\/p>\n<p>However, if you believe, as we do, that\u00a0<a href=\"http:\/\/www.k2advisory.com\/research\/cloud-computing-step-change-it-services\">cloud computing is the future<\/a>, and\u00a0you're running a few dozen servers, then even at non-reserved rates, EC2 probably works out cheaper than traditional commercial virtualised hosting, and offers you such benefits such as being able to use different, worldwide datacenters, at no extra cost.<sup><a href=\"#footnote_2_414\" id=\"identifier_2_414\" class=\"footnote-link footnote-identifier-link\" title=\"Things cost slightly more - around 1c\/hour - outside of their largest centre, Washington DC.\">3<\/a><\/sup><\/p>\n<p>That there is no capital expenditure is a bonus for your finance department, but they will probably balk at having to pay by credit card. If your spend is enough, Amazon will put you on invoice billing; until then, fly under the radar, or convince your finance director that the savings are worth an exception to the policy.<\/p>\n<h4>A small note on open source vs proprietary software in the cloud<\/h4>\n<p>If your product costs more to use the more servers you run it on, cloud computing may not be for you.\u00a0This reminds me of a <a href=\"http:\/\/www.codinghorror.com\/blog\/2009\/06\/scaling-up-vs-scaling-out-hidden-costs.html\">post from Jeff Atwood<\/a>; scaling out costs a lot more when you have to pay for your operating system or software licenses<\/p>\n<p>(You can scale up instances - and if you have your root on EBS, you can do it with an existing machine - but the nearer you get to using a full unshared server, the closer Amazon have to charge you to the cost of a full unshared server, and so you may near the point where building your own server is a better deal.)<\/p>\n<h3>Stay tuned<\/h3>\n<p>Over the next few weeks I will post a series of articles talking about the problems we faced, the challenges we overcame, and how you can take your application or servers and move them into the EC2 cloud. \u00a0I will also touch on the things that are not-so-great about each component of the Amazon stack, and make suggestions to how you can work around them, or how Amazon could improve their service. \u00a0You'll be the first to hear about the brand new file system we've developed for quickly moving files around EC2 instances. In return, I'd love to hear from anyone who has suggestions on how they think we could have done better.<\/p>\n<p>To make sure you get each post as they come out, <a href=\"http:\/\/feeds.feedburner.com\/CraigBox\">subscribe to this blog by RSS<\/a>, or <a href=\"http:\/\/www.feedburner.com\/fb\/a\/emailverifySubmit?feedId=1212746&amp;loc=en_US\">sign up for updates by e-mail<\/a>.<sup><a href=\"#footnote_3_414\" id=\"identifier_3_414\" class=\"footnote-link footnote-identifier-link\" title=\"If you want to make ultra-sure you only read posts relating to our Amazon migration, and don&#039;t accidentally read a band review or something,&nbsp;there&#039;s a category for that.\">4<\/a><\/sup> You should follow me on Twitter <a href=\"http:\/\/twitter.com\/craigbox\">here<\/a>, but only if you're prepared for short bursts of <em>awesome<\/em>.<\/p>\n<ol class=\"footnotes\">\n<li id=\"footnote_0_414\" class=\"footnote\">using the extended definition to include PHP, Perl and Python&nbsp;<a href=\"#identifier_0_414\" class=\"footnote-link footnote-back-link\">&#8617;<\/a><\/li>\n<li id=\"footnote_1_414\" class=\"footnote\">technically, an <a href=\"http:\/\/evolt.org\/node\/35750\/\">initialism<\/a>, unless you want to get quite rude&nbsp;<a href=\"#identifier_1_414\" class=\"footnote-link footnote-back-link\">&#8617;<\/a><\/li>\n<li id=\"footnote_2_414\" class=\"footnote\">Things cost slightly more - around 1c\/hour - outside of their largest centre, Washington DC.&nbsp;<a href=\"#identifier_2_414\" class=\"footnote-link footnote-back-link\">&#8617;<\/a><\/li>\n<li id=\"footnote_3_414\" class=\"footnote\">If you want to make ultra-sure you only read posts relating to our Amazon migration, and don't accidentally read a band review or something,\u00a0<a href=\"http:\/\/craig.dubculture.co.nz\/blog\/category\/technical\/amazon-migration\/\">there's a category for that<\/a>.&nbsp;<a href=\"#identifier_3_414\" class=\"footnote-link footnote-back-link\">&#8617;<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>At the Symbian Foundation, we run a number of open-source applications and utilities written both in-house and by our member companies to support the Foundation's goals of building and promoting the Symbian platform. We have servers running LAMP1 applications such as Symfony, Drupal, MediaWiki, Bugzilla and Mercurial. \u00a0We also run some Tomcat applications such as [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[83,66,68],"tags":[],"_links":{"self":[{"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/posts\/414"}],"collection":[{"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/comments?post=414"}],"version-history":[{"count":23,"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/posts\/414\/revisions"}],"predecessor-version":[{"id":493,"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/posts\/414\/revisions\/493"}],"wp:attachment":[{"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/media?parent=414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/categories?post=414"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/tags?post=414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}