Running WordPress on Amazon Lightsail

I started this blog site on https://wordpress.com, using the free hosting option. That worked OK for a while, but then I discovered how difficult it can be to add formatted code samples to a blog post. I wanted to add samples like the one shown in this screenshot:

WPOLS-screenshot-01
Just a small sample of a Maven POM file

Some Google searches turned up a solution: use a WordPress plugin.

Unfortunately, the free WordPress.com hosted sites do not allow one to install plugins. In order to do so, I would have to subscribe to their “Business” plan, for about $30 per month. That’s way too much to spend on my little hobby blog, so I had to look for other alternatives.

I found plenty of independent hosting services that will set up a WordPress instance for you, manage the server backups, etc. Then I happened upon a search result for WordPress hosting on Amazon Lightsail. This is how Amazon describes what Lightsail is:

Lightsail is designed to be the easiest way to launch and manage a virtual private server with AWS. Lightsail plans include everything you need to jumpstart your project – a virtual machine, SSD-based storage, data transfer, DNS management, and a static IP – for a low, predictable price.

Details, please…

If you already have an AWS account, then you should already have access to Amazon Lightsail. In the AWS Management Console, click “Services” and then look for Lightsail under the “Compute” options.

WPOLS-screenshot-02

You’ll be launched into a new browser window/tab, with a layout that’s different from the AWS Management Console.

WPOLS-screenshot-03

In the screenshot above, you can see the running instance of WordPress in my account that is powering this blog.


Creating a new WordPress instance

Look for the big orange “Create instance” button, and click it.

WPOLS-screenshot-04
Click me!

Before a Lightsail server instance is created, you’ll need to choose from some options. The first one is your hosting region.

WPOLS-screenshot-05b
No Canadian hosting? Boooooooo!!!

I was going to choose the Central Canada zone, but it appears that Lightsail servers aren’t available in all the AWS regions. The Virginia region will be fine. You can also change the availability zone within the selected region if you wish.

Next, you need to choose the Lightsail instance type. The only choice (at the time I write this) for WordPress is on a Linux-based OS.

WPOLS-screenshot-06

Any now my favorite part – the price!

WPOLS-screenshot-07
First month free? I like free stuff…

The tiny instance plan is all I’m going to need for this hobby blog, and the price is right. I love that the first month is free. If I get in over my head with the setup, then I can just come back and delete the instance and not be out of pocket at all.


Instance settings

I’ve already created my instance (you’re reading a post on it right now), so instead of clicking “Create”, I’ll just go back to my Lightsail home page and show some of the features.

WPOLS-screenshot-08

I’ll choose the “Manage” option for my WordPress instance first.

WPOLS-screenshot-09

The top half of the instance details page just gives the highlights about the instance, but does provide handy Stop and Reboot buttons. Some of the setup instructions require an instance restart after you change something in the Linux terminal session. Clicking the Reboot button is easier than doing it from the command line.

The bottom half of the page is organized into sections. The “Connect” section comes first. I haven’t bothered to obscure the host username, because everyone who uses this image type will have “bitnami” as the username. The SSH session connects via a keypair, so knowing the username doesn’t really give anything away.

WPOLS-screenshot-10
“Connect” section

The “Connect” section has a big orange button that you use to launch a browser-based SSH terminal session with the Linux host. I needed to use this to manually modify one configuration file, and run a couple of commands. In each case, the step-by-step instructions were provided. You’ll only need a basic working knowledge of Linux command line operations to get the job done. It also seems to be a one-time thing (at least so far…).

WPOLS-screenshot-11
This is what the terminal session looks like

I’ll skip the “Storage” and “Metrics” sections because there isn’t anything too interesting in those, and I’ll move on to “Networking”.

WPOLS-screenshot-12
“Networking” section

When you first create a new WordPress instance, it will not have a static IP address. You’ll need to click a button to attach a static IP. There is no extra cost to have a static IP, as long as your instance is always Online. AWS charges customers hourly for static IPs (also called Elastic IPs) that are reserved, but not attached to a running server instance. In the screenshot above, you can see that I have already attached as static IP to my instance. I needed a static IP before I could associate my “jimtough.com” domain with my WordPress instance, so the address http://blog.jimtough.com would work. The procedure for associating your internet domain name with a static IP will vary, depending on your domain name registrar. I discuss how I did mine in this blog post.

The Firewall settings seen in the screenshot are the defaults. I haven’t had cause to change them so far.

The next section is “Snapshots”.

WPOLS-screenshot-13
“Snapshots” section

