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
b. I have selected my instance type as t2.micro
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
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
- yum install httpd mysql -y
- amazon-linux-extras enable php7.4
- yum clean metadata
- yum install php php-common php-pear
- yum install php-{cgi,curl,mbstring,gd,mysqlnd,gettext,json,xml,fpm,intl,zip} -y
- php -v
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
- wget http://wordpress.org/latest.tar.gz
- tar -xzf latest.tar.gz
- cd wordpress
- mv * ../
- cd ../
- rm -f latest.tar.gz
- rmdir wordpress/
- setenforce 0
Screenshot of above-executed commands
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)
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
b. Setup password and user name for logging into the database
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
Now let's configure WordPress with this database to launch our WordPress site with the help of our EC2 instance IP.
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.
Now go and login with your username to view the dashboard
Visit the website