Latest posts by Thomas Mitchell (see all)
- Load balancing two EC2 instances - Thu, Dec 13 2018
- Deploying a WordPress website with Amazon Lightsail - Fri, Sep 28 2018
Amazon Lightsail is essentially a simple virtual private server (VPS) solution. This offering from Amazon provides the ability to deploy and manage websites and web apps in Amazon Web Services (AWS). Lightsail features a virtual machine, SSD storage, data transfer, DNS management, and even a static IP address.
Through this tutorial, we are going to deploy a WordPress website on the Amazon Lightsail platform. We are going to use the Bitnami WordPress image for the deployment. We will then assign a static IP address to the WordPress site via Lightsail. Lastly, we'll assign a domain name to the website in the DNS management portal of our domain name registrar.
Create an instance ^
To get started, open the Amazon AWS portal and click on Lightsail, which is in the Compute section. If it prompts you for a language, select English and save it.
From the Lightsail dashboard, create a server instance by clicking on Create Instance. It then presents you with an instance location (which you can change if you wish) and two platform choices: Linux/Unix and Windows.
Unless there is a specific reason to change your instance location, leave it at the default.
Choose Linux/Unix as your platform.
Under Select a blueprint, choose Apps + OS and select WordPress.
There is no need to add a script or change the SSH key pair, so leave them as they are.
Next, select an instance plan that fits your expected traffic requirements. For this tutorial, go ahead and cheap out—select the cheapest plan.
Provide a name for your instance and tell Lightsail how many instances to deploy. For this tutorial, go ahead and retain the default name and number.
Click "Create." After creating the new instance, the dashboard presents you with it.
After a few minutes, the status will switch from Pending to Running.
Once the status shows Running, you have a basic WordPress site running. However, you still need to complete some configuration tasks. Not only are you going to want to change the default username, but you will also want to assign a domain name to the website, because until you do so, you will only be able to access the website via its IP address.
Secure the website ^
The default WordPress admin username is user. To retrieve the password for it, click on the instance and then click the Connect using SSH button.
After connecting, you'll see the console screen.
Enter the command below to get the password for the account:
It will display the password you can use to log in to the WordPress admin dashboard.
You can then browse to the IP of your WordPress instance and log in using User along with the password shown in the SSH console. Browse to http://yourIPaddress/wp-admin to log in to WordPress.
If you are interested in best practices, create a new admin account by clicking Users in the left pane of the WordPress dashboard and then Add New. Create a new account and grant it the Administrator role.
After creating the new admin account, you can then log in with it and remove the default admin account.
Assign a static IP address ^
With the site up and running, you can now add a static IP address. To do so, click the Networking link in the instance dashboard:
Click the Create static IP button under the public IP address.
You'll then see the screen below:
Click the Create button to create the static IP resource and to assign it to the WordPress instance.
Confirmation then displays onscreen:
Confirm that the IP address works by browsing to it with your internet browser. It should bring up your WordPress instance.
Setup DNS ^
Accessing a website via IP address is obviously very cumbersome and not very intuitive. As such, you'll want to assign a domain name to the website. To do so, visit your favorite domain name registrar and register a domain name for your website. For this tutorial, I used www.bluewidgets.org, which I registered at GoDaddy.
The easiest way to get DNS going for your new WordPress website is to just use the DNS your domain name registrar offers. To set up DNS for my website in this tutorial, I logged into my GoDaddy account and modified the "A record" for bluewidgets.org. I pointed the "A" record to the static public IP address of my newly deployed website.
After pointing the registrar DNS to the WordPress site's public IP address, I was able to access my Lightsail-hosted WordPress site via DNS:
If you've followed this tutorial in your own environment, congratulations! You've now completed the process of provisioning a Lightsail instance, and you've successfully deployed WordPress to it. You've also secured the website with a new, non-default admin account. By assigning a static IP address to the site along with a publicly accessible domain name, you've made the website available to the world!