Infrastructure Automation and the Cloud
Join the DZone community and get the full member experience.Join For Free
as i write this, i’m sitting in a half-empty office in london. it’s half empty, you see, because it’s snowing outside, and when it snows in london, chaos ensues. public transport grinds to a complete halt, buses just stop, and the drivers head for the nearest pub/cafe. the underground system, which you would think would be largely unaffected by snow, what with it being under ground, simply stops running. the overground train service has enough trouble running when it‘s sunny, let alone when it’s snowing. and of course most people know this, so whenever there’s a risk of snow, many people simply stay at home, hence the half-empty office i find myself in.
but why does london grind to such a standstill? many northern european cities, as well as american ones, experience far worse conditions and yet life still runs fairly normally. well, one reason for london’s regular winter shutdown is the infrastructure (you can see where i’m going with this, right?). the infrastructure in london is old and creaking, and in desperate need of some improvement. the problem is, it’s very hard to improve the existing infrastructure without causing a large amount of disruption, thus causing a great deal of inconvenience for the people who need to use it. the same can often be said about improving it infrastructure.
last night i went along to one of the excellent london continuous delivery meetups (organised by matthew skelton at thetrainline.com – follow him on twitter here ) which this month was all about infrastructure automation using chef. andy from opscode gave us a demo of how to use chef as part of a continuous delivery pipeline, which automatically provisioned an aws vm to deploy to for testing. it all sounded fantastic, it’s exactly what many people are doing these days, it uses all the best tools, techniques and ideas from the world of continuous delivery, and of course, it didn’t work. there was a problem with the aws web interface so we couldn’t actually see what was going on. in fact it looked like it wasn’t working at all. anyway, aside from that slight misfortune, it was all very good indeed. the only problem is that it’s all a bit utopian. it would be great if we could all work on greenfield projects, or start rewriting everything from scratch, but in the real world, we often have legacy systems (and politics) which represent big blockers on the path to getting to utopia. i compare this to the situation with london’s infrastructure – it’s about as “legacy” as you can possibly get, and the politics involved with upgrading it is obvious every time you pick up a newspaper.
in my line of work i’ve often come across the situation where new infrastructure was required – new build environments, new test server, new production environments and disaster recovery. in some cases this has been greenfield, but in most cases it came with the additional baggage of an existing legacy system. i generally propose one or more of the following:
- build a new system alongside the old one, test it, and then swap it over.
- take the old system out of commission for a period of time, upgrade it, and put it back online.
- live with the old system, and just implement a new system for all projects going forward.
then comes the politics. sometimes there are reasons (budget, for instance) that prevents us from building out our own new system alongside the old one, so we’re forced into option 2 (by far the least favorable option because it causes the most amount of disruption).
the biggest challenge is almost always the infrastructure automation. not from a technical perspective, but from a political point of view. it’s widely regarded as perfectly sensible to automate builds and deployments of applications, but for some reason, manually building, deploying and managing infrastructure is still widely tolerated! the first step away from this is to convince “management” that infrastructure automation is a necessity:
- explain that if you don’t allow devs to log on to the live server to change the app code, then why is it acceptable to allow ops to go onto servers and change settings?
- highlight the risk of human error when manually configuring servers
- do some timings – how long does it take to manually build your infrastructure – from provisioning to handover (including any wait times for approval etc)? compare this to how quick an automated system would be.
once you’ve managed to convince your business that infrastructure automation is not just sensible, but a must-have, then it’s time for the easy part – actually doing it. as andy was able to demonstrate (eventually), it’s all pretty straightforward.
recently i’ve been using the cloud offerings from amazon as a sort of stop-gap – moving the legacy systems to aws, upgrading the original infrastructure by implementing continuous delivery and automating the infrastructure, and then moving the system back onto the upgraded (now fully automated and virtualised) system. this solution seems to fit a lot more comfortably with management who feel they’ve already spent enough of their budget on hardware and environments, and are loath to see the existing system go to waste (no matter how useless it is). by temporarily moving to aws, upgrading the old kit and processes, and then swapping back, we’re ticking most people’s boxes and keeping everyone happy.
cloud hosting solutions such as those offered by amazon, rackspace and azure have certainly grown in popularity over the last few years, and in 2012 i saw more companies using aws than i had ever seen before. what’s interesting for me is the way that people are using cloud hosting solutions: i am quite surprised to see so many companies totally outsourcing their test and production environments to the cloud, here’s why:
i’ve looked into the cost of creating “permanent” test labs in the cloud (with aws and rackspace) and the figures simply don’t add up for me. building my own vm farm seems to make far more sense both practically and economically. here are some figures:
3 windows vms (2 webservers, 1 sql server) minimum spec of dual core 4gb ram:
- 2x windows “large” instance
- 1x windows “large” instance with sql server
- total: £432 ($693.20)
- 3x 4gb dual core = £455
- 1x sql server = £o
- total: £455
these figures assume a full 730 hours of service a month. with some very smart time and vm management you could get the rackspace cost down to about £300 pcm. however, their current process means you would have to actually delete your vms, rather than just power them off, in order to “stop the clock” so to speak.
so basically we’re looking at £450 a month for this simple setup. of course it’s a lot cheaper if you go for the very low spec vms, but these were the specs i needed at the time, even for a test environment.
the truth is, for such a small environment, i probably could have cobbled together a virtualised environment of my own using spare kit in the server room, which would have cost next to nothing.
so lets look at a (very) slightly larger scale environment. the cost for an environment consisting of 8 windows vms (with 1 sql server) is around £1250 per month. after a year you would have spent £15k on cloud hosting!
but i can build my own vm farm with capacity for at least 50 vms for under £10k, so why would i choose to go with rackspace or amazon? well, there are actually a few scenarios where aws and rackspace have come in useful:
1. when i just wanted a test environment up and running in no time at all – no need to deal with any itops team bottlenecks, just spin up a few vms and we’re away. in an ideal world, the infrastructure team should get a decent heads up when a new project is on it’s way, because the dev & qa team are going to need test environments setting up, and these things can sometimes take a while (more on that in a bit). but sadly, this isn’t an ideal world, and quite often the infrastructure team remain blissfully unaware of any hardware requirements until it’s blocking the whole project from moving forward. in this scenario, it has been convenient to spin up some vms on a hosted cloud and get the project unblocked, while we get on and build up the environments we should have been told about weeks ago (i’m not bitter, honestly )
2. proof of concepting – again no need to go through any red-tape, i can just get up and running on the cloud with minimal fuss.
3. when your test lab is down for maintenance/being rebuilt etc. if i could simply switch to a hosted cloud offering with minimal fuss, then i would have saved a lot of downtime and emergencies in 2012. for example, at one company we hosted all our ci build servers on our own vm farm, and one day we lost the controller. we could have spun up another vm but for the fact that with one controller down, we were over capacity on the others. if i could have just spun up a copy of my jenkins vm on aws/rackspace then i would have been back up and running in short order. sadly, i didn’t have this option, and much panic ensued.
the real cost of build-it-yourself
so i’ve clearly been of the mind that hosting my own private cloud with a vmware vsphere setup is the most economically sensible solution. but is it really? what are the hidden costs?
well last night, i was chatting with a couple of guys in the london continuous delivery community and they highlighted the following hidden costs of build-it-yourself (biy):
maintenance costs – with aws they do the maintenance. any hardware maintenance is done by them. in a biy solution you have to spend the time and the money keeping the hardware ticking over.
setup costs – setting up a biy solution can be costly. the upfront cost can be over £20,000 for a decent vm farm.
management costs – the subsequent management costs can be very high for biy systems. who’s going to manage all those vms and all that hardware? you might (probably will) need to hire additional resources, that’s £40k gone!
so really, which solution is cheapest?
Published at DZone with permission of James Betteley, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.