This article will show how to create a public-private key pair and set up an Amazon AWS Linux server on EC2 that lets you login to the shell using these.
This tutorial will provide step by step instructions on how to set up a Linux server on EC2 using public/private keys. You can do this without cost with the free AWS tiers and the free trial of ZOC Terminal.
The following requisites are required to perform this task (they will briefly be covered below):
Obviously you will need an Amazon AWS account. If you don't have one, here is a good tutorial (Depending on your Risk profile, you can skip the MFA part but you should definitely set up the cost alerts).
Setting up a Linux server will always require some work on the Linux shell. This article will explain basic tasks with ZOC Terminal. You can download ZOC Terminal here. There will be a free trial with all features enabled, no ads for 30 days of actual use (i.e. if you use the program only once a week, the trial will last you for half a year).
To install ZOC Terminal, download it here. Installation is straightforward: During installation just go with the preselected values. If asked about your intended use, choose Access to Linux systems via SSH. Should you later decide that you do not like it, it will offer a quick and clean uninstall.
First you need to create a Public/Private key pair on your computer:
2048
for the key length and change the name to id_rsa-sd
Still in ZOC Terminal:
In your Web-Browser:
id_rsa-sd
as the name of the key and right-click → Paste in the text area for the Public key contents.
(this should give you text beginning with ssh-rsa
and a few lines of MIME text, otherwise copy the key again via ZOC's Tools menu)Note: You only need to complete these steps once. After that, you can use this key for all future EC2 instances you create.
Logon to AWS, select the N.Virginia region and go to EC2 (e.g. by typing EC2 in the search bar). On the left sidebar choose Instances and click Launch Instances.
You will be greeted by an intimidating amount of options, but only a few need to actually be set.
Test-Instance
.t2.micro
as instance type or any of the other free tier egligble types.id_rsa-sd
key pair (this is the key you imported in the previous step).12
GiB and gp2
.Finally click on the orange Launch Instance button.
The system will try to create your instance and after a few seconds you should see a green Success message.
Use the left sidebar to switch to EC2 Instances. There you should see one instance with instance state Pending or Running.
admin
(Note: if you instantiated Ubunutu instead of Debian, the username will be ubuntu
)id_rsa-sd
file (not the id_rsa-sd.pub
file)After a moment should see a connection screen that shows the connection proceeding and eventually you will see the beloved (or dreaded) $-prompt.
Now you are logged into the Linux using your public/private key pair.
If you liked how easy this was, please now allow us a little 60-seconds sales pitch for ZOC Terminal.
You can perform the above tasks with a free SSH client like PuTTY as well.
However, while PuTTY is a reasonable choice for to access Linux shells every now and then, ZOC Terminal is designed for ease of use and effectiveness day in and day out. It offers elegant features that save you a lot time when performing routine tasks.
For example, as you saw, creating the key-pair and obtaining the public key takes only a matter of seconds (about 10 mouse clicks).
Connecting to your EC2 instance through the Quick Connect window is also very easy. If you log off and then realize you forgot something and want to connect again, you can simply press Alt+R in the disconnected tab. Alternatively, go to the Quick Connection window again and click Connect, so you are reconnected with just two mouse clicks.
For file uploads, you can upload files to your server merely by dragging them from the desktop into the ZOC terminal area.
If you are building multiple instances, you can save them from the Quick Connection window to the Host Directory. From there, you can even connect to multiple instances at once (each will then open in a separate tab).
Assume you need to update or install a package on five servers: Open the Host Directory,
select the servers using shift+Mouseclick and click Connect. Then press Alt+C
to open
the Local Typing window. Type your command (e.g., sudo apt update && sudo apt install -y build-essential
),
click Send to all tabs, press Enter and you have easily performed this task in under a minute.
Press Shift+Esc
to watch the parallel output in the Thumbnails overview. Below is a 60-second
video which shows how it works and which also shows a few other functions because after
updating 5 servers, within those 60 seconds there was even time left to show file uploads
and tab colors ;-).
These are just a few examples that demonstrate how using a professional ssh client like ZOC can save valuable time compared to free tools like PuTTY (which admittedly does cover the essentials quite well).
Conclusion: Performing tasks with ease saves time and it also is more fun!