By the end of this chapter, you should be able to:
sshcommand to connect securely to a remote server
scpcommand to copy files to a remote server
SSH, or Secure Shell, provides a secure channel to access other computers. We commonly use SSH to remotely log in and connect securely to other servers. To practice with SSH we will be setting up our own remote servers using Amazon EC2. This setup can be a bit intimidating, but it's a very valuable skill to know with any kind of development. Let's get started!
As evidenced by the list below, there are a fair number of steps involved in setting up your instance. The links provided also provide a fair amount of context, and help explain the purpose of each of the following steps.
To connect to your instance using SSH you can start here.
Before you try to SSH make sure that your instance is running and that the checks have passed. This should involve typing something along the lines of
ssh -i ./me-key-pair-uswest2.pem [email protected]_PUBLIC_DNS
Once you've connected via SSH, you can exit out of the shell by typing
To move files to your EC2 instance, we use the
scp command to securely copy information. We will need our
pem file that we used before so make sure you know where that is located. The pattern for
scp looks like this:
scp -i PATH_TO_YOUR_PEM_FILE FILE_TO_MOVE [email protected]_DNS
This command would move the file
move.txt from my current directory to the
home directory on my EC2 instance.
scp -i ./me-key-pair-uswest2.pem move.txt [email protected]:/
When you are done working on this tutorial - you MUST terminate your instance so that it is not still running. This ensures that you will not be charged for anything as well. You can read more about it here
When you're ready, move on to Cut, Sed, Awk, and Xargs