Creating and Working with an EC2 Instance

45 minutes
  • 3 Learning Objectives

About this Hands-on Lab

**Thank you for your interest in this content. Unfortunately, this content is no longer being updated and some of it may be out-of-date.**

Elastic Compute Cloud (EC2) is AWS’s Infrastructure as a Service product. It provides a huge range of virtual machines suitable for general purpose and specialized on-demand compute tasks. In this hands-on lab, you will gain experience creating and interacting with an EC2 instance. The lab covers EC2 requirements, the choices available with creating EC2 instances, and the provisioning process itself. By the end of the lab, you will have gained the experience needed to be confident using EC2 in smaller deployments, such as blogs or lower-volume websites.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a Default VPC
  1. Navigate to VPC.
  2. Click Your VPCs.
  3. Click Actions and then Create Default VPC.
  4. Click Create.
  5. Click Close.
Create an EC2 Instance
  1. Navigate to EC2.
  2. Click Launch Instance.
  3. Click Select next to Amazon Linux 2 AMI (HVM), SSD Volume Type, ensuring 64-bit (x86) is selected.
  4. Choose T3.Micro (NOT T3a.Micro; "a" is AMD).
  5. Click Configure Instance Details.
  6. Ensure Auto-assign Public IP is Enabled.
  7. Expand Advanced Details and paste in the User Data from the lab instructions.
  8. Click Add Storage.
  9. Verify 8GiB, General Purpose SSD (or more).
  10. Click Add Tags.
  11. Click Add Tag, and set Key to Name and Value to Cat-Hall-o-Fame. 1. Click Configure Security Group.
  12. Click Add Rule, and set Type to HTTP and Source to MY IP.
  13. Click Review and Launch, and then Launch.
  14. Select Create a new key pair, and call it "ec2lab".
  15. Click Download Key Pair, Launch Instances, and then View Instances.
Manage the EC2 Instance

Once the instance is running with 2/2 status checks:

  1. Copy the instance’s public DNS (IPv4), and paste it into a new browser tab.
  2. On the EC2 instances console, right-click the instance, and select Connect.
  3. In the terminal, change to your downloads directory (e.g., cd Downloads).
  4. Run chmod 400 ec2lab.pem to adjust the permissions on the file.
  5. Connect to the instance using the ssh command provided in the dialog when you click Connect (or using the PuTTY instructions).
  6. Note the IPv4 Public IP of the instance.
  7. Right-click the instance, and click Instance State > Reboot.
    • Does the IP change?
  8. Right-click the instance, and click Instance State > Stop.
  9. After it’s stopped, click Instance State > Start.
    • Does the IP change?
  10. Right-click the instance, and click Instance State > Stop.
  11. Once it’s stopped, right-click the instance, hover over Instance Settings, and select Change Instance Type.
  12. Change the instance type to t3.small, and click Apply.
  13. Right-click the instance, and click Instance State > Start.

Additional Resources

Log in to the live AWS environment using the credentials provided, and make sure you are in us-east-1 throughout the lab.

When entering the instance user data, use the following:

#!/bin/bash
yum update -y
yum install -y httpd
yum install -y wget
chkconfig httpd on
cd /var/www/html
wget https://raw.githubusercontent.com/linuxacademy/content-aws-csa2019/master/lab_files/03_compute/creating_an_ec2_instance/index.html
wget https://raw.githubusercontent.com/linuxacademy/content-aws-csa2019/master/lab_files/03_compute/creating_an_ec2_instance/catanimated.gif
wget https://raw.githubusercontent.com/linuxacademy/content-aws-csa2019/master/lab_files/03_compute/creating_an_ec2_instance/rainbow.gif
wget https://raw.githubusercontent.com/linuxacademy/content-aws-csa2019/master/lab_files/03_compute/creating_an_ec2_instance/penny.jpeg
wget https://raw.githubusercontent.com/linuxacademy/content-aws-csa2019/master/lab_files/03_compute/creating_an_ec2_instance/roffle.jpeg
wget https://raw.githubusercontent.com/linuxacademy/content-aws-csa2019/master/lab_files/03_compute/creating_an_ec2_instance/truffs.jpeg
wget https://raw.githubusercontent.com/linuxacademy/content-aws-csa2019/master/lab_files/03_compute/creating_an_ec2_instance/winkie.jpeg
service httpd start

Here are the instructions on how to connect to EC2 using PuTTY on Windows.

Here are the instructions on how to connect to EC2 using Instant Terminal.

Here are the instructions on how to install the Windows Subsystem for Linuux on Windows 10.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?