I believe a “snapshot” is a copy of the host server image at a moment in time. I took a snapshot earlier today, and they aren’t quick. It appears that you can use a snapshot to start up another instance of WordPress on a separate host.

WPOLS-screenshot-14
Cool feature, but not useful for me at the moment

I just wanted a backup in case I make a host configuration change that messes something up. The snapshot would give me a way to step back to a stable host setup. Note that a snapshot isn’t the same as backing up your WordPress blog content. That should be done from inside the WordPress application.

I’ll skip the “History” and “Delete” sections. “History” is just a log of events, like when you last restarted the instance. The “Delete” section is for deleting the entire instance forever.


Configuring the new instance

When a new WordPress instance is created, it starts with many configuration tasks left for you to address. I didn’t know if I would be successful in getting my instance set up the way I wanted, so unfortunately I didn’t take screenshots during the process. I do apologize.

Logging in for the first time

When a new instance is created, you’ll get something like this when you open a browser and go to the public IP address of the instance:

WPOLS-screenshot-15

That little “Manage” icon in the bottom right corner is the key. If you click it, you’ll be navigated to a page with instructions on how to configure your WordPress instance. The first thing you should do is get access to the WordPress admin page and create a proper user for yourself. A fresh Lightsail instance is set up with only one user, named “user”, who is also the Administrator.

After you’ve done all the server configuration, you’ll want to get rid of that “Manage” icon as well. They also provide the instructions on how to do that.

Installing Plugins

You’ll likely want to install some plugins to support your blog, and those will depend on your particular needs. Putting those aside for now, there are some plugins that I think everyone should use.

Plugins are installed from the administrator page.

WPOLS-screenshot-31

Jetpack

WPOLS-screenshot-29

The Jetpack plugin allows you to integrate your privately hosted WordPress instance with your WordPress.com account. That alone makes it worth installing. It also does a bunch of other things. Just install it!

WP Mail SMTP

WPOLS-screenshot-30

Once you install and configure this plugin, your WordPress instance will be able to send outgoing email. This is useful if you have your blog set up to alert you when there are comments to be moderated, etc. If you don’t set up something for outgoing email, then you won’t receive email alerts from your instance.


Migrating from WordPress.com to my new instance

As I mentioned at the start of this post, I originally started this blog on wordpress.com. My hope was that it would be easy to export the existing blog site content and import it on my new server. It was possible to do just that, and it wasn’t too difficult to figure out.

Exporting from the old WordPress blog host

Start by going to wordpress.com and viewing the old site.

WPOLS-screenshot-16

Then scroll down to the Configure options, and click “WP Admin”. This will launch the administrator interface in a new browser window/tab.

WPOLS-screenshot-17

On the admin page, find the Tools options, and click Export under the list of tools.

WPOLS-screenshot-18

Choose the free export option.

WPOLS-screenshot-19

Leave the default “All Content”, and download the export to your computer.

WPOLS-screenshot-20

Then save the export file somewhere. You’ll need it shortly when you re-import the content into the new WordPress instance.

WPOLS-screenshot-21

Importing to the new WordPress blog host

Start by logging in to the administrator page on your Amazon Lightsail WordPress host. If you’ve forgotten the URL, you can just use the public IP address that’s shown in the Lightsail console.

WPOLS-screenshot-22

You’ll need to append “wp-admin” to the IP address, such as:

http://11.22.33.44/wp-admin/

If you have already associated a domain name with your site, then you can do this:

http://myblog.mydomain.org/wp-admin/

Enter your username and password to log in. On the administrator page, find the Tools option, and choose Import.

WPOLS-screenshot-23

Then choose the WordPress importer.

WPOLS-screenshot-24
Strange that WordPress doesn’t put their own importer at the top of the list. I guess they are serious about keeping things in alphabetical order!

Now you select the (.xml) Export file that you downloaded earlier from your old host, and import it here.

WPOLS-screenshot-25

After the import, all your exported blog content should be available on the new host. You’ll likely want to change some of the settings on your new host to match the old one, such as the Theme, and other display-related settings.

WPOLS-screenshot-26

Note that a fresh instance of Amazon Lightsail WordPress only has a few themes installed by default. It’s easy to install more via the adminstrator page. Just use the “Add New” button in the Theme section to install new themes on your server.

WPOLS-screenshot-27

If you’ve made it this far, then you shouldn’t have too much trouble doing the rest of the setup and configuration of your new WordPress host. Good luck!

 

Leave a Reply