AWS CSA TASK 3

AWS CSA TASK 3

✍ 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 set up a MySQL server using AWS RDS service using Free Tier.

✍ Provide the endpoint/connection string to the WordPress application to make it work.

Step1: Create an AWS EC2 instance

a. I have chosen Amazon Linux 2 AMI

No alt text provided for this image

b. I have selected my instance type as t2.micro

No alt text provided for this image

c. default VPC is selected with the normal root volume and I am allowing all traffic to the security group to make it simple. Finally, the instance is launched

No alt text provided for this image

Step2 Configure the instance with Apache Webserver and Download PHP application name "WordPress"

Install all the necessary packages and software like httpd, PHP, MySQL for WordPress with the help of the below commands

  1. yum install httpd mysql -y
  2. amazon-linux-extras enable php7.4
  3. yum clean metadata
  4. yum install php php-common php-pear
  5. yum install php-{cgi,curl,mbstring,gd,mysqlnd,gettext,json,xml,fpm,intl,zip} -y
  6. php -v
No alt text provided for this image

Now we will download the WordPress complete file into the folder /var/www/html and unzip the file.

Run all the below command one by one

  1. wget http://wordpress.org/latest.tar.gz
  2. tar -xzf latest.tar.gz
  3. cd wordpress
  4. mv * ../
  5. cd ../
  6. rm -f latest.tar.gz
  7. rmdir wordpress/
  8. setenforce 0

Screenshot of above-executed commands

No alt text provided for this image

Now start and enable httpd Webservice with help of the below commands.

command1 : [root@ip-172-31-18-208 html]# systemctl start httpd

command2 :[root@ip-172-31-18-208 html]# systemctl enable httpd

Let's head over to the public-IP of instance to check WordPress is running successfully or not(running successfully)

No alt text provided for this image

Step 3: WordPress stores data at the backend in the MySQL Database Server. Therefore, you need to set up a MySQL server using AWS RDS service using Free Tier.

a. Let's create a MySQL database in AWS RDS

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

b. Setup password and user name for logging into the database

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Now, The database has been created successfully

Let's log in to this database to check if it was created successfully. In the below command don't forget to provide your database endpoint

command:  mysql -h endpoint -u user-name -p

No alt text provided for this image

Now let's configure WordPress with this database to launch our WordPress site with the help of our EC2 instance IP.

No alt text provided for this image
No alt text provided for this image

After submitting it copy the shown PHP code and goto ec2-instance and then goto /var/www/html folder and create config file with the name wp-config.php and save the copied content to this file. Then restart your web server(httpd)

command: systemctl restart httpd

Fill in the detail according to your configuration and click on install wordpress.

No alt text provided for this image

Now go and login with your username to view the dashboard

No alt text provided for this image
No alt text provided for this image

Visit the website

No alt text provided for this image






To view or add a comment, sign in

More articles by Dikshant Mali

Others also viewed

Explore content categories