Over 30% of all websites on the internet use WordPress as their content management system (CMS). It is most often used to run blogs, but it can also be used to run e-commerce sites, message boards, and many other popular things. This guide will show you how to set up a WordPress blog site.
Task-01
- As WordPress requires a MySQL database to store its data ,create an RDS as you did in Day 44
To configure this WordPress site, you will create the following resources in AWS:
An Amazon EC2 instance to install and host the WordPress application.
An Amazon RDS for MySQL database to store your WordPress data.
Setup the server and post your new Wordpress app.
Here's the guide to official documentation from AWS to deploy this project.
Before getting ahead, let us know why we need to use RDS:
Database maintenance for your WordPress site is critical. Your database instance holds all of your important data for your WordPress site. If the database goes down, your website may go down with it, and you could even lose your data.
Database maintenance can also be difficult, and database administrators have years of specialized experience. When setting up a WordPress site, you want to stay focused on designing your page and generating your content, not worrying about database performance and backups.
Amazon RDS for MySQL helps with both of these problems. Amazon RDS for MySQL is a managed database offering from AWS. With Amazon RDS for MySQL, you get:
Automated backup and recovery so that you won’t lose data in the event of an accident
Regular updates and patches, keeping your database secure and performant
Easy installation with smart default parameters.
Let's start the project now.
We can divide this project into five sections, for us to make it easy to understand:
Create a MySQL Database with Amazon RDS.
Create an EC2 Instance.
Configure the Amazon RDS Database.
Configure WordPress on EC2.
Explore the newly set Website and clean up.
Create a MySQL Database with Amazon RDS
Services Used: Amazon RDS
Go to AWS Management Console > Search and Select RDS > Click on Create Database.
Choose a database creation method: Standard create
Engine options: MySQL

Select latest version of MySQL
Templates: Free tier

Settings:
DB instance identifier: wpadmin
Credentials management: Self Managed
Master username: admin
Give the password.

Let the Instance Configuration & Storage be the default for this project.


Now in the Connectivity section:
Compute resource: Don’t connect to an EC2 compute resource
Virtual private cloud (VPC): Select the default VPC
DB subnet group: Default
public access: yes
And let the other Options be the default.
Scroll down to Additional Configuration after the Monitoring section:
Initial Database name: wordpress
And retain the default settings.

Click on Create Database:
The creation of this RDS might take place few mins. After few minutes, you can observe that the RDS is created.

Now let's go to the second section.
To configure this WordPress site, you will create the following resources in AWS:
An Amazon EC2 instance to install and host the WordPress application.
Run the following command in your terminal to install a MySQL client to interact with the database.
sudo apt install mysql-client -y

Run the following command in your terminal to connect to your MySQL database. Replace “<user>” and “<password>” with the master username and password you configured when creating your Amazon RDS database. -h is the host which is the RDS database endpoint.
mysql -h <RDS hostname> -u <master username> -p
Finally, create a database user for your WordPress application and give the user permission to access the WordPress database.

Run the following commands in your terminal:
CREATE DATABASE wordpress;
CREATE USER 'wordpress' IDENTIFIED BY 'wordpress-pass';
GRANT ALL PRIVILEGES ON wordpress.* TO wordpress;
FLUSH PRIVILEGES;
Exit

To run WordPress, you need to run a web server on your EC2 instance. To install Apache on your EC2 instance, run the following command in your terminal:
sudo apt install apache2

You can see that your Apache web server is working by browsing the public IP of your ec2 instance.

First, download and uncompress the software by running the following commands in your terminal:
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz

You will see a tar file and a directory called WordPress with uncompressed contents using the ls command.
cp wp-config-sample.php wp-config.php

Open the wp-config-sample.php file
DB_NAME: your RDS database name
DB_USER: The name of the user you created in the database in the previous steps
DB_PASSWORD: The password for the user you created in the previous steps
DB_HOST: The hostname of the database means your database endpoint

First, install the application dependencies you need for WordPress.
In your terminal, run the following command.
sudo apt install php libapache2-mod-php php-mysql -y

Copy your WordPress application files into the /var/www/html directory used by Apache.
sudo cp -r wordpress/* /var/www/html/

To restart the Apache web server
sudo systemctl restart apache2
To access the WordPress admin dashboard, open a web browser and enter the following URL: http://ec2-public-ip/wp-admin/, whereec2-public-ip should be replaced with the public IP address or domain name of your Amazon EC2 instance.

An Amazon RDS for MySQL database to store your WordPress data.
Set up the server and post your new WordPress app.

Thankyou !!!!!!!!!!!!!!!!!!!