Changes

Jump to: navigation, search

OPS705 Lab 5 (2217)

4,680 bytes added, 13:13, 2 November 2021
no edit summary
You've been allocated $100 in AWS credits for the course, and that should be more than enough for the remaining labs. Please be responsible with your usage!
 
= INVESTIGATION 2: Managing a Linux VM in AWS EC2 =
In this investigation, we'll create, configure, and manage a Red Hat Enterprise Linux Virtual Machine using Amazon Web Services. This version of the OS is command line only, so you'll be using SSH to remotely connect to the VM and issue basic commands. This VM will be used extensively in Lab 3.
 
== Part 1: Creating A Linux VM From An Image ==
To create your Linux VM, follow the steps from ''Investigation 1, Part 1'', but with the following settings:
 
# '''Amazon Machine Image (AMI):''' Red Hat Enterprise Linux 8 (HVM), SSD Volume Type
# '''Instance Type:''' t2.micro
# '''Configure Instance Details:''' Leave all options as they are.
# '''Add Storage:''' Leave all options as they are.
# '''Add Tags:''' Leave all options as they are.
# '''Configure Security Group:''' Leave all options as they are.
# Finish the Instance creation. Use the same key pair from Investigation 1! (Option: Choose an existing key pair)
 
== Part 2: Accessing Your Linux VM Remotely Using SSH ==
[[Image:Ops705_lab2_fig19.png|thumb|right|500px|Figure 5. The ''Connect to instance > SSH client'' page.]]
We will be accessing our new Linux VM remotely using SSH, which is a command-line (CLI) only protocol. We'll be diving into CLI in more detail during our next lab.
 
Requirements: An SSH Client
# Windows: Use the built-in '''Command Prompt''' application.
# macOS/Linux: Use the built-in '''Terminal''' application.
 
For all clients:
# In the Linux EC2 Instance summary page, click the ''Connect'' button.
# In the new ''Connect to instance'' page, click on the '''SSH client''' tab.
# Copy the example command near the bottom of the page. (Use your example command, not the one from the screenshot in this lab!)
# Choose the proper OS below and continue.
 
On Windows, Using Command Prompt:
# Open '''Command Prompt'''.
# Change directories to your default Downloads folder with the following command: <code>cd Downloads</code> (If you saved your .pem file elsewhere, navigate there. Or move the .pem file into Downloads.)
# Paste the example command from the ''Connect to instance'' page, and press Enter.
# The SSH command will ask you to confirm connecting. Type ''yes'' and press Enter.
# If login is successful, you should see a prompt like this: <code>[ec2-user@ip-172-31-95-114 ~]$ </code>
# To prove you've completed this section, run the following: <code>echo "My name is ''insertFullName'', and I've completed the Linux VM investigation." > ~/lab2.txt</code>
# To quit, type <code>exit</code>.
 
On macOS/Linux, Using Terminal:
# Open '''Terminal'''.
# Change directories to your default Downloads folder with the following command: <code>cd Downloads</code> (If you saved your .pem file elsewhere, navigate there. Or move the .pem file into Downloads.)
# Change the file permissions of your .pem file with this command: <code>chmod 400 *.pem</code>
# Paste the example command from the ''Connect to instance'' page, and press Enter.
# The SSH command will ask you to confirm connecting. Type ''yes'' and press Enter.
# If login is successful, you should see a prompt like this: <code>[ec2-user@ip-172-31-95-114 ~]$ </code>
# To prove you've completed this section, run the following: <code>echo "My name is ''insertFullName'', and I've completed the Linux VM investigation." > ~/lab2.txt</code>
# To quit, type <code>exit</code>.
 
== Part 3: Managing your Linux VM from the AWS UI ==
Managing your Linux-based VM is much the same as with your Windows VM from Investigation 1. The major difference is shutting down. As with the Windows Server VM, '''shutting down your VM when you aren't using it is essential to responsible usage'''.
 
You have two options to shut down your Linux VM:
# From within Linux: Log back in to the Linux VM via SSH, and run the following command: <code>sudo systemctl poweroff</code>
# From AWS: In the EC2 ''Instance summary'' page for the VM, use the '''Instance state''' drop-down menu and select '''Stop Instance'''.
 
Either way will fully shutdown the VM properly.
 
That's it!
 
= References =
* '''What is Amazon EC2?''' (Windows Instances) - https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/concepts.html
* '''What is Amazon EC2?''' (Linux Instances) - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html
= Lab Submission =
[[Image:Ops705_lab2_fig20.png|thumb|right|500px|Figure 6. Example of the SSH text portion for screenshot #4.]]
Submit to Blackboard's ''Lab Submission'' section full-desktop screenshots (PNG/JPG) of the following:
# The EC2 Instances page, with all currently created VMs listed.# The Instance details page for the Windows VM you created in this lab, powered on.
# A running RDP connection to this new VM, with the text file you created open in Notepad. (Do not fullscreen Notepad.)
# The Instance details page for the Linux VM you created in this lab, powered on.
# A running SSH connection to this new VM, and the following commands run and its output visible onscreen: <code>hostnamectl; cat ~/lab2.txt</code>
# The EC2 Instances page, with all currently created VMs listed and powered on.
'''Your professor will not check your lab until the screenshots have been submitted.'''

Navigation menu