Friday 10 May 2019

Moving your server to the cloud - Google Compute Engine vs Amazon Lightsail

Ok, it's been so its been a while since I last blogged (really ?  four years? what have I been doing?!)
but I thought this was  good venue for making a few notes on the above.

WHY?

Use case;  I have a stocks database running on a hosted server that scrapes stock prices daily and adds them to a sql database for later analysis.

I used to just grab the website pages and decompose them in php, but more and more often data became unavailable because sites were rendered in javascript so that people like me couldn't use them (which to be thoroughly perverts the intent of the World Wid Web, but hey, capitalism and all that) .

Eventually I got around much of that by writing a python program that used the python webkit (and later webengine) to render the html so I could once again access the data. (BTW I believe Chrome can now run headless and achieve the same)

BUT my host didnt run a recent enough version of python. What to do? Well I looked at AWS (too expensive) and Google App Engine (too constrained) but Google's other product , Compute Engine, had a free demo, so here we went.

GOOGLE GCE


Although the networking and firewall config took quite a lot of sorting it was straightforward to load up an Ubuntu instance which could provide python webengine(I'm a Debian man, but their version was to old)  with a static ip so i could happily run a web service to do my page rendering.

However  it wasn't very fast, and fell over (as in no http or ssh response from the instance ) a couple of times for unresolved reasons.   The next level of performance was also getting costly, so time to try a new offering, Amazon's Lightsail.


AMAZON LIGHTSAIL

This was a doddle; no networking issues, just load up my Ubuntu 18 instance ,  complete with LAMP (via apt-get, they have a LAMP add-on but it is too old) and bingo!

36 hours later, no response from server ! crap - is this an Ubuntu thing?  When it happened again,  I deleted the instance and loaded a Debian 9.5 instance instead.  Just as quick to set up, and noticeably quicker than the Ubuntu under my meagre (but free) 600mb memory limit