A Beginner's Guide to SSH and Launching AWS EC2 Instance


What is SSH ?
SSH (Secure shell) is a cryptographic network protocol. Which enables to connect remote server over a unprotected network like “Internet“ from the local computer. SSH mostly used for sending command to computer like AWS EC2 machine over an unsecured network.
If you are not getting the “cryptographic“ shit , here is the short explanation for it:-
It’s a science for encrypting information so that only right or authenticated user can read it, It’s uses public key to encrypt data which can be available to anyone but for decryption of data it required to have private key , which is only and should always be available to end user. Later in this article we will see both keys, so stay tuned…
What SSH do ?
SSH allows tunneling or port forwarding, so that data packets able to cross networks, that would not otherwise able to cross.
Now, let understand these two jargons tunneling and packets in simple words:-
Tunneling : Tunneling is a way to move packets from one network to another. Tunneling works via encryption (Wrapping a packet inside another packet).
Packet: All data that crosses a network is broken down into smaller chunks, these chunks are called packets.
🔐 How SSH Works — Step by Step
Client initiates a connection:
The client sends a request to connect to the server, using its private key to prove its identity.Server verifies the client:
The server checks the client's private key against the public key it has stored (usually in~/.ssh/authorized_keys
). If they match, the client is authenticated.Secure channel is established:
Once authentication is successful, both the client and server generate and share symmetric encryption keys. These keys are used for encrypting all future communication during the session.Encrypted communication begins:
Every command or data transfer between the client and server is now encrypted using the symmetric key, and only the intended receiver (client or server) can decrypt and read it.
Now it’s time to understand,our final jargon “Symmetric and Asymmetric Keys“:-
Symmetric key: When the same key is used to lock (encrypt) and unlock (decrypt) the information, it's called symmetric encryption. So, whoever has this key can access the data.
Asymmetric Key: Here, two different keys are used — one to encrypt and another to decrypt. The public key locks the data, and only the matching private key can unlock it. The key used to lock can't unlock — that’s the magic!
Steps to launch AWS EC2 instance -
https://signin.aws.amazon.com/signup?request_type=register visit to this website or you can google it as “aws console“, you can find a button on top right corner as “create an AWS Account “.You will see form like this below.
Now, enter your email and your account name and click on verify email address, after that you will see next form like below.
Enter your password and continue to next step.
Now you will see another form like below where you have to fill your contact and address details, then you can proceed to further.
Now you have to fill your debit/credit card details,
NOTE: - You will be temporarily charged $1 USD, to verify your accounts, in as mentioned on the above screenshot / aws website, you get your refund within 3-5 days.
After moving to further simple steps you will see your aws console dashboard like below:-
You need to navigate to “instances”.
After , navigating to instances you will see all launched instances in this page, though you will see no instances for the very 1st time, now you need to navigate to “Launch instances“.
Now you will be redirected to the page where you need to select some configuration for the instances/machine.
In “Name“ input box , you need to give name to your instance.
Next, you need select O.S which you want to run on instance/remote machine ,”Here I am selecting Ubuntu”.
After selecting O.S , you will be asked to select version of your O.S, by default latest (LTS version) automatically get selected, so you don’t need to change that.
After that It will ask to select architecture, so you don’t need to change that thing also.
After finalizing architecture, it will ask selecting hardware configuration for your machine, where you can select any of “free tier eligible” hardware configuration, else you will be charged as mentioned above. (Aws provides 12 months free aws services with some limits),here I’ve selected t2.micro configuration.
After selecting hardware configuration, you need to “create key-pair” (if you want to access you instance/remote-machine from your local computer through terminal).
After clicking on “create key pair“ a dialog box will appear on your screen, where you need to give name to your key pair, here I am giving name as “example server“.
You don’t need to change “key pair type” for now.
Now, if you are using windows and have updates after 2018 and you use git bash terminal, you can go with default selection .pem and click on “create key pair“ to download private key.
Else, you need to install ssh configuration in your windows and select on .ppk option.
If you are using macOs, then you can also need to proceed further with .pem selection.
After that you can keep the “Network setting and configure storage” as it is, and click on launch instance.
After launching the instance, you will see the success message on the top and “view all instances“ option on the bottom, where you need to click.
After that you will see your newly launched instance, now you need to select and click on “connect” button on top.
Now , If you want to access/use your instance from your browser you just need “Select EC2 connect“ and click on bottom “connect", your will see the a Linux terminal in your browser which is the remote computer’s terminal.
- Else if you want to connect to remote computer from your own terminal you can select “SSH client“ option and copy the example command, and past it to the git bash terminal where you have recently downloaded your private key or where you have kept or saved it.
After pasting , the example command you will be asked to connecting to remote computer as you type “yes“ and press enter, here you go, you just have your first experience of using SSH protocol for connecting remote server from your local computer,
You will see remote computer’s terminal.
Now the key through you accessed the above terminal , “example-server.pem“ in my case is private key, we discussed in SSH section, and for viewing public key on your remote computer you can execute this command: cat ~/.ssh/authorized_keys
You will see your public key, which mostly reside on remote server and the private key is always kept in your computer only.
So, that was a article on “Understand SSH and launching AWS EC2“ if you find any mistake then , or have any suggestion must comment below and thank for giving your valuable time, keep growing together…
Subscribe to my newsletter
Read articles from Abhishek Ranjan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
