Workstation on AWS EC2 - is it possible and worth doing?
Saturday, Nov 15, 2014
Introduction
Motivation
This idea came first when I was trying to buy a new computer. I was thinking about whether should I get a good computer and use for 1-2 years; or a perfect computer and use it for 3+ years. I then frustrated with the amount of choices and the balance between performance, weight and price. And then it came to me the idea that what if I could have a machine that can be easily accessed wherever I go, and can be upgraded whenever I want and also cost efficient. It seems to me that a cloud workstation may be the solution.
Requirements
- A Linux/Windows programming workstation. (I am sorry if you have to use OS X application like XCode)
- A relatively good performance CPU/RAM combination for programming
- Enough disk space to store project files (for me that means around 50G), better to have good IO performance
- Fast internet connection
- Upgradable, which means I should be able to upgrade if it’s not powerful enough
- Stable and reliable
Let’s get real first
Step 1 - Register the machine
For the machine, I am using to test whether this is a good idea, I started with a “Spot Instance” in AWS to allow me to test it in a really low price. I choose to use an ArchLinux instance with Xfce desktop environment so that I can quickly boot it up and get it running. I live in Australia so I choose to set it up in Sydney region.
Step 2 - Install GUI and VNC
As mentioned before I am using the Xfce desktop, so in Arch Linux I just need to install the Xfce4 package group and also install tigervnc, and very quickly I now have a desktop environment. Here I won’t say too much about setting up these services. There are a lot of great tutorials out there.
Of course, you will need to tweak some UI like the font and hinting, but generally you can quickly get a relatively good looking desktop. Mine looks like this after around 10 minutes of quick tweaks.
My review and thoughts
Cost
There are few things that will affect how much you are going to spend:
- Region - Where you live is something you need to consider. If you are like me who live in Australia, you may end up using the Sydney data center which will be slightly more expensive than the US data center.
- Operating system - Yes your guess is correct, a Windows machine will cost you more than an Ubuntu machine. You don’t just get a paid operating system for free.
- Usage - AWS charge you by the number of hours you have your machine turned on, so obviously if you just use it for 2 hours every day you will not pay as much as someone who runs a server with the same instance type.
- Performance of the machine - of course, the instance type you select will directly affect your cost, by a lot. The cheapest machine is US$0.006, whereas the most expensive one can be around US$1.796
- Storage and its performance - on AWS you pay for every bit that you use (em… this doesn’t sound really optimistic, let’s try another way) - on AWS you only pay the storage you use. The more storage you want, the more you are going to spend.
- Reserved or On Demand - AWS offers great discount if you signed up for a contract, which they call it Reserved Instance. The advantage is obviously price, and the disadvantage is that you lose upgradeability so you are stuck for either 1 or 3 years.
- Bandwidth usage and Disk I/O - AWS charges for outbound internet usage and disk I/O, so if you are doing something crazy (which I can’t think of anything a normal developer would do) you may get some surprising costs on these things.
- Backup - If you have full backup and if you backup regularly, this will cost some money.
Luckily everything you want about cost can be found here, just to make sure you don’t miss anything when you are doing your calculation. A good example is if you choose an EBS disk, don’t forget that I/O will cost you.
Let me just give you an example. Here is what I think I may need:
- Ubuntu machine running on Sydney region
- 8 hours average daily use (I am a heavy user)
- relatively powerful configuration as a desktop (I choose m3.large)
- about 50G SSD and reasonable bandwidth usage (as a programmer, 10% weekly disk change and network 10G outbound and 200G inbound monthly)
- 1 year on-demand contract (medium-usage works best with 8-hour daily usage)
- weekly rolling backup for the last 4 weeks
According to the AWS calculator, the calculation is like this. So a quick summary of the cost is:
- Initial cost: US$403
- Monthly bill: US$33.15
- Total cost for a year: US$800.8
Just a quick note, all the prices above are tax exclusive. So the final cost for me as the exchange rate now will be - US$880.88, which is about A$1003.87 at the time of writing this (per year).
Performance
The most important performance that I care about are network and CPU performance as I am doing a lot of code pulling and pushing, a lot of docker operations and a lot of code compiling.
Network
I did the performance test with speedtest.net, and I think the speed is quite good considering you are on Amazon’s network infrastructure. Here are some screenshots:
Speed to Melbourne Australia (Delay 12ms, Download 625.99Mbps, Upload 318.68Mbps)
Speed to California US (Delay 142ms, Download 138.67Mbps, Upload 20.29Mbps)
Speed to London UK (Delay 337ms, Download 11.15Mbps, Upload 17.56Mbps)
Speed to Beijing China (Delay 156ms, Download 375.73Mbps, Upload 192.34Mbps)
I think the result will vary a little bit so I also try to do something like check out two git repository from Github: (docker 12.542s, mongo 38.997s)
I think no need to say more: you are using a server infrastructure, must be better than ADSL2+!
CPU
I use Hardinfo to generate the CPU benchmark (sorry I am not a benchmark Pro):
- CPU Blowfish: 7.622
- CPU CryptoHash: 201.160
- CPU Fibonacci: 1.770
- CPU N-Queens: 5.643
- FPU FFT: 2.946
- FPU Raytracing: 4.235
Just to quickly compare with my home server (i7-4770):
- CPU Blowfish: 1.54 (495% better)
- CPU CryptoHash: 997.08 (495% better)
- CPU Fibonacci: 1.05 (169% better)
- CPU N-Queens: 0.39 (1447% better)
- FPU FFT: 0.64 (460% better)
- FPU Raytracing: 2.60 (163% better)
Convenience
In terms of convenience, I think the cloud based workstation is really good. You don’t need to bring your heavy workstation with you anymore and you get all your files and working environment with you all the time. The only tools you will need are some kind of thin clients and a reasonable good internet connection.
Also you have the ability to backup your machine with the snapshot feature at any time, so you get a kind of time machine feature. You can also get the convenience to upgrade your hardware as you need. So you can upgrade your machine to be a more powerful one if you need more CPU power in the next few days for a specific project, or you can upgrade the machine to have more memory temporarily to run a lot of things at some time.
However, one problem I can think of is that you will lose the ability to work “offline” as there will be no “offline” option for you at all. Also the internet connection has to be reasonably stable. With my ADSL2+ at home I had to reconnect once during the hour testing because of the VPN client lost connection.
Conclusion
There’s a lot of things that I didn’t test, for example, hard drive performance and graphical performance. I think to summarise the experience a remote machine on the internet is still laggy and hard to use. Of course, if you are not that care about the experience or you are a system administrator who already use to a remote connection, then yes you would definitely get a lot of performance benefits from this.
I think it would be good if you can try it by yourself if you are really thinking of moving your workstation online. Everything matters a little bit so you need to actually try it.