01 - EC2 Linux Lab
01 - EC2 Linux Lab
01 - EC2 Linux Lab
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 Overview
Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the
cloud. Amazon EC2’s simple web service interface allows you to obtain and configure capacity with minimal
friction. Amazon EC2 reduces the time required to obtain and boot new server instances to minutes, allowing you
to quickly scale capacity, both up and down, as your computing requirements change. Amazon EC2 changes the
economics of computing by allowing you to pay only for capacity that you actually use.
This lab will walk you through launching, configuring, and customizing an EC2 web server using the AWS
Management Console.
2. In the upper-right corner of the AWS Management Console, confirm you are in the desired AWS region (e.g.,
Sydney).
3. Click on Key Pairs in the NETWORK & SECURITY section near the bottom of the leftmost menu. This will
display a page to manage your SSH key pairs.
4. To create a new SSH key pair, click the Create Key Pair button at the top of the browser window.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
5. In the resulting pop up window, type [First Name]-[Last Name]-ImmersionDay into the Key Pair Name: text
box and click Create.
6. The page will download the file “[Your-Name]-ImmersionDay.pem” to the local drive. Follow the browser
instructions to save the file to the default download location.
7. Remember the full path to the file .pem file you just downloaded.
You will use the Key Pair you just created to manage
your EC2 instances for the rest of the lab.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
In this example we will launch an Amazon Linux 2 instance, bootstrap Apache/PHP, and install a basic web page
that will display information about our instance.
Sign into your AWS Management Console and choose EC2 from the Services menu.
2. In the Quick Start section, select the first Amazon Linux 2 AMI and click Select.
3. In the Choose Instance Type tab, select the t2.micro instance size and click Next.
4. On the Configure Instance Details page, expand the Advanced Details section, copy/paste the script below
into the User Data field (this shell script will install Apache & PHP, start the web service, and deploy a simple
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
web page). Click Next.
#include
https://s3.amazonaws.com/immersionday-labs/bootstrap.sh
5. On this page you have the ability to modify or add storage and disk drives to the instance. For this lab, we will
simply accept the storage defaults and click Next.
6. Here, we choose a “friendly name” for your instance by choosing ‘click to add a Name tag’. This name, more
correctly known as a tag, will appear in the console once the instance launches. It makes it easy to keep track
of running machines in a complex environment. Name yours as: “[Your Name] Web Server”, and then click
Next.
7. You will be prompted to create a new security group, which will be your firewall rules. On the assumption that
we are building out a Web server, name your new security group “[Your Name] Web Tier”, and confirm an
existing SSH rule exists which allows TCP port 22 from Anywhere. Click Add Rule.:
8. Select HTTP from the ‘Type’ dropdown menu, and confirm TCP port 80 is allowed from Anywhere (you’ll
notice, that “Anywhere is the same as ‘0.0.0.0/0’). Click Add Rule.
9. Click the Review and Launch button after configuring the security group.
10. Review your cofiguration and choices, and then click Launch.
11. Select the key pair that you created in the beginning of this lab from the drop-down and check the "I
acknowledge" checkbox. Then click the Launch Instances button.
12. Click the View Instances button in the lower righthand portion of the screen to view the list of EC2 instances.
Once your instance has launched, you will see your Web Server as well as the Availability Zone the instance is
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
in, and the publicly routable DNS name.
13. Click the checkbox next to your web server to view details about this EC2 instance.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Finished initializing
Open a new browser tab and browse the Web Server by entering the EC2 instance’s Public DNS name into the
browser. The EC2 instance’s Public DNS name can be found in the console by reviewing the “Public DNS” name
line highlighted above.
Great Job! You have deployed a server and launched a web site in a matter of minutes!!
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.