This article shows you how to host a WordPress website on AWS using Amazon Lightsail. AWS offers multiple ways of running applications. One of the most versatile services is Amazon Elastic Compute Cloud (EC2), where you can create virtual machines. The thing about EC2 is they may be overwhelming for simple use cases. For common use cases such as creating a basic virtual machine and starting a WordPress website, you might want to have a simpler alternative. Amazon Lightsail is intended to simplify achieving such basic goals.
In this post, we will look into creating a new WordPress website with Amazon Lightsail.
What is Amazon Lightsail?
AWS services are generally like LEGO bricks. You can mix and match them to build complex infrastructure. This comes at a cost, though. Sometimes, you need a pre-packaged simple solution to achieve a simple task. Some hosting providers offer virtual private servers (VPS) with one-click application deployments, such as Linode and Digital Ocean. Amazon Lightsail is AWS’s solution offered to this market.
It was announced in 2016. Unlike an EC2 instance, you don’t select individual components of a server. You rather select a pricing plan which includes a pre-packaged server with a configuration proportional to the pricing. This alone simplifies many tasks that might be daunting to people who are not tech-savvy and just want to get a site up and running as fast as possible.
Without further ado, let’s take a look at how Lightsail works.
Getting Started
When you visit Amazon Lightsail Dashboard first thing you notice is that it’s quite different from a regular AWS service:
It might take some time to get used to this UI but fortunately, it’s quite intuitive so getting everything set up should not be too much of a hassle.
Let’s get started with our WordPress site:
- In the dashboard, click Create Instance button in the middle of the screen.
- The first thing you need to do is to approve or change the Instance location. The closest region to your location is pre-selected.
When choosing the instance location, be mindful of your target audience. Being close to your users will reduce the network latency and will make a better experience for your users.
- Next, you pick your operating system image.
In terms of price and performance, I’d strongly recommend choosing Linux/Unix as your platform, which we’ll be selecting in this article.
- Now it’s time to select WordPress, which is already the first item on the list and selected. WordPress is such a popular application that it’s always the first in such lists.
According to WordPress’s official site, WordPress is used by 43% of all websites on the Internet.
If you intend to host multiple websites, you can also choose WordPress Multisite option, the second option in the list.
- Now it’s time to select the pricing plan. You don’t have to worry about the little details fo the instance. You just pick the plan closest to your budget.
At the time of this writing, the first 3 months of the first 3 plans ($3.5, $5 and $10 plans) were free. This is a good opportunity to try out a new WordPress website for free and make a decision about going forward afterwards.
In this article, we are going to proceed with the $5 plan.
Select the $5 plan option
- Give your instance a unique and memorable name to identify your website
- Click Create Instance button at the bottom of the screen. You should be redirected to the instances dashboard and view the instance’s status.
In about 2-3 minutes, the instance should be up and running:
- Test installation. Visit the IP address allocated to your website, and you should see a default WordPress installation:
Add /wp-admin to the IP and you should be able to see the WordPress login page:
Congratulations! Your website is up and running! 🎉🎊🍾
Configuring WordPress
Now that you have a freshly installed WordPress instance, it’s time to configure and add content. As you went through the steps in the installation process, you must have noticed that you didn’t provide a username and password to log in to your instance. So finding out the username and password is our next step.
- In the Use your browser section, Click Connect using SSH button
- You should end up in an SSH terminal in a new tab:
- In the terminal, run the following command:
cat bitnami_application_password
This should simply print the default administrator password:
Copy the password shown in the terminal
- In a new tab, go to https:// {your public IP address} /wp-admin
- Use the “user” as the default user and the password you previously copied from the terminal to log in to your WordPress dashboard.
You should end up seeing something like this:
At the time of this writing, the installed WordPress version was 5.9.3, but a major upgrade (6.0) was available. As upgrading WordPress is outside this article’s scope, we will not cover it. But please keep in mind that keeping your WordPress installation and all the plugins up-to-date is a good practice.
Set up Static IP Address and Custom Domain
Now we have a fully-fledged WordPress site, but we still have two problems:
- We can’t give our users an ugly-looking IP address
- The default IP address is dynamic and will change every time your instance is stopped and started again.
To address both issues, first, we need to set up a static IP address and point a domain or subdomain to that IP address.
IP Address
- Go to the Lightsail networking page: Lightsail Networking
It should look something like this:
Click Create Static IP button.
- In the Attach to an instance section, select your instance from the list:
- Give it a meaningful name and click Create
Up to 5 static IP addresses are free of charge, ONLY when they are attached to an instance. So be mindful of releasing them when not in use.
- This should take you to the IP address details and it should show that it’s been assigned to your instance:
- Test your blog again by visiting the IP address and you should still see the blog running.
Custom Domain
Once you have your static IP address, it’s fairly straightforward to point to your domain/subdomain. It completely depends on your DNS provider. In this example, I’m going to assume your domain is already registered and hosted on Amazon Route53.
- Go to your hosted zone in Amazon Route53 and click Create record:
- Enter your subdomain in the Record name (or leave it blank if you’re going to point root domain)
Make sure the record type is A.
- It may take a few minutes for the DNS records to propagate. After a while when you visit your domain/subdomain, you should still your blog:
Conclusion
This article covers the origins of Amazon Lightsail service and how it compares to Amazon EC2. It covers setting up a new WordPress instance from scratch and shows setting up an IP address and pointing a domain to the new blog.