Harnessing the Power of AWS: A DevOps Guide to Hosting Your WordPress Website – Part 1

In the digital age, your website isn’t just a virtual storefront; it’s often the very heart of your business, serving as a portal for engagement, commerce, and connection. To ensure that your website not only survives but thrives, harnessing the scalability, resilience, and flexibility of the cloud is essential. And when it comes to cloud infrastructure, Amazon Web Services (AWS) stands as a beacon of innovation and reliability.

As an AWS DevOps engineer, I’ve had the privilege of architecting and managing countless web hosting environments for businesses of all sizes. In this comprehensive guide, we’ll delve into the world of AWS and unveil the art of hosting your WordPress website with precision and expertise.

Whether you’re a startup eager to carve your digital footprint, a growing enterprise looking to scale gracefully, or even an individual blogger seeking performance and security enhancements, this blog series is designed to equip you with the knowledge, best practices, and real-world experiences necessary to navigate the AWS ecosystem successfully.

So, fasten your seatbelt, because we’re about to embark on a journey that will transform your WordPress hosting experience, making it faster, more secure, and fully optimized for the demands of the modern web. Welcome to the world of AWS-powered WordPress hosting—a world where your website’s potential knows no bounds.

Let’s begin this adventure together, where the cloud meets code, and where your WordPress site becomes a digital masterpiece hosted in the AWS cloud.

Services Used: 

  1. AWS EC2
  2. Route 53

Step 1: Launch an EC2 instance.

We are going to follow the traditional way of launching the EC2 instance and installing WordPress on it.

On EC2 console, Click “Launch Instance” 

  1. Instance Name: WordPress Server
  2. Application and OS Images: Ubuntu
  3. Instance type: t2.micro
  4. Keypair login: If you have keypair already launched, use existing one or create a new key-pair.
  5. Network Settings: Select “Create Security Group” and
    1. Enable: Allow SSH
    2. Enable: Allow HTTPS
    3. Enable: Allow HTTP
    4. Keep Auto-Assign Public IP Enable
  6. Rest: Keep default settings.

And Launch the instance. After launching and running the isnatcne it will look something like this.

A screenshot of a computer

Description automatically generated

We need to assign Elastic IP to the instance. Navigate to the Elastic IP Section and Allocate and associate an Elastic IP to our instance.

A screenshot of a computer

Description automatically generated

And click on “Allocate”.
Select the allocated Elastic IP and Click on “Actions”,  “Associate Elastic IP Address”, select “Instance”, Choose the Instance and click on Associate.

Now we need to login(SSH) into the instance. We will use MobaXterm app to login.

A screenshot of a computer

Description automatically generated

After logging successfully into EC2 instance.

We will run a set of commands on it.

  1. Install Apache server on Ubuntu

sudo apt install apache2

Now to going to the Public IPv4 IP address of browser, you will see apache home page.

  1. Install php runtime and my-sql connector
    sudo apt install php libapache2-mod-php php-mysql
  2. Install MySQL server

sudo apt install mysql-server

In order to install wordpress we need to create credentials for my-sql server.

MySQL is a critical component of a WordPress website running on an Amazon EC2 instance for several reasons like
DB Management, Data Storage, Data Retrieval, Data Integrity, scalability, Customization, Compatibility, etc

  1. Login to MySQL server

sudo mysql -u root

  1. Change authentication plugin to mysql_native_password (change the password to something strong)

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password by ‘Testpassword@123’;

  1. Create a new database user for wordpress (change the password to something strong)

CREATE USER ‘wp_user’@localhost IDENTIFIED BY ‘Testpassword@123’;

  1. Create a database for wordpress

CREATE DATABASE wp;

  1. Grant all privilges on the database ‘wp’ to the newly created user

GRANT ALL PRIVILEGES ON wp.* TO ‘wp_user’@localhost;

  1.  Download wordpress

cd /tmp

wget https://wordpress.org/latest.tar.gz

  1.  Unzip

tar -xvf latest.tar.gz

  1.  Move wordpress folder to apache document root

sudo mv wordpress/ /var/www/html

Since we have downloaded the .tar file, unzipped it and moved to the /var/www/html directory. 

Now, <Instance IPv4/wordpress> of the instance in browser will take to the installation page of wordpress. It will look something like this.

A screenshot of a computer

Description automatically generated

In the next blog we will go ahead and install WordPress for website and look for other details.

Addend Analytics is a Microsoft Gold Partner based in Mumbai, India, and a branch office in the U.S.

Addend has successfully implemented 100+ Microsoft Power BI and Business Central projects for 100+ clients across sectors like Financial Services, Banking, Insurance, Retail, Sales, Manufacturing, Real estate, Logistics, and Healthcare in countries like the US, Europe, Switzerland, and Australia.

Get a free consultation now by emailing us or contacting us.