AWS, EC2, RDS, Configuring the DataBase on RDS, WordPress.
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
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.
Step 1: Creating 2 security groups one for the 1 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
2. Free tire: t2micro
3. Configure Instance
In Advance details,
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 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.
Note: Do not try to copy the wp-config-sample.php because it does not contain the secret keys
And copy the above contained 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
we have done it successfully!!
Thank you🙌