Introduction To Amazon EC2
Introduction To Amazon EC2
Overview
Topics covered
By the end of this lab, you will be able to:
Duration
This lab takes approximately 45 minutes to complete.
Tip: If a new browser tab does not open, a banner or icon at the top
of your browser will indicate that your browser is preventing the site
from opening pop-up windows. Choose the banner or icon, and
choose Allow pop-ups.
8. In the Name and tags pane, in the Name text box, enter Web
Server .
A template for the root volume for the instance (for example, an
operating system or an application server with applications)
Launch permissions that control which AWS accounts can use the
AMI to launch instances
A block device mapping that specifies the volumes to attach to the
instance when it is launched
The Quick Start list contains the most commonly used AMIs. You
can also create your own AMI or select an AMI from the AWS
Marketplace, an online store where you can sell or buy software that
runs on AWS.
NOTE: You may be restricted from using other instance types in this
lab.
12. In the Key pair (login) pane, select Proceed without a key
pair (Not recommended).
A security group acts as a virtual firewall that controls the traffic for
one or more instances. When you launch an instance, you associate
one or more security groups with the instance. You add rules to
each security group that allow traffic to or from its associated
instances. You can modify the rules for a security group at any time;
the new rules are automatically applied to all instances that are
associated with the security group.
16. Under Inbound security groups rules select the Remove
In this lab, you will not log into your instance using SSH. Removing
SSH access will improve the security of the instance.
When you launch an instance in Amazon EC2, you have the option
of passing user data to the instance. These commands can be used
to perform common automated configuration tasks and even run
scripts after the instance starts.
20. Copy the following commands, and paste them into the User
data text box.
#!/bin/bash
yum -y install httpd
systemctl enable httpd
systemctl start httpd
echo '<html><h1>Hello From Your Web Server!</h1></html>' >
/var/www/html/index.html
The instance receives a public DNS name that you can use to
contact the instance from the Internet.
23. Select the box next to your Web Server. The Details tab
displays detailed information about your instance.
25. Select the instance by checking the box next to the instance
and navigate to the bottom of the screen to the Status checks tab.
This shows you what your Amazon EC2 instance console would look
like if a screen were attached to it.
If you are unable to reach your instance via SSH or RDP, you can
capture a screenshot of your instance and view it as an image. This
provides visibility as to the status of the instance, and allows for
quicker troubleshooting.
29. Select the instance by checking the box and select the
Details tab.
30. Copy the Public IPv4 address of your instance to your
clipboard.
31. Open a new tab in your web browser, paste the IP address you
just copied, then press Enter.
Question: Are you able to access your web server? Why not?
You are not currently able to access your web server because the
security group is not permitting inbound traffic on port 80, which is
used for HTTP web requests. This is a demonstration of using a
security group as a firewall to restrict the network traffic that is
allowed in and out of an instance.
To correct this, you will now update the security group to permit
web traffic on port 80.
32. Keep the browser tab open, but return to the EC2
Management Console tab.
33. In the left navigation pane, select Security Groups located
under Network & Security.
34. Select Web Server security group.
35. Select the Inbound rules tab.
36. Select Edit inbound rules then select Add rule and
configure the rule with the following settings:
o Type: HTTP
o Source: Anywhere-IPv4
o Select Save rules
37. Return to the web server tab that you previously opened and
refresh the page.
You should see the message Hello From Your Web Server!
Your instance will perform a normal shutdown and then will stop
running.
The disk volume currently has a size of 8 GiB. You will now increase
the size of this disk.
45. Change the size to: 10 NOTE: You may be restricted from
creating large Amazon EBS volumes in this lab.
46. Select Modify
47. Select Modify to confirm and increase the size of the volume.
Note: You will notice that the instance did not terminate and a red
error message pops up at the top that says: Failed to terminate an
instance: The instance may not be terminated. This is because it has
termination protection enabled.
Lab Complete
56. Choose End Lab at the top of this page, and then select Yes
to confirm that you want to end the lab.
A panel indicates that DELETE has been initiated... You may close
this message box now.