Note
If you are having issues making an SSH connection using the instructions in step 8, you can try connecting to your instance in a web browser. On the Connect to Instance page, choose the EC2 Instance Connect tab. Then click the Connect button in the lower-right corner, and you should connect to your Linux instance in the web browser, as shown in Figure 6-7.
Figure 6-7 The EC2 Instance Connect Option
Step 9. After logging in to your instance as the user account ec2-user, ensure that all of your software packages are up to date by performing a quick software update on your instance. This process may take a few minutes, but it is important to make sure that you have the latest security updates and bug fixes. Use the following command:
[ec2-user ~]$ sudo yum update -y
Step 10. Use the following command to install the latest versions of the Apache web server and PHP packages for Amazon Linux:
[ec2-user ~]$ sudo dnf install -y httpd wget php-fpm php-mysqli php-json php php-devel
Step 11. Start the Apache web server:
[ec2-user ~]$ sudo systemctl start httpd
Step 12. Use the systemctl command to configure the Apache web server to start at each system boot:
[ec2-user ~]$ sudo systemctl enable httpd
Step 13. Test your web server by obtaining the public IP address of your EC2 instance. You can get the public DNS address for your instance by using the Amazon EC2 console. Revisit the EC2 Dashboard and check the properties of your instance. There is a Public IPv4 Address column that contains your public IP address. Copy this address to the clipboard. In a web browser address bar, type http://<your-ip>. Notice that you cannot use https:// to connect since you have not set up your Apache web server for secure access. By using http, you will access the default page on your Apache Web server via the public Internet, as shown in Figure 6-8.
Figure 6-8 Your Web Server on the Public Internet
Step 14. It’s now time to shut down your handy web server, so issue the following command:
[ec2-user ~]$ sudo shutdown -h now
Note
You can also shut down instances by using the AWS Management Console with the EC2 Dashboard. I always prefer to shut down systems from their own interface when I am working within them. Why is it important to shut down your instance when you are done using it? Because doing so ensures that you are no longer being charged for the instance. Remember that even if you are in the Free Tier of AWS access, you are permitted only 750 hours per month of free EC2 usage.
Exam Preparation Tasks
As mentioned in the section “How to Use This Book” in the Introduction, you have a few choices for exam preparation: the exercises here, Chapter 22, “Final Preparation,” and the exam simulation questions in the Pearson Test Prep Software Online.
Review All Key Topics
Review the most important topics in this chapter, noted with the Key Topics icon in the outer margin of the page. Table 6-2 lists these key topics and the page number on which each is found.
Table 6-2 Key Topics for Chapter 6
Key Topic Element | Description | Page Number |
List | Free Tier components | 77 |
Lab | Creating a Free Tier account | 82 |
Lab | Creating a web server with a Free Tier account | 86 |
Define Key Term
Define the following key term from this chapter and check your answers in the Glossary:
Q&A
The answers to these questions appear in Appendix A. For more practice with exam format questions, use the Pearson Test Prep Software Online.
1. Provide at least three examples of Free Tier services that can remain forever free.
2. Why should you shut down your EC2 instances in AWS when practicing with the Free Tier account?