There are a ton of options out there to host WordPress including simply running it for free on wordpress.com. That’s the option that I chose for the moment to host this blog.
One option that I’m simply interested in is hosting a WordPress instance on AWS. AWS offers amazing capabilities, but also requires a fair amount of knowledge. So how hard is it to get a WordPress instance up and running?
Not hard at all, as it turns out. Let’s take a quick look into it.
Setting up WordPress using AWS Lightsail
I’m going to assume you already set up your own AWS account and logged into the AWS Management Console. Click on Services and select Lightsail under the Compute category.
On the Lightsail homepage, select to create an instance.
You may pick the region in which you want to run your instance. I picked Frankfurt as I live close to Frankfurt. Then select a platform (Linux) and an application, in our case WordPress! Further down on the same page you can pick a custom name for your instance but if you don’t plan to host a ton of sites the default name will just do fine. You also get to choose an instance plan. I’d recommend going with the cheapest option first except you expect a lot of traffic on your blog. You can scale later if needed.
When you are ready, click the create button and just moments later your instance is up and running and you can see it on your homepage.
In the background, the Bitnami WordPress AMI will be used to create an EC2 instance on AWS.
Next thing you want to do is assigning a static IP address. This way your blog is always reachable via just that IP address and also you can, later on, create a DNS Zone in order to assign a domain.
To do this click on your instance and navigate to the networking tab. Simply choose to create a static IP.
That’s it. We are ready … believe it or not, we have our WordPress instance up and running and it is reachable through a static IP.
Isn’t it amazing how quick that was?! So what are the next steps? One thing that needs to be done is to retrieve the credentials for the WP-Admin.
Getting your WP-Admin credentials
In order to get the login credentials for WP-Admin we need to log into our instance via SSH. Lightsail makes that really really easy and allows you to connect via your browser. It works for me when I use Google Chrome. So go back to your instance and click on the connect tab.
Now choose to connect using SSH. Lightsail will open a new browser window and automatically log you in securely.
When the machine got instanciated the username and password for WP-Admin were saved on the disk of the machine. You can view it by typing in the following command.
cat ./bitnami_credentials
Now go to http://your-static-ip/wp-admin and you can login using the credentials from the file. It is recommended to delete the bitnami_credentials file and also to change the default password.
We could start customizing WordPress now, but the next thing I’d recommend to do is securing your blog. Right now it is only possible to connect via HTTP. So when you login credentials will be sent over the wire unencrypted. You might think that for your small blog that doesn’t matter but believe me it does.
Assigning a Domain Name
In order to secure the site and implement SSL we first have to assign a domain name. We will do this by configuring a DNS zone. Go to your Lightsail homepage and then click on the networking tab. Now create a DNS Zone.
Enter the domain that you want to route to your newly created WordPress instance. If you don’t have a domain yet, you first need to register one. Either through Amazon Route53 or any other domain provider. I register all domains with united-domains.de.
Once the DNS Zone is created you can specify A-records so that the DNS knows to which IP to route traffic when a browser calls the domain. Below is my setup for the purpose of this example.
The IP address is the static IP we configured earlier. Finally, you need to configure the DNS name servers at your domain provider. Check the documentation of your provider should you have questions. Once that is done as well you will have to wait until the DNS setting propagates and the domain actually routes traffic to your WordPress instance.
Jens Neuhaus posted a fantastic write up for creating and installing an SSL certificate using Let’s Encrypt. You can find his post here: SSL for AWS Lightsail WordPress. I followed his instructions one by one and it worked flawlessly.
This was a rather long post, so thanks for bearing with me. I hope you find it useful. Also, I’m planning on comparing this kind of hosting to hosting your blog on WordPress.com. Stay tuned.