So, you’ve built your website on WordPress and you are all set to reveal your content to the world. But how do you go about building a resilient and fault-tolerant hosting infrastructure for your website? Well, this is where the concept of WordPress High Availability comes in. WordPress is an open-source Content Management Platform primarily used for publishing blogs and building websites. And, WordPress High Availability ensures maximum uptime, performance, and availability of your website.

Website owners know that it’s vital to deliver positive and consistent performance to their audience. High Availability ensures that your infrastructure continues to work even when certain components of the system fail. This reduces the impact of failure on the end-users. However, you need to define, plan, and deploy applications accordingly in order to have increased WordPress High Availability. This blog will help you achieve WordPress High Availability on AWS Cloud.

What is High Availability?

In simple terms, High Availability is all about keeping your systems up and running in case anything goes wrong. This quality allows any infrastructure to function even in the event of component failure. This is very critical for systems that cannot tolerate interruption in service, and any downtime can result in financial loss.

One of the important principles of High Availability in WordPress or anywhere else is to eliminate all single points of failure. For instance, if you had 1 Web Server and if that Web Server goes down, your whole website will be unavailable. So, to prevent that, you would need to have multiple Web Servers working together to ensure that your website stays up even if a Web Server goes down.

WordPress High Availability on AWS Cloud

Here, you’ll be making use of a few AWS resources to set up WordPress High Availability on AWS Cloud. You’ll be using AWS Relational Database Service (RDS) to run the WordPress Database on a separate RDS instance. AWS Application Load Balancer (ALB) will be used as a single entry point for the website. And finally, AWS Elastic File System (EFS) will be used for storing all the WordPress config files, plugins, and WebPages.

The wait is over, let’s get started. Follow the below-mentioned steps to set up WordPress High Availability on AWS Cloud.

Create your MySQL Database

First up, you’ll need to set up an RDS (Relational Database Service) My SQL Database instance to run the WordPress Database.

  • Go to Amazon RDS in the AWS Console and click on the “Create database” button.
WordPress High Availability: AWS Aurora | Hevo Data
Image Source:
  • As WordPress uses MySQL, so choose the MySQL Database Engine to proceed.
WordPress High Availability: Create Database | Hevo Data
Image Source:
  • Scroll down to select your desired template.
  • Now, provide the required Database details such as the name of your DB instance identifier, Master Username and Password for your DB, your desired DB instance class, etc.
  • After you’re done with the configuration, click on “Create Database”.

Create EC2 Instance

You will now need to create an EC2 (Elastic Compute Cloud) instance to run WordPress on.

  • Create an EC2 instance with the Amazon Linux 2 AMI (HVM) in the Virtual Private Cloud (VPC) in which you created RDS.
  • In the Security Group of RDS, open Port 3306 in inbound rules and add the EC2 instance Security Group Id in order to allow EC2 to connect to your RDS MySQL.

Create EFS

Next, you are going to need the EFS (Elastic File System) to store your media files for WordPress High Availability.

  • Go to the EFS Console and click on “Create file system”.
  • Enter the name of EFS and select the VPC in which you have launched RDS and EC2.
  • After providing the required details, click on “Create”.

The file system is now created.

WordPress High Availability: File System | Hevo Data
Image Source:
  • Select the file system and click on “Edit”.
  • Under the “Lifecycle management” option, select None.
  • Change the “Throughput Mode to “Provisioned” and enter the desired value.
WordPress High Availability: EFS Config | Hevo Data
Image Source:
  • Click on “Save Changes” before proceeding.

Attach EFS to EC2

Now, you need to attach this file system to the EC2 instance allowing it to store the data in the file system for WordPress High Availability.

  • Create a /var/www/html directory using the below command.
sudo mkdir -p /var/www/html/
  • Mount the file system using the below command.
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport <file_system_id>.efs.<region> /var/www/html/

Install the Apache Web Server

To run WordPress, you’ll need to run a Web Server on your EC2 instance. It is recommended to use the Apache Web Server (open-source) for WordPress High Availability.

  • Run the below command in your terminal to install Apache on your EC2 instance.
sudo yum install -y httpd
  • Run the below command to start the Apache Web Server.
sudo systemctl start httpd
  • You can also enable the Apache Web Server to automatically start on boot. To do so, run the below command.
sudo systemctl enable httpd
  • Run the below command to check the status of httpd.
sudo systemctl status httpd
  • Enter <ec2_public_DNS> in your browser to visit the Apache Test Page. Make sure that you have opened Port 80 in the SG of EC2.

Create Application ALB and Register EC2 in Target Group

Now, you will need to create an Elastic Load Balancer (ELB) to direct traffic to your servers for WordPress High Availability.

  • Go to the EC2 Console and click on “Load Balancers” located in the left navigation panel.
  • Click on the “Create Load Balancer” button and select “Application Load Balancer”.
  • Enter the name of the Load Balancer and select the VPC in which you have launched RDS and EC2. Provide the other necessary details required for configuration.
  • Now, create a new Target Group in configure routing. Select “Create New Target Group” and enter the name of TG. Select “Instance” as “Target Type” and “HTTP” as “Protocol”. Enter “80” in the Port field and scroll down to “Advanced health check settings”. Enter “200, 301” in the “Success codes”.
