Task18:-WordPress Configuration over AWS with Amazon RDS
This article is all about the configuration of WordPress over AWS with the backend of AWS RDS.
Description of Task:-
π
Create an AWS EC2 instance
π
Configure the instance with Apache Webserver.
π
Download php application name βWordPressβ.
π
As WordPress stores data at the backend in 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.
As prerequisite we have to have AWS configured on CLI as we are launching the instances using cli.(we also can use manual things in which we can use graphical interface to launch instances .)
We will start our task by Creating security group for WordPress instance. so here we go.
Creating Security Group
aws ec2 create-security-group β group-name sgfortask18 β description βThis Security Group Is For Task 18 with allowance of port 80,22,3306β
from here we got security group id that we will use in future . sg group id :-βsg-0c5ae0452a48ae31c"
Adding port no 80,22,3306 to this security group
aws ec2 authorize-security-group-ingress β group-name sgfortask18 β protocol tcp β port 80 β cidr 0.0.0.0/0
aws ec2 authorize-security-group-ingress β group-name sgfortask18 β protocol tcp β port 22 β cidr 0.0.0.0/0
aws ec2 authorize-security-group-ingress β group-name sgfortask18 β protocol tcp β port 3306 β cidr 0.0.0.0/0
aws ec2 describe-security-groups
Now we will launch the instance for WordPress. we will use Amazon Linux for this . here Iβm using key arthkey which was created previously.
aws ec2 run-instances β image-id ami-0eeb03e72075b9bcc β count 1 β instance-type t2.micro β key-name arthkey β security-group-ids sg-0c5ae0452a48ae31c
Now we will run these commands to setup this WordPress. For login to our os either we can use putty or browser. Iβm using putty as it is easy to use . we can direct copy commands from here to put on blog.
# yum install httpd -y
# systemctl enable httpd β now
# amazon-linux-extras install php7.3 -y
# wget https://wordpress.org/latest.tar.gz
# tar -zxf latest.tar.gz
# cp -r wordpress/* /var/www/html/
# systemctl restart httpd
#systemctl status httpd
transfer wordpress files to /var/www/html and restart services .
we can use our os public ip to login or setup WordPress application .
Now letβs launch AWS RDS for backend
Follow the steps as shown in images , and create database .
If you want to use CLI for launching this AWS RDS instance here is a sample string (piece of code to be run on CLI):
# aws rds create-db-instance β availability-zone ap-south-1b β db-name database2 β db-instance-identifier testing β vpc-security-group-ids sg-0c5ae0452a48ae31c β engine mysql β engine-version 5.7.31 β master-username admin β master-user-password redhatadmin β publicly-accessible β db-instance-class db.t1.micro β allocated-storage 20
Get the endpoint of database from here and use it in wordpress as database host to deploy , as shown in image.
if wordpress is not able to open than go to your wordpress instance β >/var/www/html. here is one file named wp-config.php update it with your WordPress details and rerun that .
finally , you will ended up with this screen
add details here are you are done
your wordpress website is launched with AWS RDS .
Thatβs all with this article. I hope you found the post Informative, if something was missing or you think some more things could have been added, feel free to provide suggestions in the comments section.
You can check out my LinkedIn profile.