Assignment3-Create A Website in AWS Without Using Amazon AMI
Assignment3-Create A Website in AWS Without Using Amazon AMI
AMI
Demo Video: https://youtu.be/tFZH964__hs
(Individual Assignment)
By Nurul Huda
ALL SCREENSHOTS MUST BE FULL SCREEN FROM TOP LEFT CORNER TO THE BOTTOM RIGHT
CORNER OF YOUR SCREEN EVEN THOUGH THE SAMPLE SCREENSHOTS IN THIS DOCUMENT ARE
NOT SHOWING FULLSCREEN. DO NOT CROP ANY PART OF THE SCREEN.
(Note: Though the demo video used an educate (student) account, you do not need to use an educate
account. You can use your AWS free tier account. Remember to remove all the AWS resources that you
used for doing any lab/assignment so that it does not cross the free tier usage limit.
1. Login to your account. In Amazon Management console, create an Ubuntu 20.04 Instance by using
your account. Make sure that Auto-Assign Public IP is enabled and at least 20GB disk space is
allocated.
2. For the Security Group, name it as ubuntuwebserverxxxx (where xxxx is the last 4 digits of your
student ID). Make sure you use SSH and can connect from anywhere. Before “Launch”, take a
screenshot showing your security group name.
<<Screenshot>>
3. At the launching the instance, create a new key pair and name it as ubuntuwebserverxxxx (where
xxxx is the last 4 digits of your student ID). Take a screenshot showing that the key pair was saved
and download the key pair file to your local computer.
<<Screenshot>>
Note to Mac user: Mac user's don't need to use PuTTY. The video
https://youtu.be/4SsXX8jq_dw (4 minutes to 8 minutes) shows how to connect to an EC2
instance from Mac Machine. Mac users can watch that 4 minutes part of the video as an
alternative to steps 3 to 6 below.
After connecting to the instance, the commands will be the same for Windows or mac users
as the commands are executed in the EC2 instance (not on Mac or Windows). So, everyone
can follow the same commands as shown in the initial demo video
(https://youtu.be/tFZH964__hs ) from 9 minutes time.
4. Launch the instance. While the instance is being created, use PuTTYgen to convert the .pem key pair
file to .ppk file. Name the .ppk key pair file as ubuntuwebserverxxxx.ppk (where xxxx is the last 4
digits of your student ID).
<<Screenshot>>
6. Use PuTTY to connect to the instance (use related part of the video help if needed). You should be at
the Ubuntu prompt.
<<Screenshot>>
<<Screenshot>>
8. At the prompt, use the following 3 commands to always start up with the server boots.
<<Screenshot>>
9. At the prompt, use the following 4 commands to install MariaDB database and always start up with
the server boots.
<<Screenshot>>
10. At the prompt, use the following command and responses to create a root password and disallow
remote root access.
sudo mysql_secure_installation
Enter current password for root (enter for none): Just press the Enter
Set root password? [Y/N]: Y
<<Screenshot>>
11. At the prompt, use the following command to restart MariaDB server
<<Screenshot>>
12. At the prompt, use the following 4 commands to Install PHP 7.1 and Related Modules
<<Screenshot>>
13. At the prompt, use the following command to keep a copy of php.ini file
<<Screenshot>>
14. At the prompt, use the following command to open php.ini file for editing
15. Find the following lines and set their values as shown
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
16. Exit the nano editor by pressing Ctrl+x and at the prompt press Y to save and press enter again to
save in the file.
17. At the prompt, use the following commands to create a WordPress database, user and password.
Take a screenshot after the 4th command showing the command was successful.
FLUSH PRIVILEGES;
EXIT;
18. At the prompt, use the following commands to download WordPress Latest Release, uncompressed
and set permissions
<<Screenshot>>
19. At the prompt, use the following commands to create a new configuration file called wordpress.conf
copy the following text in the file and replace yourpublicdnsname with your instance’s
publicdnsname.
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/wordpress/
ServerName yourpublicdnsname
ServerAlias www.yourpublicdnsname
<Directory /var/www/html/wordpress/>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<<Screenshot>>
20. Exit the nano editor by pressing Ctrl+x and at the prompt press Y to save and press enter again to
save in the file.
21. At the prompt, use the following commands to enable the WordPress and Rewrite Module and
Restart Apache2
<<Screenshot>>
22. At the prompt, use the following commands to run the commands below to create WordPress wp-
config.php file.
23. At the prompt, use the following commands to open WordPress configuration file.
// ** MySQL settings - You can get this info from your web host ** //
define('DB_NAME', 'wpdb');
define('DB_USER', 'wpdbuser');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
24. Exit the nano editor by pressing Ctrl+x and at the prompt press Y to save and press enter again to
save in the file.
25. In AWS, edit inbound rules of your security group (EC2>Security Groups>your security group).
26. Allow HTTP and HTTPS connection from anywhere and save it.
Take a screenshot showing that HTTP and HTTPS were allowed for inbound connection from
anywhere.
<<Screenshot>>
<<Screenshot>>
28. In the next screen, setup site title, username, password and email address. You will use this
username/password to make any changes in the webpages.
<<Screenshot>>
30. Login to WordPress by using the account that you setup in WordPress installation wizard 30 and
modify the HelloWorld post and include your full name at the heading of the page. Browse your
website and it should show the webpage with your full name. Take a screenshot showing the
webpage.
<<Screenshot>>
31. Create a new post that includes your full name, student ID and any other bio information of your
choice. Browse your website and it should show the new post. Take a screenshot showing the new
post.
<<Screenshot>>
32. Shut down (stop) the EC2 instance. Take a screenshot showing the EC2 has been stopped.
<<Screenshot>>
Reminder: Please make sure you removed all the AWS resources that you used for completing any
lab/assignment so that it does not cross the free tier usage limit. Check the EC2 Dashboard
(Resources) and Billing menu (under your account) to find out resources in use.