WordPress High Availability: ALB | Hevo Data
Image Source:

Configure WordPress

Now, you’ll need to edit a few areas of configuration for WordPress High Availability. To do so, open the wp-config.php file in your favorite text editor.

The Database configuration needs to be changed.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

Replace the following terms with appropriate values.

  • DB_NAME: Name of the Database you created in RDS MySQL.
  • DB_USER: RDS MySQL Master Username.
  • DB_PASSWORD: RDS MySQL Password.
  • DB_HOST: RDS MySQL Host (click on your Database instance in RDS and you will get the connection endpoint).

The second configuration change is in the Authentication Unique Keys and Salts.

* Authentication Unique Keys and Salts.
* Change these to different unique phrases!
* You can generate these using the {@link secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
* @since 2.6.0
define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );
define('FS_METHOD', 'direct');

You’re now all set to deploy your WordPress site.

Deploy WordPress on AWS Cloud

This step will make your Apache Web Server handle your WordPress requests.

  • You’ll first need to install the application dependencies needed for WordPress. To do so, run the below command in your terminal.
sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2
  • Now, you need to copy your WordPress application files into the /var/www/html directory used by Apache Web Server.
# make sure you are at the the location where the wordpress directory is present
cd /home/ec2-user
#output of ls should be: latest.tar.gz  wordpress
# copy the files
sudo cp -r wordpress/* /var/www/html/
  • Change the user group of /var/www/ to allow Apache (httpd) to access the files.
sudo chown -R apache:apache /var/www/

Now, open the /etc/httd/conf/httpd.conf file to make the following changes.

  • Change the following lines
<Directory />
   AllowOverride none
   Require all denied


<Directory />
   Options FollowSymLinks
   AllowOverride All
  • Scroll down to Line 129 and replace AllowOverride None with AllowOverride All.
  • Scroll down to Line 155 and replace AllowOverride None with AllowOverride All.
  • Finally, restart the Apache Web Server.
sudo systemctl restart httpd

You have now successfully installed WordPress on AWS Cloud.

Make WordPress Highly Available

Now comes the last step, finalizing WordPress High Availability.

  • Go back to the AWS Console and select the EC2 instance that you have configured.
  • Go to ActionsImage and TemplatesCreate Image.
  • Enter the name and description of the image.
  • Enable” the “No Reboot” check box.
WordPress High Availability Hevo Data
Image Source:
  • Once you’re done, click on “Create Image”.
  • Once the image is available, launch the New EC2 instance.
  • After the new instance is launched, verify that the httpd service is running.
  • Run the ls /var/www/html command in the terminal to see if all the files are present under that directory.
  • Once you’re done with the verification, go to the Target Group that you have created in the Application Load Balancer (ALB) step. Register your new EC2 instances in that Target Group.

You have now successfully set up WordPress High Availability on AWS Cloud.

What is WordPress?

WordPress is one of the world’s leaders when it comes to creating, publishing, and managing websites. It’s an open-source platform for Bloggers and Publishers to publish their content online. It is a popular Content Management System (CMS) and more than one-third of all websites are powered by WordPress. Written in PHP and paired with a MySQL or MariaDB Database, WordPress provides users with a wide range of themes, extensions, and plugins that make it highly customizable.

You can leverage WordPress to build and host websites. The template system allows you to customize your website to fit your blog, portfolio, business, or online store. Initially, WordPress was developed to be a blog-publishing system but it has evolved with time to support other web content types like media galleries, online eCommerce stores, learning management systems, and much more. You can leverage its easy-to-use drag-and-drop tools to create a website from scratch. Plus, you also get access to a large selection of commercial and free themes covering almost every field.

What is AWS Cloud?

Amazon Web Services is the world’s most comprehensive and broadly adopted on-demand Cloud Computing Platform that provides scalable and cost-effective services to individuals, companies, and governments. These web services include distributed Computing Power, Database Storage, Content Delivery, Software Tools via AWS Server Farms, etc. On top of that, these services are easily accessible over the public internet.

AWS provides users with fully-managed hardware and infrastructure, saving organizations and individuals the cost and complexity of purchasing, running, and maintaining resources on site. These resources may be accessed for free or on a metered pay-per-use basis. AWS is one of the dominant Cloud providers and is the clear market-share leader at present.

Now that you’re familiar with WordPress and AWS, let’s dive straight into WordPress High Availability.


WordPress is a popular Content Management System (CMS) used for publishing blogs, running eCommerce sites, and many other use cases. WordPress High Availability ensures that your infrastructure continues to operate even when certain components of the system fail. This ensures minimal downtime and an enhanced experience for your audience.

This article introduced you to WordPress and helped you set up WordPress High Availability. However, if you’re looking to move your WordPress data to a Database or a Data Warehouse of your choice for further analysis and visualization, you can check out Hevo’s No-Code Automated Data Pipeline solution.

Share your experience of setting up WordPress High Availability in the comments section below.

Raj Verma
Business Analyst, Hevo Data

Raj, a data analyst with a knack for storytelling, empowers businesses with actionable insights. His experience, from Research Analyst at Hevo to Senior Executive at Disney+ Hotstar, translates complex marketing data into strategies that drive growth. Raj's Master's degree in Design Engineering fuels his problem-solving approach to data analysis.

No-code Data Pipeline For WordPress