How to Create EC2 Instance (Ubuntu 22.04) on AWS and Connect Via SSH using PEM

Hellooooo there,
Let me guess you have started your cloud journey and trying to find your way…right? same here 🙂

We are going to set up our Instance or Virtual Machine if you prefer that. So, first things first ensure that you have a AWS account,…


This content originally appeared on DEV Community and was authored by Ivy Jeptoo

img alt
Hellooooo there,
Let me guess you have started your cloud journey and trying to find your way...right? same here :-)

We are going to set up our Instance or Virtual Machine if you prefer that. So, first things first ensure that you have a AWS account, You can set it up here.

Table of Contents

  • Launch EC2 Instance

  • Configure Instance

  • Connect to Instance

  • Terminate Instance.

Launch EC2 Instance.

  • Search for EC2 on the search bar then open it,on the EC2 Dashboard you will see Resources which shows the instances that are running and everything related to EC2.

  • Under Launch Instance section there is the Launch Instance button that we'll use to create a new instance so click on it.

Check the image below for reference

EC2 Dashboard

Configure Instance.

  • Name and Tags
    You are going to give a name to your instance,

  • Application and OS Images (Amazon Machine Image)
    Depending on the Operating system,application server and application you are dealing with you select AMI that suites you. (Under the Instance type you'd want to leave it unchanged since we are using the free tier but there are so many options!)

Check the image below for reference

Name and AMI

  • Key pair (login)

This is an essential part since it deals with security. If by chance you share your service IP address they cannot access your server without any key.
We need to generate a key pair for our instance, so click in the create new key pair and proceed to give the key pair name, type and key file format (if you are using Mac or Linux to log in to the server select .pem and use .ppk if you are using windows).
A file with the key pair name will be downloaded to your device.(we'll use it later to connect to our instance do, so do)

Check the image below for reference

Key Pair

  • Network Setting
    Keep the subnet as it is and enable auto-assign public IP- this will assign a public IP after starting the vm.

  • Create Security Group
    this controls traffic to the instance, you can leave it or customize it to your liking.

  • Configure storage
    The maximum storage for free tier is 30GB so feel free to adjust it accordingly.

Check the image below for reference

Network and security

  • Summary

After finishing configuring everything you can select the number of instance you want created and click on the Launch Instance button to create it you'll then see the
'Successfully initiated launch of instance'

summary

Connect to Instance

When you check the instances you'll be able to see a list of instances that you have including the one just created.

Like so:

Connect

  • Click on the check box under arrow 1 to view instance details.
  • To connect to your EC2 instance from ubuntu, open your terminal and run this command ( I am assuming that you saved your key pair in your home).

ssh -i path-to-key ec2-user@ip-address

example

ssh -i "SCA-emerald.pem" ubuntu@ec2-18-219-91-204.us-east-2.compute.amazonaws.com

Check the image below for reference

connect

Terminate Instance

  • On the instance state under the instances page, there is a button named Instance state when you click on the drop down there is an option to 'terminate instance' which will redirect you to a confirmation page. If you are sure you want to delete the instance then go ahead click the Terminate button!

We've come to end of this tutorial, until next time...

end


This content originally appeared on DEV Community and was authored by Ivy Jeptoo


Print Share Comment Cite Upload Translate Updates
APA

Ivy Jeptoo | Sciencx (2023-04-03T21:09:16+00:00) How to Create EC2 Instance (Ubuntu 22.04) on AWS and Connect Via SSH using PEM. Retrieved from https://www.scien.cx/2023/04/03/how-to-create-ec2-instance-ubuntu-22-04-on-aws-and-connect-via-ssh-using-pem/

MLA
" » How to Create EC2 Instance (Ubuntu 22.04) on AWS and Connect Via SSH using PEM." Ivy Jeptoo | Sciencx - Monday April 3, 2023, https://www.scien.cx/2023/04/03/how-to-create-ec2-instance-ubuntu-22-04-on-aws-and-connect-via-ssh-using-pem/
HARVARD
Ivy Jeptoo | Sciencx Monday April 3, 2023 » How to Create EC2 Instance (Ubuntu 22.04) on AWS and Connect Via SSH using PEM., viewed ,<https://www.scien.cx/2023/04/03/how-to-create-ec2-instance-ubuntu-22-04-on-aws-and-connect-via-ssh-using-pem/>
VANCOUVER
Ivy Jeptoo | Sciencx - » How to Create EC2 Instance (Ubuntu 22.04) on AWS and Connect Via SSH using PEM. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/04/03/how-to-create-ec2-instance-ubuntu-22-04-on-aws-and-connect-via-ssh-using-pem/
CHICAGO
" » How to Create EC2 Instance (Ubuntu 22.04) on AWS and Connect Via SSH using PEM." Ivy Jeptoo | Sciencx - Accessed . https://www.scien.cx/2023/04/03/how-to-create-ec2-instance-ubuntu-22-04-on-aws-and-connect-via-ssh-using-pem/
IEEE
" » How to Create EC2 Instance (Ubuntu 22.04) on AWS and Connect Via SSH using PEM." Ivy Jeptoo | Sciencx [Online]. Available: https://www.scien.cx/2023/04/03/how-to-create-ec2-instance-ubuntu-22-04-on-aws-and-connect-via-ssh-using-pem/. [Accessed: ]
rf:citation
» How to Create EC2 Instance (Ubuntu 22.04) on AWS and Connect Via SSH using PEM | Ivy Jeptoo | Sciencx | https://www.scien.cx/2023/04/03/how-to-create-ec2-instance-ubuntu-22-04-on-aws-and-connect-via-ssh-using-pem/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.