WordPress is the most popular Content Management System (CMS) and powers more than 30% of the web. Many high traffic websites such as TechCrunch and BBC America use this CMS.
Although there are many other CMS options, the low cost, flexibility and customization functionality results in the popularity of WordPress. There is a flaw, however, in the default WordPress configuration, where a single server has both WordPress and the database, does not scale up to handle large amounts of traffic. Web pages load slower ruining your visitor experience. To overcome this situation, a multi-tier solution is required.
The solution is to move to multiple database servers; this can be easily accomplished using Amazon Web Services (AWS). AWS offers a Relational Database Service (RDS) that uses SQL for maintaining and querying the data. Some webmasters who run the standard single server configuration may need help during the deployment process. Here is a brief guide on how to load balance your WordPress site.
The Method
First, you need to open the RDS console and create a new database from your dashboard. You will be prompted to specify the DB details. Although, there are default settings for this, pay attention to the DB instance class and Multi-AZ deployment.
For security, create a DB username and password to securely access your DB and relay information. Under the Database option, type DB name and note down your DB port value to be used later. Have a sneak around the other default settings and click “Create Database”.
The next step is to modify the ingress rules on RDS instance’s security group. To do this, go to the Amazon RDS console and choose a database to view its details. Under security settings, note the Security Groups and Endpoints. This can come in handy later on.
Under the security section, you will also see the security group associated with your DB instance. Click on the link to view the security group in the EC2 Console.
Once open, choose “Inbound” in security group details. Click “Edit” and then add your Rule and Type and select mysql that your application uses. Lastly, modify the source table or type “sg-”to view a list of available security groups. Click ‘save’ and let the configuration take place.
Meanwhile, download WordPress from here along with the configuration files since you will need it later to deploy it on your server. Extract WordPress in your directory and the configuration files over the WordPress installation.
As you do this, you are already halfway to deploy your first WordPress website using Amazon RDS. But don’t get excited too quickly since we still need to work around with the Elastic Beanstalk Environment (EBE).
Use the AWS Management Console to create an EBE. You also need to choose the PHP platform and accept the default settings and sample code. Click on Configure more settings, select high availability, scroll down and click on modify Auto Scaling group. In there, select number of max servers as additional servers will be billed as per standard charges. Click save and on the next screen click create. Once you create the ‘’Environment’’ you can configure and connect it to the database created earlier.
Upon successful configuration, deploy the WordPress code to the environment you downloaded from the repository. You can also click here to launch the Elastic Beanstalk console. Upon loading, you need to choose the language of the platform such as English, Spanish or Arabic, etc.
For Application Code, choose the sample application and then click on ‘‘Review and Launch’’. You will be prompted to review the options, and once you are satisfied, hit “Create App”. The creation of the environment takes a few minutes and creates the following six resources.
EC2 Instance
Instance Security Group
Load Balancer
Load Balancer Security Group
Auto Scaling Group
AWS Cloud Formation Stack and a Domain Name
Elastic Beanstalk will manage all of the above resources. So make sure to not terminate your environment as it will terminate all your resources. The Amazon RDS DB is launched outside of the environment so you will also need to carefully manage its life cycle.
Make sure to configure and verify the structure of your WordPress Beanstalk Folder. You need to configure environment property section by providing a database endpoint username and password mention above.
Finally, you can install WordPress and have your website up and running. To complete the installation, open the Elastic Beanstalk Console here and navigate to the management page for your environment. Choose the environment URL to open your site in a browser and you will automatically be redirected to the WordPress installation Wizard.
Perform the standard installation. Since the database is already connected to the environment, you won’t be prompted to configure the DB. Installation takes a few minutes to complete, after which you can successfully run your load balanced WordPress using AWS.
Best of luck! And if you need help load balancing your site, we are available to assist with the transition.
For Reference and Additional Information:
Vimware is a Los Angeles based IT strategy and services firm that strives to be your most trusted technology resource. We work with you to understand your business demands and goals, then align them with the right technology strategy and solutions. We help you improve your digital footprint by carefully managing every detail throughout the Product Life Cycle.