How to setup an AWS EC2 instance and connect using SSH

·

3 min read

prerequisites

  • AWS account

  • Termius installed on your PC

In this article, I am going to discuss how to configure a was ec2 instance and connect it using the ssh(Secure Shell) protocol. On my PC it's windows 11 and I have already installed Termius on my machine.

Create an EC2 instance on the AWS account

first of all, you need to log in to your AWS account and search for the ec2 service in the search bar.

then click on the ec2 instance and go to that service. then it will show a screen as follows.

then click on the launch instance.

then fill up the information as needed

  1. Name: insert a name for your instance, In this article I name the instance as 'test-instance' this is the specific name for the instance

  2. Then you need to choose the application and os images: here I choose the ubuntu os image which is eligible for free tier.

  3. Instance type: choose instance type as t2.micro

  4. Key pair: these key pairs help you to connect your instance securely. before you go ahead you need to confirm you have access to the existing key pair or else you need to generate a new key pair using create new key pair. when you click on create new key pair it will show up as a pop-up like this. fill in the details as follow. when you choose a name you can only add names under 250 characters, cant include leading or trailing spaces.

    once you create key pair it will automatically download your key pair keep in mind to store these key pairs in a safer place.

  5. For everything else leaves it as default and click on the launch instance button.

Yoo! Hoo! you have successfully created your was ec2 instance..

once you go to the instances and select a region you selected when instance creation it will show the instances.

is it enough? no, to do something with this instance you need to connect to the instance.

Connect instance via SSH

  1. Open the termius , click ADD button in top left and click new Host

  2. set a label, this label is for only identification purposes on terminus, just like a name

  3. then set the address as your Public IPv4 address from the AWS management console's instance summary.

  4. then In the ssh section on termius click the Set a Key> New buttons

    set a label and import the key you downloaded in previous step. and save the key

  5. once your all changes saved your instance will appears

    then click on the host you created

  6. set the username as ubuntu and add and continue

    you will be appearing ubuntu server terminal. you are ready to go now!