Skip to main content

Why Lightsail?

Before we begin this tutorial, let’s have a chat about why you should use AWS Lightsail over other hosting solutions. Most WordPress installations are used to run small websites and blogs, and these are usually ran on “Shared Hosting” solutions. And let’s face it, anyone who has used shared hosting before know it can be a pain at the best of times. Sometimes your website can run great and other times it can be extremely slow and sluggish, it all depends on the other websites sharing the resources with your site. And even at that, the speeds on a shared server aren’t always that great.

What Lightsail offers is your own Virtual Private Server (VPS) on AWS’s infrastructure for small (and not so small!) websites at shared hosting prices. Lightsail also comes with additional benefits you don’t get with shared hosting, such as having your own static IP address, DNS management, backups & access to a CDN and load balancers. Why would you start a website on a shared hosting package nowadays when you can set yourself up on Lightsail?

Let’s get started

AWS Lightsail’s WordPress installation is very simple, and with a few minor configuration tweaks we can get up and running in just a few minutes. AWS uses the Bitnami WordPress image to install & manage WordPress on AWS. Before we kick off, make sure you have an AWS account set up and have a payment method attached to your account.

Now, let’s head to the Lightsail dashboard and kick off the installation of our WordPress website. If this is your first time visiting Lightsail, you’ll be met with the below page. Let’s hit the Create instance button and get stuck in.

Under Instance location, select the location you would like your WordPress installation hosted. It is best to select a location closest to your target market, in order for optimal loading speeds. As I am based in Ireland, I will be using eu-west-1. Let’s also select WordPress while we’re at it as our instance image.

Now, to ensure our WordPress site is backed up, let’s tick “Enable Automatic Snapshots” and select a time that suits for the backups. I usually have my backups run at midnight, to ensure there is no performance impact during what could be a peak time. We’re also going to select our instance plan. For small websites such as personal websites and blogs, the $3.50 monthly package would suit just fine. For websites for businesses i’d recommend upgrading to the $5 plan, and online stores powered by WooCommerce would be most optimal on the $10+ packages.

Now let’s give our instance a name. It’s best to name this something identifiable. As I am setting this instance up for the domain “jord.dev”, i’ll call my instance jorddev.

Now go ahead and click the “Create instance” button. Give it a few minutes (get yourself a coffee!) and once our server will go from Pending to Running. That’s it, we now have our own server running with a sample WordPress website installed!

Getting logged into WordPress

Now that our instance is ready, we are provided with a public IP address. If we visit this IP address, we will find that a sample WordPress website is running.

We now need to get our login to be able to get into the WordPress admin panel. The default user id for the installation is “user” – but the password has been randomly generated! Let’s go ahead and select the terminal icon at the top right of our instance on the Lightsail dashboard. Enter the below command and we’ll be greeted with the password that has been generated for our WordPress installation.

cat bitnami_application_password

Let’s visit our WordPress admin dashboard (by visiting http://ipaddresshere/wp-admin) and log in with the details as provided. For security purposes, I would suggest setting up a new administrator account and deleting the default account that has been set up. We’re also going to want to run through WordPress updates, as the Bitnami installation could be a little out of date.

Setting a Static IP Address

Our next step to take is setting up a static IP address for our site. By default, the installation will come with a Dynamic IP, which could cause hassle down the line, so setting up a static IP is the best option. On the Lightsail dashboard, select the Networking tab and click Create Static IP.

Go ahead and select the instance we previously created as a connection, and give your static IP an identifying name, the click Create.

We’ll now be faced with a new static IP. This is the IP address that will be associated with our website going forward! Be mindful – static IP addresses are only free via Lightsail as long as they are in use and attached to an instance. Otherwise, there is a charge for them.

Setting up DNS

Now we have a WordPress installation running with a static IP address, we’re going to want to attach that IP address to a website domain name. If you don’t already have a domain, one can be purchased at Amazon Route53. This tutorial assumes we already have a domain at another registrar. There’s two options for setting up the DNS for our domain. We can either set up a Lightsail DNS zone and house our DNS on Lightsail, or we can update the A record on our current DNS provider to our new static IP address. For this tutorial, we will be setting up Lightsail’s DNS zone service.

Let’s to back to the Lightsail dashboard and select the Networking tab. Click on the “Create DNS zone” button.

On this page, enter your domain name and click on Create DNS zone. We’re then faced our new DNS zone, along with some Name servers which we will need to point our domain to. Let’s add a DNS record first. Click on Add record and for the domain, enter “@”, and in the resolves to section, a dropdown should pop up with our static IP that we previously set up. How handy!

Now we will need to update our name servers via our registrar. As there are many registrars out there, I won’t go into detail on that in this tutorial. But if you search “how to change name servers on registrar” i’m sure there will be plenty of other guides.

Since we are using Lightsail’s DNS zone – after a few hours our WordPress installation’s site URL should be dynamically set, provided our DNS names are set up correctly.

Generating an SSL Certificate

Let’s make sure that an SSL certificate is set up for secure access to our website. Go back into the CLI from the Lightsail dashboard and enter the below code.

sudo /opt/bitnami/bncert-tool

Enter our domain name when prompted and follow the steps as instructed, and you’ll be met with the below, meaning that the website has be set up with a Let’s Encrypt SSL Certificate.

Visit the domain and we should now be met with our WordPress installation!

What’s Next?

That’s it! We now have a WordPress installation up and running on our own VPS on AWS via Amazon Lightsail. So, what’s next? What else can we do?

For further improvements, we could look into setting up AWS Simple Email Service (SES) and WorkMail for sending and receiving emails; setting up a distribution, to speed up content distribution to our website visitors; and setting up a load balancer, to distribute traffic among multiple instances.

Cover photo by Justin Morgan on Unsplash

close

Don’t miss my posts!

I don’t spam, promise!

Leave a Reply