Ha! I’ll be you thought this blog was dead.
Well, truth be told, it was pretty close … but you never know when inspiration will strike.
So a little while ago I had a hardware failure on one my servers. This incident has given me the incentive to try and move some of the servers I host to other machines … where I don’t have to worry about the hardware end of things.
To that end, I started looking at hosting providers. One of the providers I’m looking at is Amazon Lightsail.
Amazon Lightsail provides micro instances of their AWS compute service at very good prices.
A 512mb / 20gb Linux instance only costs $5 / month and the first month is free.
So I’ve been playing around with that and like it a lot.
I’ve currently got a handful of sites moved over to Lightsail.
I have encountered a few gotcha’s though …
512mb isn’t a lot of memory
512mb is fine for running a static website … but if you need to run a database server (MySQL or MariaDB) you’re going to run out of memory quick.
A solution to the memory problem is to add swap space. There’s no built in way to add swap space, so here’s what I did…
- Purchase an 8gb of additional storage (that’s the minimum amount). This costs $0.80 / month ($.10 / gb / month).
- Attach the storage to your Lightsail instance.
- Partition the storage and make the type Swap (type 82).
- Run mkswap on the new partition.
- Add the swap partition to the fstab
- Run ‘swapon -a’ to activate the swap partition.
Now you have an 512mb Linux instance with 8gb of swap space.
If you don’t need the entire 8gb of swap space, you can create a smaller swap partition and use the rest for other purposes.
Tech support is minimal
If you’re going to use Lightsail you have to be prepared to manage the machine yourself and research solutions to problems on your own. They don’t provide tech support unless you pay for it.
In some cases you can get tech support by contacting the billing support department … but they will only provide support for technical issues with the Lightsail platform itself.
pretty much the same thing I want to do. How is the performance of the additional storage as a swap partition?
I want to setup my own mail server with iRedMail on the cheapest light sail vps, but the documentation says I would need 2 GB of memory which is why I want to swap.
Performance is pretty good … it’s just additional Lightsail block storage, so it’s SSD based. For 80 cents a month, you really can’t go wrong IMO.
A swap partition does not replace real memory. It will just mitigate out of memory situations.
Could you detail some of the command lines to do this?
I tried researching some of the command lines to do this, but on the last step for swapon -a, I’m getting a:
swapon: /dev/xvdfl: read swap header failed
Did you perform step 3 … “Partition the storage and make the type Swap (type 82).”?