Step 1: Logging into an EC2 node
- Download classkey.pem (attached to this page), and save it somewhere you'll remember
- Preparing the key file (Windows Instructions)
- Run puttygen.exe, and click "Load"
- Change the file type to "All files (*.*)" and select classkey.pem.
- You should get a message about successfully importing the key.
- Add a password to your key (this isn't strictly necessary, but is good practice).
- Click "Save private key", and save the key somewhere you'll remember it (call it classkey.ppk).
- Exit puttygen
- Preparing the key file (Mac and Linux instructions)
- Open a terminal
- 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.
- Log into the node (Windows instructions)
- Open putty (not puttygen)
- Paste ec2-user@ec2-23-21-1-36.compute-1.amazonaws.com into the box labeled "Host Name (or IP address)
- 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).
- Click "Open" at the bottom of the window.
- On the prompt, agree to continue connecting
- Enter the passcode you created for your key
- Log into the node (Mac and Linux instructions)
- Open a terminal
- 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.
- Say you are sure you want to connect.
- 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.
- Look at everything currently saved in the home directory with the command ls.
- Make a directory with your MIT handle (remove all periods) with the command mkdir.
- Move into your new directory with the command cd
- Look at your new location with the command pwd
- 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 >>
- Check out the contents of your file with the command cat
- Don't log out quite yet, as we have one more command to do
Step 3: Transfer a file to the EC2 node
- Create a text file called whatever you want on your own computer. Don't make it too huge.
- File transfer (Windows instructions)
- Open up WinSCP. If you have stored sessions (you probably don't), you will need to hit the "New" button.
- Under "Host name:", you should put ec2-user@ec2-23-21-1-36.compute-1.amazonaws.com
- Under "Private key file:", you should click the "..." button and select classkey.ppk (not classkey.pem)
- Click "Login", and agree to continue
- Enter your passphrase
- 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.
- File transfer (Mac and Linux instructions)
- Open a terminal
- 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.
- Back in your ssh prompt from Step 2, verify that your new file was actually copied over using the command ls