Deploying WordPress Application in EC2 instance with AWS RDS Integration

Priyanshu Bhatt
5 min readJul 29, 2023

--

WordPress is a free and open-source web content management system (CMS) used to create websites by individuals, groups, and organizations. A vast majority of WordPress installations use Amazon EC2 as the underlying infrastructure for their web application. Since Amazon’s RDS service is well suited for hosting WordPress installations in a highly available fashion. In this era of dynamic web applications and content management systems, the need for robust, scalable, and high-performing solutions is more critical than ever. And that’s precisely where our exploration begins!

Creating EC2 Instance

STEP 1: Log in to your AWS Management Console.

STEP 2: Navigate to the EC2 Dashboard and click on “Launch Instance

STEP 3: Give the instance name “WordPress”.

STEP 4: Select Amazon Machine Image (AMI) that fits your needs. Choose an image with the latest version of your preferred Linux distribution. I will be using the Amazon Linux 2.

STEP 5: Choose an instance type based on your requirements. For a small-scale WordPress website, a t2.micro instance should suffice.

STEP 6: Configure instance details, such as the number of instances, network settings, and storage. Make sure to add a security group that allows HTTP (port 80) and HTTPS (port 443) inbound traffic.

STEP 7: Review the configurations and click on the “Launch instance

Setting up Softwares

Before starting with the integration you have to install some software which is essential.

STEP 1: Installing php, httpd, MySQL

yum install php httpd mysql -y

STEP 2: Starting the httpd service

systemctl start httpd

STEP 3: Installing some extra packages of PHP.

amazon-linux-extras install php7.2 -y

STEP 4: Installing WordPress and Extracting it.

STEP 5: Moving all the WordPress files in the/var/www/html folder to be accessed by httpd.

mv wordpress/* /var/www/html

STEP 6: Giving valid permissions to the files in html directory and restarting the services

chmod -R 755 *
chmod -R apache:apache *
systemctl restart httpd

You have successfully installed and configured everything on the ec2 instance, now its time to set up the database.

SETTING UP RDS DATABASE

Amazon RDS (Relational Database Service) is a managed database service provided by Amazon Web Services (AWS). It simplifies the process of setting up, operating, and scaling relational databases in the cloud. RDS supports several popular database engines, making it easy for users to deploy and manage databases without the need for extensive database administration expertise.

STEP 1: Go to the RDS page in the AWS Management Console.

STEP 2: Click on the Create Database.

STEP 3: Select Standard Create and Mysql as the engine type.

STEP 4: Give the database name, username and password.

NOTE: Do remember the password

STEP 5: Give the database name and select the parameter group. Rest keep everything as Default.

Wait for some time and your Database will be ready to use.

Connecting RDS Database with WordPress

For connecting the RDS Database we have to get the endpoint/URL of the database and feed it into the Database endpoint section during the WordPress configuration.

To do the Worpress setup, go to the browser and type the Public Ip of the instance.

IP

The below page asks for the Database name that you added during the RDS Database creation, also add the Admin username and Password. In the Database Host Section add the RDS Database endpoint. Click Submit

Hurray!! You have successfully integrated RDS Database with WordPress Application. In the Next Screen provide the username and password for the user and click run installation.

You have successfully integrated RDS with Database you can see the below page.

CONCLUSION

In conclusion, Amazon RDS stands as a powerful testament to the boundless potential of cloud-based database management. By seamlessly integrating this managed database service with WordPress on EC2, we’ve uncovered a world of possibilities that empower businesses and developers alike.

Thanks For Reading !!

--

--

Priyanshu Bhatt

AWS Solutions Architect || Terraform Certified Associate || DevOps Engineer || I Share Crisp Tech Stories