Step 1: Logging into an EC2 node

  1. Download classkey.pem (go to Tools -> Attachments or click on the paper clip on the upper right hand side of this page), and save it somewhere you'll remember
  2. Preparing the key file (Windows Instructions)
    1. Run puttygen.exe, and click "Load"
    2. Change the file type to "All files (*.*)" and select classkey.pem.
    3. You should get a message about successfully importing the key.
    4. Add a password to your key (this isn't strictly necessary, but is good practice).
    5. Click "Save private key", and save the key somewhere you'll remember it (call it classkey.ppk).
    6. Exit puttygen
  3. Preparing the key file (Mac and Linux instructions)
    1. Open a terminal
    2. Run "chmod 600 classkey.pem" (you may need to replace classkey.pem with the path to that file). If you're interested in what's going on here, you can check out sections 5.1 and 5.2 of the unix tutorial.
  4. Log into the node (Windows instructions)
    1. Open putty (not puttygen)
    2. Paste ec2-user@ec2-23-21-1-36.compute-1.amazonaws.com into the box labeled "Host Name (or IP address)
    3. On the left side, under "Connections" click on "SSH", and then on "Auth". Click "Browse" to select your private key file, and select classkey.ppk (not classkey.pem).
    4. Click "Open" at the bottom of the window.
    5. On the prompt, agree to continue connecting
    6. Enter the passcode you created for your key
  5. Log into the node (Mac and Linux instructions)
    1. Open a terminal
    2. Run "ssh -i classkey.pem ec2-user@ec2-23-21-1-36.compute-1.amazonaws.com" (again, you may need to replace classkey.pem with the path to that file). The -i option says that classkey.pem is the "identity file" (aka private key) that you will use to identify yourself to the EC2 node.
    3. Say you are sure you want to connect.
  6. You should now be logged in. If you are not, email josilber@mit.edu so we can troubleshoot. If you are, save a screenshot of your login screen.

Step 2: Perform some basic unix commands

For this step, you need to run a series of basic unix commands. At the end, either turn in a copy of the commands and their output or a screenshot of your terminal.

  1. Look at everything currently saved in the home directory with the command ls.
  2. Make a directory with your MIT handle (remove all periods) with the command mkdir.
  3. Move into your new directory with the command cd
  4. Look at your new location with the command pwd
  5. The command echo outputs whatever you type in. For instance, the command echo "hello world" will write out text hello world. Redirect the text hello world into a file called helloworld.txt using the redirection operator >>
  6. Check out the contents of your file with the command cat
  7. Don't log out quite yet, as we have one more command to do

Step 3: Transfer a file to the EC2 node

  1. Create a text file called whatever you want on your own computer. Don't make it too huge.
  2. File transfer (Windows instructions)
    1. Open up WinSCP. If you have stored sessions (you probably don't), you will need to hit the "New" button.
    2. Under "Host name:", you should put ec2-user@ec2-23-21-1-36.compute-1.amazonaws.com
    3. Under "Private key file:", you should click the "..." button and select classkey.ppk (not classkey.pem)
    4. Click "Login", and agree to continue
    5. Enter your passphrase
    6. You should now see files in your computer on the left and files on the EC2 node on the right. Navigate to the file you want to copy over (on the left), and navigate to your folder (on the right). Drag and drop the file from your computer onto the EC2 node.
  3. File transfer (Mac and Linux instructions)
    1. Open a terminal
    2. Type "scp -i classkey.pem path/to/your/file.txt ec2-user@ec2-23-21-1-36.compute-1.amazonaws.com:username/newfilename.txt" (where path/to/your/file.txt is replaced by the real path to your file and "username" is replaced by the name of the folder you created on the EC2 node). Again, classkey.pem is the private key. The next element of this command is the file you want to copy -- it is a file on your computer so you just provide the path to that file. The final element is where you want to copy the file. Since it's on another computer, you provide the login information (ec2-user@ec2-23-21-1-36.compute-1.amazonaws.com) followed by a colon. Finally, you provide the path you want to copy the file to after the colon.
  4. Back in your ssh prompt from Step 2, verify that your new file was actually copied over using the command ls
  • No labels