Configuring the Database on RDS and connecting it to WordPress in AWS

Jyoti Pawar
4 min readJan 13, 2022

--

What is RDS in AWS?

Amazon Relational Database Service (Amazon RDS) is a web service that makes it easier to set up, operate, and scale a relational database in the AWS Cloud. It provides cost-efficient, resizable capacity for an industry-standard relational database and manages common database administration tasks.

What is WordPress?

WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database. Features include a plugin architecture and a template system, referred to within WordPress as Themes

Task Description📄:

🔅 Create an AWS EC2 instance

🔅 Configure the instance with Apache Webserver.

🔅 Download PHP application name "WordPress".

🔅 WordPress stores data at the backend in the MySQL Database Server. Therefore, you need to setup a MySQL server using AWS RDS service using Free Tier.

🔅 Provide the endpoint/connection string to the WordPress application to make it work
Let’s get started ……………………..!

Step 1: Creating 2 security groups one for the EC2 and one for the RDS

Security Group 1: WPEC2 with ssh and http allowed.

Security Group 2: RDS

As the data is very important we only want the ec2 instance to connect to our database server. Therefore, we add a custom SG which we created up WPEC2 for the RDS server

Step 2: Launch an EC2 instance

1.Here, I am using an Amazon Linux and
2. Select free tier .

3.Configure Instance.

In advance details section :

The above block of code will install PHP, httpd, some extras and also install WordPress in the root directory of the webserver. This block of code will help us to spend less time on EC2.

4.Configure security Groups ADD WPEC2 which we created up there.

Now, we can launch the EC2 instance successfully

httpd service is running successfully.

Step 3: Launch an RDS.

We are using a MySQL Database.

DB instance size:

Credentials:

Storage:

Do not give the public access to the RDS instance, So only the EC2 can connect the DataBase server.

Choose the existing security group which we created for RDS in the First step

In Additional Configuration,

Create a database

BACKUP

Keep the maintenance as it was and launch the RDS database

Successfully launched the database.

Now both things are ready the EC2 with httpd service started and the RDS instance for DataBase.

Step 4: Configure the WordPress website and database server. On the EC2 public IP

Restart the httpd service in the EC2

service httpd restart

Adding the database information and Endpoint.

You can get the endpoint in the connectivity and security menu of RDS.

The below error arises because the apache user has no power to create a file and write in it.

So we have to manually create a file and copy this contend

Note: Do not try to copy the wp-config-sample.php because it does not contain the secret keys

And copy the above contain in this file wp-config.php and Run the installation.

---------------------------------------------------------------------------------------------------------------

Note: If any error comes after running the installation restart the httpd service and give the 755 permission to the wp-config.php file and also make apache the owner of wp-config.php i.e chown -R apache:apache wp-config.php

Successfully installed WordPress and created the user

LOGIN

Thank You !!!⭐⭐🎊

Hope you all would love this blog😌

Keep Learning !! Keep Sharing!!!⭐⭐

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Jyoti Pawar
Jyoti Pawar

Written by Jyoti Pawar

Devops || AWS || ML || Deep learning || Python || Flask || Ansible RH294 || OpenShift DO180

No responses yet

Write a response