How To Launch A WordPress Site over AWS using AWS RDS.

Abhishek Sahu
6 min readApr 18, 2021

--

Hello Readers, Today I am going to show you that, How you can launch your WordPress websites over AWS and store WordPress data in the RDS database for high availability of data.

Image Source — Google search

Steps:

  • Create a database instance using the Amazon RDS service.
  • Launch an ec2 instance.
  • Configure ec2 instance and install WordPress on it.
  • Connect the WordPress instance with the Database instance using Public IP.

Now, Let’s start creating our website.

How to Launch RDS instance on AWS.

  • Search for RDS on services Dashboard in AWS console.
RDS search.
Database button.
  • Now Click on the Create Database button.
Create DataBase
  • Now select the way, If you don’t want to do much by yourself go with the Easy Create option else go with the Standard Create option. Here I am using the standard create option.
  • Next, select the Database engine you want, Here I am using MySQL.
Templates.
  • Now, they are asking for your Use Case, i.e How you want to use this instance, Here I am using the free tier for this blog, you can go with it according to your requirements. Along with it, it is also asking for a version of the Database Engine, Here I am going with default.
Set Username and Password
  • Next, it is asking for setting up Database name, username, and password for database set the following.
Set instance Class.
  • Select the instance according to your need, as I selected the Free tier before, And the free tier only supports db.t2.micro.
Select Storage.
  • Next, It is asking for selecting storage, Select storage according to your need, I am going with default for this blog.
Setting up Availability
  • Here it provides the option to select availability, As I am using the free tier so it provides limited functionality. You can use this option if you are creating the setup for production or test/dev environment.
  • Now, In the connectivity tab, they are asking how you want to access this database, Here I am allowing Public access, and the setting remains as default.
  • Now in the last, they are asking how you want to authenticate with this database, Here I am selecting password only. You can also access this database through IAM roles by adding roles to it, You can also use Kerberos security for this, But it is only supported in the production or test/dev environment.
  • Lastly, click on the Create database button to create your database instance.
Database Launched

Now you can see that your database instance is launched, It’s time to Launch a WordPress instance and connect it with the database.

How to Launch setup WordPress on AWS.

  • First, go to the AWS dashboard and click on ec2 service.
ec2 Dashboard
  • Now after landing on the ec2 dashboard click on the launch instance button.
Choose AMI
  • Now here they are asking you to choose an OS you want to use, Here I am going with all Amazon Linux 2.
Select CPU
  • Next, select the Compute type as per your requirement, I am using t2.micro which is basic and free tier eligible.
Configure instance.
  • Next, Configure the instance detail
Add storage.
  • Next, add storage according to your need.
Security group.
  • Next, Configure the security group, For now, I am using all traffic but it is not a good idea. Kindly choose wisely which port you want to let listen.
Review instance details.
  • Lastly, review all the details and click on the launch button. After Clicking the Launch button doesn’t forget to attach the existing ssh key or create a new ssh key in the next prompt.
Instance launched.

Now you can see that our instance is launched and I named it wordpress.

Configuring WordPress.

Now Let’s start configuring WordPress on the launched instance.

  • First, connect to the instance via SSH protocol.
Connect dashboaard

Next, after landing at the terminal, First switch the user to root.

switch user.

WordPress has a dependency on Apache webserver and MySQL, So let’s first install that in our system.

Installing httpd and MySQL.

Now go to document root of httpd server, i.e “/var/www/html/” and download the following file there. https://wordpress.org/latest.tar.gz

Downlaoding wordpress

Now untar the downloaded file.

for untar use the “tar -xf latest.tar.gz” command.

Now, Let's start installing PHP, to install PHP on amazon Linux run the following command to get the installation command for PHP.

Command to install PHP enviornment.

Now, let's start the httpd service and make it permanent by enabling it.

Starting httpd services.

Now, Enter the IP address of your ec2-instance followed by WordPress in your browser to open the configuration menu.

Wordpress Config

Next, It is asking for details like database name, username, password and database host.

make sure the database u specified is present in your database instance. To create a database login to your rds instance from CLI using the command.

mysql -h “endpoint” -u “username” -p “password”

Now create the database using the command

create database “database_name”;

Sometimes Wordpress is not able to create the database using WebUI, So go to your instance and create a wp-config.php file in “/var/www/html/wordpress” directory.

After creating the File and Click on “Run the installation” button, After that you will see the installation page asking for some more detail, Enter that too and Click next.

After successful installation login to your instance using username and password you’ve created.

Now you will see a dashboard which will ask you to customize your site, customize according to your need and your site will launched successfully.

--

--

Abhishek Sahu

Hey Readers, I am tech enthusiast and an Computer Science Student. Here I am sharing various industry use cases and its solution.