Occasionally Lightsailing

I don’t know whether the creators of AWS Lightsail were thinking about solar sails or whether they just thought it was a cool name, but doing some work with Lightsail got me thinking.

Znamya 2 Solar Sail test
www.energia.ru, CC BY 4.0 https://creativecommons.org/licenses/by/4.0, via Wikimedia Commons

I’ve been vaguely aware of the idea of solar sails through fiction for a long time, but hadn’t ever looked much into the state of reality. And it’s a lot more real than I expected. I was surprised to learn that the basic science, and some early proofs of the science, go all the way back to the late 19th Century. The basic science comes out of the work of our favourite Scottish proto-Stark, James Clerk Maxwell, but it wasn’t until some decades later, around the turn of the century, that there was experimental proof that light applies pressure.

I was even more surprised that we’ve had proofs of concept launched since 2010. Right now, the tech boils down to a material science problem, which means that only the hard work remains.

As part of my overall migration into AWS of https://parttimepolymath.net and some other domains, I’d been planning to resurrect this blog. I’d had it hosted at DreamHost for quite a long time, and have a strong desire to be able to return to writing – or turn to writing – and get myself away from the morass of social media. So, the question on my mind was “how do I run up WordPress on AWS, and recover the backup?”

Like many things with AWS, it was both easy, and weirdly difficult in a handful of places.

Let’s start with the problem: I had WordPress assets that I wanted to rehydrate preferably in WordPress; I wanted it on AWS (partly to have a single point of billing); I wanted to have at least some control over the hosting configuration.

I toyed briefly with the idea of self-managing WordPress – build a LAMP stack, install and configure WordPress, spend a month making it work with an acceptable level of security. Then the fever delirium passed, and I started searching on line for “how to run WordPress on AWS”. Every sane-sounding response said “use Lightsail”, so it was an obvious place to start.

So here’s the good and easy part: running up a WordPress instance on Lightsail was trivially easy with Lightsail. The pricing is pretty good too – 3 months free, then $7 USD/Month. This makes it directly cost-competitive with any other reliable hosting. It also gets me a static IP address for the box, SSH access to the box, and a machine that is over powered for what it’s being used for. It also gets me the installed and configured software, and a comfortable degree of security.

Once I had everything up and running, WordPress was able to reload the preserved XML chunk from my previous hosting, but that contained no styling, so that had to be set back up (or rather, setup new). One of the three pain points was that I thought I could just copy all the media back up into the correct location on disk, and that would be int. Nope. Turns out WordPress only “knows” about the media if it’s loaded through its API (or web interface).

This led to the tedious part: I went back through every post and re-added the media as needed by hand. I sort of needed to do this anyway: at some point in the past a weird glitch had caused WordPress on Dreamhost to replace UTF-8 characters with, well, other UTF-8 characters. It was quite odd. So I went back through all the posts, fixed the glitches, fixed some spelling errors and re-loaded the media.

As an aside, I know that link rot is a thing, but I was pleased to find that there was only one page where the linked media had completely vanished from the internet. Another reason for self-hosting media, I think.

So, the annoyances.

Annoyance one: I really wanted to mount the site under https://blog.parttimepolymath.net (by the time you read this, that may or may not resolve). Everything in the documentation, and in the UI hinted that should be possible. It wasn’t. Lightsail can use an existing Route53 root domain, or it can take over a root domain, but there’s no way to tell it to use a subdomain of an existing Route53 domain. Sigh. Oh well, registering https://occasionalmasthead.net is not the end of the world, and it’s handy to have that domain anyway. The converse is the approach that Lightsail takes is that its convenient to add subdomains and additional WordPress sites underneath the initial root domain, which might be how I’ll set up a gallery.

Also, I think I can add https://blog.parttimepolymath.net as a CNAME that pulls across to the real site anyway? All of this is resulting in me finally learning how DNS works.

Annoyance two: having registered the domain and doing some initial smoke tests that it worked, I moved to the next step in the setup wizard, which was to add a LetsEncrypt certificate. Computer says no. First problem was that I’d whitelisted SSH to a certain IP address, and the wizard didn’t like that. Second problem was that I had to wait quite some time – about 20 minutes in the end – for the domain name to disperse across the internet. This didn’t match up to the “wizard” interface provided, which encouraged a click-click-click-boom journey through the setup. When it first errored out… boy, that error message was unfriendly. It took me a few minutes to realise what was going on, and… breathe… wait…

Anyway, here we are. The domain works, SSL works, the site works. Lightsail was (almost) frictionless, and certainly a lot easier than the DIY-alternative. There’s a ton of pre-built applications and stacks, and a few different operating systems. For a small business, or for experimentation and prototyping, it’s a pretty compelling alternative to hand building on AWS itself, while still getting you the availability and reliability of AWS.

Leave a Reply

Your email address will not be published. Required fields are marked *