Difference between revisions of "OPS705 Lab 5 (2217)"
m (→INVESTIGATION 1: Amazon Web Services) |
m (→Part 2: Accessing Your Linux VM Remotely Using SSH) |
||
Line 126: | Line 126: | ||
# The SSH command will ask you to confirm connecting. Type ''yes'' 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> | # 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." > ~/ | + | # To prove you've completed this section, run the following: <code>echo "My name is ''insertFullName'', and I've completed the Linux VM investigation." > ~/lab5.txt</code> |
# To quit, type <code>exit</code>. | # To quit, type <code>exit</code>. | ||
Line 136: | Line 136: | ||
# The SSH command will ask you to confirm connecting. Type ''yes'' 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> | # 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." > ~/ | + | # To prove you've completed this section, run the following: <code>echo "My name is ''insertFullName'', and I've completed the Linux VM investigation." > ~/lab5.txt</code> |
# To quit, type <code>exit</code>. | # To quit, type <code>exit</code>. | ||
Revision as of 12:23, 2 November 2021
Contents
LAB PREPARATION
Purpose / Objectives of Lab 5
In this lab, you will learn how to create a Windows Server 2019 and a Red Hat Linux virtual machine in a second cloud computing provider, Amazon Web Services (AWS). For the rest of the course, we'll be using AWS Academy, a managed classroom offering developed for educational institutions providing access to most of AWS just as they would be used in a normal production environment. More details about AWS and AWS Academy can be found in the Blackboard lectures slides and video on the subject.
While you are working through this lab, it is highly recommended that you write down general notes and commands to help you remember how to do this lab. You may use your notes during tests, so fill it out accordingly!
If you encounter technical issues, please contact your professor via e-mail or in your section's Microsoft Teams group.
Minimum Requirements
Before beginning, you must have:
- Successfully completed Lab 4
- Watched the AWS Academy video lecture
- Read through the AWS Academy slides, and have them handy as a reference for concepts
- Followed the e-mail instructions in your AWS Academy invite, found in your Seneca inbox
INVESTIGATION 1: Amazon Web Services
In this investigation, you'll log in to Amazon Web Services' Academy classroom and familiarize yourself with the interface. We'll be using AWS for the majority of our work in this course.
Part 1: Completing Your AWS Academy Registration
- Follow the e-mail instructions in your AWS Academy invite, found in your Seneca inbox.
- Check your spam filter before asking for a second invitation e-mail.
- Warning: Do not create your own student account manually! Doing so can interfere with the AWS Academy account and cause login issues. Use the e-mail invitation link for registration.
Part 2: Logging In to AWS Academy
This section assumes you've followed the directions in your AWS Academy invitation e-mail and have successfully logged in to your account. Check your spam filter before asking for a second invitation e-mail.
To login, complete the following steps:
- Open a new browser window, and navigate to: https://www.awsacademy.com/LMS_Login
- Click the Student Login link.
- In the next screen, supply your Seneca e-mail address as the username, and the password you assigned during setup.
- Once logged in, on the menu bar to the left of the page, click on Courses.
- You should now see our course listed. Click on it to enter
- Click on the Modules item.
- Click on Learner Lab - Foundational Services
- Click Confirm on the third-party warning (If it appears).
- Click Start Lab to start your environment.
- When the red dot next to AWS changes to green. the environment has started. Click on it to open the environment.
- A new browser window will launch automatically. This is the AWS Management Console where you will do most of your work. From this point on, your experience will closely match a normal production account.
INVESTIGATION 2: Managing a Windows Server 2019 VM in AWS Academy
In this investigation, you'll create, configure, and manage a Windows Server 2019 Virtual Machine using Amazon Web Services and a pre-built image. Compare and contrast this experience with your setup of a Windows Server VM in Azure from Lab 2.
Part 1: Creating a Windows Server 2019 VM with EC2
We will now create a virtual machine in AWS using the EC2 service.
- In the AWS Management Console, click on the Launch a virtual machine link.
- From here, you can select from a number of pre-built VM images. In AWS, these are called Amazon Machine Images', or AMIs.
- In the search bar, type the following and hit Enter: Windows Server 2019 Base
- Click Select next to the entry Microsoft Windows Server 2019 Base. (Note: NOT the one with Containers)
- You are now in the Choose an Instance Type screen. This should look familiar to you. It's here that we select the virtual hardware we want to assign our VM.
- Select t2.large. This is the entry with 2 vCPUs and 8 GiB of memory.
- To advance to the next screen, click on the bottom right button labeled Next: Configure Instance Details
- In the Configure Instance Details screen, leave all the defaults as they are. Feel free to look through the options, but don't change them.
- To advance to the next screen, click on Next: Add Storage
- As with the previous screen, leave the defaults. Notice the ability to change how much storage is allocated, and the option to add more virtual drives.
- Click the Next button again to advance to the Add Tags screen.
- Here, you can add a tags (a key-value pair) to help organize your work. Remember this for the future.
- At the very top of your browser window, click on the link 7. Review to skip ahead.
- Review your settings (what little you have!) and click the blue Launch button at the bottom right.
- A dialog box pops up asking you about key pairs. In the first drop-down menu, select Create a new key pair.
- In the Key pair name text box, enter your Seneca user ID and the course as such: cjohnson30-ops705 (substitute your Seneca user ID)
- Click the Download Key Pair button. You will need this file to decode the password to your new VM. DO NOT SKIP THIS STEP!
- Click on Launch Instance.
- Once the Launch Status page shows up, click on View Instances.
- You are now in the EC2 console, with a listing of all virtual machines that currently exist in your account.
- Click on the new entry to view the VM instance. This will display information about the VM, as well as its current state.
Part 2: Remotely Connecting to your Windows Server VM in AWS
- From the Instance details page of your new VM in AWS, click on the Connect button near the top-right of your browser window.
- Don't be alarmed by the red warning!
- Click on the RDP client tab button near the middle of your screen.
- From the RDP client tab, click Download remote desktop file. You'll be able to open this directly in your favourite RDP client on your personal computer and it will automatically supply the host address, port number, and username for this VM. But don't open it yet.
- Next to the Password entry in the RDP client tab, click the Get password link.
- This is where you decrypt the password that was automatically set up for you. Click the Browse icon and select the key pair file you downloaded in Part 2.
- The text box below Browse should fill with key information. Click on the Decrypt Password button.
- You now have your password! Open the remote desktop file from Step 4 in an RDP client on your personal computer, and paste the password from this screen when asked.
- In a few moments, you should be connected to a brand-new Windows Server 2019 VM!
- Once connected, open Notepad, and write
My name is insertFullName, and I've completed the AWS Windows Server VM investigation!
Save the file to your VM's desktop, with the filename yourSenecaUsernameAWS.txt.
Part 3: Managing your VM from the AWS UI
- Go back into the Instance details page for your new VM.
- As noted earlier, this screen contains details about the VM along with its current status.
- A the top right of this page, you'll find the Instance state drop-down button. From here, you can stop the instance, start it, hibernate it (in certain cases), reboot, and terminate. Note: As mentioned in our lecture, the Terminate option will delete your VM!
- Unlike Azure VMs, you can shutdown Windows normally through your RDP connection, and it will fully stop the VM once its shutdown. No need to deallocate any resources.
- At this point, power down your VM. Either do so from within your RDP connection, or click the Stop instance option in the AWS Instance state drop-down menu.
Part 4: A Note About Resource Usage
As with our work in Microsoft Azure, keeping out costs down is important. When you aren't using a resource (like a VM), make sure it's in a stopped state.
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 3: 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
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:
cd Downloads
(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:
[ec2-user@ip-172-31-95-114 ~]$
- To prove you've completed this section, run the following:
echo "My name is insertFullName, and I've completed the Linux VM investigation." > ~/lab5.txt
- To quit, type
exit
.
On macOS/Linux, Using Terminal:
- Open Terminal.
- Change directories to your default Downloads folder with the following command:
cd Downloads
(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:
chmod 400 *.pem
- 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:
[ec2-user@ip-172-31-95-114 ~]$
- To prove you've completed this section, run the following:
echo "My name is insertFullName, and I've completed the Linux VM investigation." > ~/lab5.txt
- To quit, type
exit
.
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:
sudo systemctl poweroff
- 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
Submit to Blackboard's Lab Submission section full-desktop screenshots (PNG/JPG) of the following:
- 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:
hostnamectl; cat ~/lab2.txt
- 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.
Make sure to fully stop your VMs when you're done, and don't delete it!