Moving my Blog from its home to AWS Lightsail

This is the second post to this blog and its to say that its moved homes. Whilst the domain may have stayed the same its permanent home has moved from Webfaction where it has lived for a long time to AWS. I did this for a few reasons but the real driving force was that I am now using AWS on a regular basis and felt I should move my personal domain and blog there.

I started using AWS 2 years ago and I really liked the interface on offer and the number of services which seem to grow at an exponential rate. I became an AWS certified architect over a year ago and always meant to move my blog but never really got around to it. All of this stopped after Amazon launched Lightsail.

So what’s the big deal? In Lightsail Amazon has created a way to create a number of well used and popular pre-packaged server configurations, there are entire stacks or OS only configurations here is a screen shot to give you an idea of what is available at the current time.

image

You simply choose your region and your instance plan, which start at $5 a month and go to $80, give it a unique name and tell the interface how many of these instances you wish to launch, your first month is free!

image

You can launch these instances in a number of regions and availability zones:

image

You can add a launch script that will execute on first launch at the click of a button this can be shell script for Linux based instances or Powershell for the windows based instances. Once you have created your instance you are presented with a small panel with the name of the instance with all its information my blog one looks like this:

image

You will notice from the above picture that in the tile there are a number of things shown, there is a CLI icon (more about this in a moment), a standard menu icon where various simple commands can be launched from and its IP address along with Region and A-Z. Also you will notice across the top there are simplified menu items for other services, like networking (A very simple Route53 interface) and also the ability to give your instance a static IP address. Normally Route53 although a great service can be a bit overwhelming if you are not used to that sort of service, the simplified interface on offer allows you to create a DNS Zone and to create A-Records very easily without really needing to know what all that stuff really means (you really should know if you are hosting your own stuff). Its all wizard-driven and DNS zones are a free service, you just enter your domain name in the friendly dialog and click create. After you create your records in your zone you are presented with the nameservers being used, which you can feed to your domain registrar if you are using a third party the gui is beginner friendly and looks like this:

image

Notice you are not restricted to A records you can add CNAMES, MX and TXT records, whilst this is not as fully featured as Route53 we are in a limited service so I think what’s available is really great. In keeping with the making things very clear if you click that delete link the entire form is replaced with a huge big red button, it is made very clear that clicking that button will destroy all subdomains and traffic will no longer be routed to your instances.

So then how do you get into these instances? Well these are still EC2 instance configurations under the covers they don’t appear on the EC2 panel though, same as your hosted zone is nowhere to be found in the route53, don’t panic, you can assign keys to your instances, you can either generate your own keypair or use the default Lightsail ones. You could use ssh from a Linux command line or putty to connect to your instance but why when Lightsail gives you a client to do this with (remember that CLI icon I mentioned). Just click that icon and this appears:

image

You don’t even need a client or to memorise the ssh command (its not that hard) because you can click in and get a fully functional terminal right there in your browser. Its pretty impressive stuff and really does make it very easy to manage straight away without ever leaving the browser where you created the instance.

Other important features include being able to create disks, snapshots of the vm and create load balancers if you have created multiple instances. This is the sort of joined up thinking that makes Lightsail such a no brainer if all you want is a basic service configured quickly and launched into the cloud with minimum fuss. Which is really what the service is all about.

So once I had my server up and running and my domain functioning I simply used Vaultpress to migrate my content. There were a few issues with this, mainly to do with permissions on the Bitnami image but these were easily solved after a bit of research and once the Vaultpress user could write to the correct location it uploaded its helper script and my entire domain migrated in a few minutes. (All one post of it). Also my WordPress configuration came across.

One of the more annoying things that comes with this image is a little banner to bitnami in the bottom of your screen you can disable this it turns out with the following command:

[sourcecode language='bash'  padlinenumbers='true']
sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1
[/sourcecode]

and you can then use the following command to restart apache:

[sourcecode language='bash' ]
sudo /opt/bitnami/ctlscript.sh restart apache
[/sourcecode]

This service has been about for a while now (November 2016) but I’ve really only just got around to looking at it. Its not meant to be an enterprise solution, its meant to be fast and easy and have a predictable price. Its really easy to use and it took me less than 15 minutes to get my instance up, routed, configured and restored (bar permissions issues), I hadn’t read the instructions but did know how dns worked. Its a great service.

Oh and if using guis upsets you there is a public API for doing all this here. And the lightsail docs I didn’t read are here.