Hello, and welcome back to CS615 "System Administration". In this video, we'll quickly summarize our first homework assignment, which is to get yourself set up for use with AWS EC2. --- As mentioned in our introductory videos, we'll be using EC2 a lot in this class, and all of our work will be done from the command-line, so one of the primary objectives - of this assignment is - to get you set up in your preferred environment to be ready to use the AWS tools in general, and in particular to be able to launch and then access EC2 instances without any problems. As a second outcome, - you'll also be asked to run a few commands that will help you prepare for our week 2 materials, when we will be talking about storage models and file systems. The way we'll do this - is, as also mentioned in our introductory video - by using the command-line tools. Now you may set yourself up for using the AWS command-line tools on your laptop or a shared VPS or wherever you may choose, but I strongly recommend that you use the shell servers provided to you by Stevens under the linux-lab name. In our video on the use of git(1), we already covered how to facilitate your ssh access to these systems, and they do have the AWS command-line tools already installed, so it'll be a lot easier for you to start there. - Next, as the assignment asks you to run a number of commands, and as you may follow online tutorials -- or the very first Stack overflow answer that pops up when you search "how to start using AWS" in Google -- it's important for you to actually understand all the commands you run. - Likewise, it's important for you to understand all the output of the commands. For this reason, the homework assignment also asks you to provide additional commentary in your submission, as well a to describe any problems you ran into. The full homework assignment is linked to from the course website and can be found at this link here. - When you're done getting set up, you should be able to launch EC2 instances pretty much as I'm about to show you: --- That is, we start out by ssh'ing to linux-lab. With the AWS command-line utilities properly set up, you'd have a configuration that should look somewhat like this. [pause] Please make sure to properly protect your config file, as it will contain the private access key. Please also do _not_ send me your private AWS credentials. They are supposed to remain _private_. [continue] Now to launch a new NetBSD instance as per the assignment, we'll use the 'aws ec2 run-instances' command. Depending on your AWS setup, you may have to specify a security group or a subnet, although in many cases the default security group and subnet are ok to use. My account is old enough that it still defaults to a non-VPC environment, meaning I had to create non-default security groups and subnets for many AMIs, but don't let this throw you off. If you can launch an instances without specifying these, that's fine, too. [pause before json] Likewise, you may have a default ssh keypair that's perfectly fine to use; I use different keys based on where I launch things from, which is why you see me specify a non-default keypair here. You may pick an instance type of your choosing, but need to make sure to pick the right architecture for the OS in question. So you may run a much simpler aws command here, but either way, eventually you will have launched an instance and get back a bunch of json, as shown here. [continue] Json output, by the way, is wonderful, because you can then pipe that into 'jq' to extract the individual fields. In this case, we'll manually grab the instance ID, and because we're lazy and don't want to type it every time, assign it to an environment variable. [pause] We can then check what the hostname of the newly created instance is by using 'aws ec2 describe-instances' and pipe that into 'jq', as shown here. [continue] Ok, so we got the hostname. Let's see if the instance is up and running yet... Nope, doesn't look like it. Let's check the status. See, isn't 'jq' wonderful? If you're not familiar with it, you should definitely check it out and practice using it. It's quite helpful. Anyway, the instance claims to be "running", so let's ping it again... Hmm, still not working. Now this is one of those things that's a bit annoying with EC2: you spin up an instance, but then you don't know when it's ready. Well, we'll see some ways to determine when it should be available when we review your homework submissions, but perhaps you can look for some other AWS commands that may be helpful here? Anyway, let's go back and check via ping... There, after some waiting, it seems to finally respond. So the instance should now be up and running. Let's log in. We specify the right SSH key to use as well as the root user... et voila, we're logged into our NetBSD instance. We can confirm that this is an amd64 instance, and we can take a look at the boot messages via the dmesg(1) command, which shows us how the kernel initialized the virtual hardware at boot time. [pause] Now here you'd normally run the various other commands the assignment asks you to run, but for now, we'll just exit. [pause] Next, since AWS resources cost money, we want to make sure that we remember to terminate the instance again whenever we're done using it, so [continue] we simply run the 'aws ec2 terminate-instances' command. And there you have it. When you're done with your Homework 1, you should be able to launch, access, and terminate instances just like I've shown you here. If you run into problems, make sure to send your questions to the class mailing list or ask on Slack. --- Also make sure to write up any issues you may have run into and to answer all the questions asked of you. These links shown here may help you get set up. Thanks for watching, and good luck with the assignment!