OPS345 Lab 1

From CDOT Wiki
Revision as of 02:14, 8 December 2021 by Andrew (talk | contribs) (Accessing your AWS account)
Jump to: navigation, search

THIS PAGE IS A DRAFT, NOT A REAL COURSE PAGE

The current schedule for OPS345 is here: OPS335_Weekly_Schedule

Accessing your AWS account

At the beginning of the semester your professor will create a Leaner Lab in AWS Academy. The professor will add all the students enrolled in their OPS345 sections as students in that Learner Lab. You should automatically receive an email that looks like this in the beginning of the course:

AWSAcademyInvitation.png

If you haven't recieved such an email: you need to let your professor know.

Once you complete setting up your account: you might want to bookmark this page, or even make it your home page: https://awsacademy.instructure.com

Browse around the interface. To do your work for OPS345 you only ever need to navigate to "Courses" > "AWS Academy Learner Lab - Foundation Services" > "Modules" > "Learner Lab - Foundational Services", which looks like this:

AWSAcademyLearnerLabHomeScreen.png

The links you'll use most often are highlighted in green:

  1. This is the amount of credits you have used out of your allocated 100$. Unlike the screenshot yours will start at zero.
  2. Most of your AWS resources are turned off unless your lab is started. Click this button to start the lab. There is only one lab for the entire OPS345 course, you will start it many times.
  3. The amount of time the current session of the lab has been running. After the 4 hours runs out the lab will be stopped and the associated resources will be shut down.
  4. Click here to get to the AWS web interface where you'll do most of your work.

Your work which you save inside your virtual machines is not deleted once the lab stops. AWS Academy simply shuts down your virtual machines. Your virtual machines and the rest of your Learner Lab resources will be deleted automatically at the end of OPS345.

The first time you start the lab it may take a few minutes, much longer than usual.

AWS cost monitoring

  • You are responsible for your AWS usage. Normally using resources from AWS costs money. In an AWS Educate Learner Lab you get a 100$ credit which will be more than enough to cover all your resources until the end of the course.
    • Take this opportunity during the course to learn what costs how much money, and make sure you don't use up your 100$ until you are done all your work in the course. The skills of managing cloud costs are very valuable.
    • Both in the Learner Lab and the real AWS figuring out what the money was spent on is surprisingly difficult after it's already spent. So pay attention whenever you see a note about the cost of anything.
    • You cannot use AWS Budgets in your AWS Learning Lab.
    • You could try to figure out how to use the Amazon CloudWatch billing alarms
  • Always keep cost in the back of your mind when doing /anything/ on AWS

Basic security on a public-facing server

  • A good AWS password, not used anywhere else
  • Remove default usernames
  • Whenever possible: don't use passwords at all, use SSH keys for logging in
  • root is never allowed to log in remotely
  • How to use sudo and how to configure it
  • ssh keys, same as OPS245
  • How to organise your SSH keys and not lose them

First AWS VM

  • Create a new security group "ops345first" with only the SSH port open. We'll look at security groups in more detail next week.
  • Instance == VM. AMI == VM disk image.
  • Lots of AMIs appear to be available, only Amazon Linux works with AWS Academy.
  • Use "Launch Instances" to deploy a pre-built "Amazon Linux 2 AMI (HVM), SSD Volume Type" VM. Not one of the other Amazon Linux AMIs.
    • Instance type t2.micro - sort of kind of almost free
    • Security group "ops345first"
    • Create a new RSA key pair named ops345-first-key, save it as ops345-first-key.pem on your workstation under a new directory ~/keys/ssh/
  • Differences between Amazon Linux and CentOS
    • /etc/yum.repos.d/amzn2-core.repo
    • Not linked to RedHat/IBM support cycles and policies.
  • Explore the VM:
    • connect with user ec2-user, ssh key
    • Many packages not installed by default in CentOS /are/ installed by default in Amazon Linux.
    • yum install telnet
    • systemctl works the same way
    • Note neither iptables nor any other firewall is installed by default.
    • passwd, shadow, group files
    • netstat -atnup
  • Create yoursenecaid user, no password, create /etc/sudoers.d/10-ops345-users with these contents:
yoursenecaid ALL=(ALL) NOPASSWD:ALL
  • Allow yourself to log in using your SSH key:
# cd /home/ec2-user/
# cp -r .ssh/ ~yoursenecaid
# chown -R yoursenecaid.users ~yoursenecaid/.ssh/