How to Install WordPress on AWS
Cloud hosting is a type of hosting that has grown in popularity over recent years. It uses the resources of multiple servers simultaneously, which help it provide users with benefits like mobility, scalability, and rapid data recovery. This makes it ideal for large businesses as well as those that have simply outgrown their previous hosting solution. If you fall within those categories or are simply curious to learn more, read on!
In this article, we will discuss some of the benefits of cloud hosting and why you should consider AWS when deciding on your cloud hosting provider. We will explain how to install WordPress on AWS, and share some tips on things you should do after the installation. Despite the technical nature of this article, we have made sure that all the instructions are carefully laid out so users of all skill levels can follow the material. But, as there is no end to education, we invite you to conduct additional research if you need help grasping any of the concepts we’ll be mentioning.
Since the topic of WordPress on AWS is intricate, we’ll show you how to tackle it by breaking it down into several smaller steps:
Cloud hosting enables you to host your website across multiple servers. Among many others, this has two distinct advantages. The first is the ability to dynamically scale server resources according to your website’s current traffic, and the second is constant uptime (or as close to it as possible) for your website. This means that since it is run across multiple servers, in case one goes down, your website will get served through a different server, which is a part of the same infrastructure.
Even though the benefits of cloud hosting are clear, choosing your cloud hosting provider can be hard, as there are many available. The one we’ll be focusing on today is AWS (Amazon Web Services).
AWS is the biggest cloud hosting provider, so it is only natural to consider it for your cloud hosting solution. AWS is the hosting provider of choice for a wide range of businesses, including Netflix, Twitch, LinkedIn, Facebook, Twitter, and many others. It is ideal for websites with a large amount of traffic that require high performance; especially if that traffic often comes in spikes. It can also be a good choice if you are expecting a large influx of traffic soon.
However, potential benefits often come with potential drawbacks, as well. For one thing, it’s billed by the hour and not on a monthly basis as is the case with regular hosting providers. So, you could end up overpaying if you aren’t sure what are the ideal hosting requirements for your website. For another, despite the extensive documentation AWS provides, there is a bit of a learning curve when it comes to managing your instances, i.e. your websites. As such, we can’t advise it for users that are new to website management, as they are less likely to fully utilize all the capabilities AWS provides. And, therefore, less likely to get their money’s worth.
Now that you have a better understanding of cloud computing and AWS, we can move on to the how-to part of the article. Please note, you need an activated AWS account to be able to execute the following steps.
Wait a moment until the Amazon EC2 (Amazon Elastic Compute Cloud) service loads. Then, click on the Launch Instance button, followed by a click on the Launch instance sub-option.
After waiting for a bit, the page will load, placing you in the Quick Start tab by default. Now that you’ve started the process of configuring your Amazon EC2 instance, the first step is to choose the appropriate AMI (Amazon Machine Image).
To do so, click on the AWS Marketplace tab and search for wordpress. You will see two options near the top—WordPress Certified by Bitnami and Automattic, and WordPress with NGINX and SSL Certified by Bitnami and Automattic. You can learn more about each of the options by pressing on the More info link next to each one of them. In this article, we will be using the former, as it runs on an Apache server. Therefore the new action is to press the Select button next to the WordPress Certified by Bitnami and Automattic AMI.
Then, click on the Continue button on the pricing popup window that appears.
In the following screen, you will have to choose your instance type by ticking the box next to it. The full instance details will be shown on that screen, so make sure to review them carefully. For this article, we will stick with the t2.micro instance, but you should choose the one that meets your needs. After doing so, press the Next: Configure Instance Details button.
You don’t need to change anything on the following screen, simply press the Next: Add Storage button.
In the following screen, you will be able to increase or add storage. By default, the instance includes 10GB of storage. You can increase it up to 30GB of General Purpose (SSD) or Magnetic storage as a free tier eligible customer, as shown in the message below. Once you are done, press the Next: Add Tags button.
In the following screen, you will be able to add tags, by pressing on the Add Tag button and then adding the key and value. After you’ve done so, press the Next: Configure Security Group button.
Then, you can configure the security groups. By default, SSH, HTTP, and HTTPS are already set up. You can add additional security groups if you need to by pressing the Add Rule button. We will simply move on and press the Review and Launch button to continue.
You will now see an overview of your settings. If needed, you can edit them additionally by clicking on the respective edit links on the right. When you’re done, press the Launch button.
A popup window will appear, asking you to create a new key pair. To do so, choose the Create a new key pair option from the dropdown menu. Then add a key pair name and press the Download Key Pair button. This will download a name.pem file, with the name part matching the key pair name you choose. Make sure to save this file, as you won’t be able to connect with your EC2 instance via SSH otherwise, and you won’t be able to download it after it’s created.
After saving the file, press the Launch Instances button below.
You will have to wait for a bit while your instance is being initialized. After it is done, you will see the Launch Status screen shown in the image below. That screen will also have a list of helpful resources you might want to review.
To access the instance, as well as all other instances you have previously created, press the View Instances button in the bottom right corner of the screen.
By completing the steps so far, we’ve successfully installed WordPress on AWS. The only thing that remains is to access your WordPress website. To do that, locate your instance from the list of instances and tick the checkbox next to it to see more details. Then, locate the Public IPv4 address from the Details tab at the bottom and click on the copy icon next to it to copy the IP address.
Paste the IP address in the address bar of your browser to access the frontend of your new WordPress website.
If you want to access the backend of the website, manually add /wp-login at the end of your IP address in the address bar. This will open the WordPress login screen. To log in, you will need to figure out both your username and password.
To find them, return to the EC2 instance window. Then press the Actions button while making sure that the checkbox is still ticked next to your instance. Click on the Monitor and troubleshooting option, followed by a click on the Get system log option.
This will open the system log, where you need to look for your WordPress credentials. Look for the section surrounded by # signs, or search for Bitnami application password using the CTRL + F functionality. By default, the username is user, while the password will differ based on your instance.
Copy the credentials without the quotes that surround them. Then paste them into the appropriate fields on the WordPress login screen that you have open, and press the Log in button.
When you’ve accessed the admin dashboard, you will be able to manage your WordPress website properly. The Bitnami WordPress instance will come with a default theme and some plugins installed, and it’s up to whether to keep them or not.
Even though this marks the successful end of the installation process for WordPress on AWS, there are still some additional things we advise you to do. We will discuss them in detail in the following section.
In this section, we will explain the steps we suggest all users do after installing WordPress on AWS. Those include assigning an elastic IP address, acquiring and setting up a domain name, and securing your website with an SSL certificate. As a bonus, we included advice on how to remove the Bitnami banner in the bottom right corner of your website if you want to do so.
Assigning an Elastic IP address
After creating a WordPress website on AWS, a public IP address is associated with your instance. But, every time you reset your instance, your public IP address will change. Therefore, the most important step after creating your WordPress website is to give it a static external IP address, which AWS refers to as an Elastic IP address. Otherwise, locating your website would be close to impossible for anyone else, since the IP address would keep changing constantly.
To assign an Elastic IP address to your instance, you would need to create it first. To do so, connect to the EC2 once more and click on the Elastic IPs option, found within the Network & Security section of the menu on the left. Then, press the Allocate Elastic IP address button.
On the subsequent page, press the Allocate button, which will create the elastic IP address.
The following step is to associate the IP address you just created with the existing EC2 instance, i.e. your WordPress website. To do so, make sure to tick the checkbox next to the appropriate IP address and then click on the Actions button, followed by a click on the Associate Elastic IP address option.
Wait a bit until the next screen loads. Then, make sure that the resource type is set to Instance and insert the instance ID and the corresponding private IP address. If you’re not sure what your private IP address is, you can find it by taking a look at your instance details. Your private IP address will be in the Details tab, next to your public IPv4 address.
Afterward, press the Associate button.
You will see a similar success message afterward.
Then, to access your website, you will need to type in your new, static, IP address as opposed to the one you used previously.
Configuring a domain name
Since your users might have a hard time memorizing your IP address, you should assign a unique domain name to your website to serve as its name. Make sure to choose a domain name that both stands out and is easy to remember. This can bring you many benefits. A good domain name will help you build a brand, add credibility to your business, and attract visitors that might not have searched for your website, but a topic in general. Furthermore, by owning a domain name, you won’t lose the brand you built up in case you need to change hosting providers.
You will need to buy a domain name from domain name providers, or domain registrars as they are called. Some of the better known include Domain.com, GoDaddy, Namecheap, Bluehost, Register.com, Hostgator, Google Domains, but there are many others. Since domain names and how to get them is a broad topic, take the time to consider all that you need when choosing a domain name.
After you buy your domain name, you will need to configure it. Below, we will explain how you can do so within AWS.
To configure a domain name, navigate to the AWS console, click on Services and look for the Networking & Content Delivery section. Within it, click on the Route 53 option.
On the following page, you can register your domain name, if you haven’t done so before. We registered our domain previously using a domain registrar called Namecheap so we will skip ahead and proceed to create a DNS zone. To do so, press the Create hosted zone button in the DNS management section.
In the following screen, insert your domain name, set the type to Public hosted zone, and press the Create hosted zone button. If you like, you can add a description and/or a tag to your hosted zone to better organize it and distinguish it from any other hosted zones you may have created previously.
After a bit, you will see a success message and the DNS records that are currently assigned to your domain name.
Then, we will add two additional DNS record sets. These additional records will provide servers with information on how to locate and connect to your site. They will contain information about which domain you’re using, your hostname, and the IP address of your site. Start by pressing the Create record button.
In the following step, you are asked to choose a routing policy. We will stick to the Simple routing option, which is selected by default, and press the Next button below.
In case you need to choose a different routing policy, we suggest reviewing the corresponding AWS documentation first.
Afterward, press the Define simple record button found on the following screen.
This will open a popup window asking you to define the information on the simple DNS record you wish to create. For the first record set you’re adding, don’t type anything into the prefix section next to your domain name. Also, you should choose the IP address or another value depending on the record type option for the Value/Route traffic to field. Then, insert the previously created elastic IP address of your website into the field that appears below. You should leave the record type as A – Routes traffic to an IPv4 address and some AWS resources, which is the default value. You can also leave the TTL (Time To Live) value as the default 300 seconds. Then, press the Define simple record button below to define the first DNS record.
To define the second DNS record, press the Define simple record once more.
In the following popup window, change the record type to CNAME – Routes traffic to another domain name and to some AWS resources. Then, add www as the prefix next to your domain name and choose IP address or another value depending on the record type for the Value/Route traffic to option. After that, insert your domain name (without the prefix) in the text field below. Again, you can leave the TTL set to the default 300 seconds and press the Define simple record button to finish.
After defining both additional records, press the Create records button to create them.
Then, you will see a success message, as well as the list of all your DNS records.
Afterward, you will need to update the name servers of your domain registrar with the corresponding ns records you created (marked on the screenshot below).
The exact steps of this procedure will differ based on your choice of domain registrar. We will explain the procedure for Namecheap.
First, log in to your domain registrar’s account and click on the Domain List option from the menu on the left. Then, locate the domain name you wish to associate with the previously created hosted zone and press the Manage button next to it.
In the following screen, within the Domain tab, choose the Custom DNS option as the nameservers. Then manually insert all four AWS ns records, one at a time. By default, there will only be two record slots available, but you can add additional slots by pressing on the Add nameserver option below. Then, press the small Save icon to finish.
After that, you only need to wait for your DNS records to propagate. While this can take up to 48 hours, in our case, it only took a couple of minutes. You can always check the status of your website by using one of the DNS lookup tools available online.
Afterward, you can access your website by typing the domain name into the address bar of your browser window.
Configuring free SSL certificate from Let’s Encrypt
SSL (Secure Sockets Layer) is a security protocol used for encrypting confidential data that users might share on your website. Examples of it include credit card numbers, social security numbers, login and password information, and more. The encryption prevents hackers from intercepting the data while it is being transmitted and taking advantage of it. Apart from security, SSL serves for authentication as well, guaranteeing ownership over a certain website, which fosters trust among that site’s users. Having such a security protocol is mandatory for eCommerce websites and encouraged for all other websites.
Over time, security protocols get updated, so the latest version of this security protocol is called TLS (Transport Layer Security). But, the name SSL stayed on account of its popularity, which is why the current protocol is often referred to as SSL/TLS. As such, to make sure your website is secure, you would need to create an SSL/TLS certificate, which can be either free or paid. One of the most widely recognized websites for issuing free certificates is Let’s Encrypt. All their SSL certificates are certified by trustworthy third-party organizations, also known as certificate authorities (CAs).
For our guide on creating a WordPress website using AWS to be as thorough as possible, we will explain how you can configure a free Let’s Encrypt SSL certificate as well. The configuration process can be broken down into two parts—logging into your server using SSH and executing the appropriate commands for generating a free SSL certificate from Let’s Encrypt.
Logging into your server using SSH
As a requirement for this process, you will need the .pem file you saved while deploying the EC2 instance. Also, you will need an SSH client to use for executing commands. Linux and macOS users can use the SSH client that’s already built into their operating systems, while Windows and UNIX users will have to download and install PuTTY.
In the following section, we will show how you can connect to your server using PuTTY. For Linux and macOS users, we advise reviewing the Bitnami documentation on how to connect to SSH.
After installing PuTTY, run the PuTTYgen file found in the PuTTY installation folder.
Press the Load button to open a file dialog window.
Find the .pem file you have stored on your computer and select it by pressing the Open button. When opening this file dialog, the file type will be set to .ppk by default, so make sure to switch the file type to All Files to be able to find the .pem file.
Afterward, press the Save private key button to convert your .pem file into .ppk format.
After that, press the Yes button on the warning that appears, and save your key by inserting the appropriate file name and clicking on the Save button.
Then, launch the PuTTY file from the PuTTY installation folder. Insert your public IP address as the Host Name (or IP address) and as the Saved Sessions. Then, press the Save button to store the session for later use. After this, you will be able to find it in the list of saved sessions.
Next, navigate to Connection > SSH > Auth and press the Browse button. This will open a new file dialog, where you need to select the previously saved .ppk file and press Open to use that file as the private key file.
Then, navigate to Connection > Data and insert bitnami as the auto-login username.
Navigate once more to the Session section and press the Save button.
Finally, click on your saved session and press the Open button to open an SSH session with your server.
Then, in the popup warning that appears, click on the Yes button to confirm and cache the server’s host key.
With that, you have successfully connected to your server using SSH. You will see the SSH terminal window that looks like the one in the screenshot below.
Generating the SSL certificate
After you connect to your server using SSH, insert the following command:
into the SSH terminal.
You will now be prompted to insert the appropriate information to configure the free SSL certificate.
First, insert the list of domains, separated by spaces, for which you wish to configure the SSL certificate. Then, insert y to enable redirection from HTTP to HTTPS. Afterward, you can choose whether to enable the www to non-www redirection and/or non-www to www redirection. For this article, we decided to disable non-www to www redirection and enable www to non-www redirection by inserting n and y, respectively. This comes down to personal preference, so you can opt to do otherwise.
After waiting a bit, you will get a list of changes that will be applied to your Bitnami installation. Insert y to agree to those changes. Then, insert a valid e-mail address and insert y to agree to the Let’s Encrypt Subscriber Agreement. Afterward, you will have to wait for a while longer while your chosen actions are run. Then, you will see a success message and a configuration report. Examine it carefully and take note of where the appropriate backup and log files are located. Finally, press the Enter key on your keyboard to finish the setup.
Afterward, you should test your website. You can do so by using the https://your-website.com link or by running an SSL test using an online tool, like SSL Labs. When accessing your website in the browser, you should see a padlock next to the address confirming that your site is secure.
Removing the Bitnami banner
As you may have noticed, when installing WordPress using Bitnami and Automatic, the Bitnami banner will be placed in the bottom right corner of your website by default. Even though it doesn’t affect your site materially, a lot of users opt to remove it. The most common reason for that is the banner may not fit their website design or the brand they are trying to create. In case you’d like to remove it as well, we will show you how that’s done. However, we must warn you that some of the steps require a good understanding of SSH commands. If you aren’t familiar with them, we advise you to review PuTTYgen’s list of basic SSH commands first.
A prerequisite for this process is connecting to your server using SSH. After doing that, you should insert the following command into the terminal:
sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1
This is the same command provided on the official Bitnami documentation page, only with the APPNAME part replaced with the name of the appropriate directory.
If you get an error that the sudo /opt/bitnami/apps/wordpress/bnconfig command wasn’t found it can mean a couple of things. The likely ones are that either you aren’t positioned in the root directory or that the file name (bnconfig) is incorrect. During our trial run for this article, both happened. Therefore, we will show you how to investigate the issue on your end, in case an error appears. Needless to say, if you didn’t get any errors, you can simply skip to the part regarding restarting your server.
Investigating the error
First, we need to find out what our current directory is. This is done by inserting pwd into the terminal. During our testing, the results showed us that we were in the /home/bitnami directory, instead of in the root directory. To return to the root directory, we inserted the cd / command. It is worth noting that inserting the cd ../.. command would have also worked, as that command shifts you two directory levels up.
After that, try to insert the initial command for removing the banner once again after reaching the root directory. If you get the same error as we have, it most likely means that the file name you used is incorrect.
To check if that is the case, you need to inspect the names of all the files and subfolders within the wordpress folder. This is done by using the following command:
ls /opt/bitnami/apps/wordpress -a
Alternatively, you can even inspect all the files and folders in all the subfolders starting from opt to wordpress, if you suspect that the path is incorrect as well. This is done by executing the ls directory-path -a command, where the directory-path should be replaced with an actual directory path. Moreover, you can figure out your APPNAME by investigating the content of the /opt/bitnami/apps directory. Having said that, let us proceed with the next steps.
After inspecting, we noticed that the file is called bnconfig.disabled as opposed to bnconfig which is indicated in the official documentation. If that is the case for you as well, you only need to replace the bnconfig part with the bnconfig.disabled in the initial command. Put simply, you need to insert the following command into the terminal:
sudo /opt/bitnami/apps/wordpress/bnconfig.disabled --disable_banner 1
We are confident that, by following these steps, you will be able to troubleshoot the error type on your end with ease.
Restarting the server
To restart the Web server, insert the following command in the terminal:
sudo /opt/bitnami/ctlscript.sh restart apache
Then, wait a bit. You will get a log of the actions that were taken (actions are shown below the inserted command).
Afterward, you can close your SSH session and visit your website. Make sure to clear the browser cache to see the latest version of your website. You should find that the Bitnami banner that was previously in the bottom right corner is gone now.
In this article, we have covered the process of installing WordPress on AWS. Follow our instructions carefully, and you will have a working website in a matter of minutes. On top of that, we made sure to include all the important steps you should take after your website is created as well as explain what makes them are important.
Even though some of the steps outlined in this article might be geared towards more technically advanced users, we have tried to present them in a manner understandable to a wider audience. Nevertheless, we highly advise everyone to consult both the overall AWS documentation, as well as Bitnami’s documentation on creating a WordPress website using AWS, for more information before embarking on site creation. We have done our best to cover everything you might need, but the devil’s in the details, so we suggest you keep the official documentation on hand just in case.