Virtual Machine Instance
Published: 2023-05-08 08:20:06

Cover image for Create a Virtual Machine Instance(EC2) in AWS & Connect Via SSH(Cloudshell)
sipsdaoracle
sipsdaoracle
Posted on May 7

Create a Virtual Machine Instance(EC2) in AWS & Connect Via SSH(Cloudshell)
#
scacloudschool
#
cloudpractitioner
#
awscloushell
#
ec2
What is an EC2?
An EC2 (Elastic Compute Cloud) is a virtual computing environment provided by Amazon Web Services (AWS). It allows you to create and manage virtual machines (instances) in the cloud.

How can you use an EC2?
You can use an EC2 to run your applications, services, or workloads in the cloud. You can choose the hardware specifications (CPU, memory, storage) and the operating system of your instances, and you only pay for the resources you use.

By the end of this tutorial you should be able to accomplish the following:

Create EC2 instance
SSH into EC2 Virtual Instance Machine using Cloudshell
What you'll need to get started:

An AWS account
SSH Client(Cloudshell)
Now let's get started and create an EC2 instance:

Step 1:
Sign into the [AWS Management Console](https://aws.amazon.com/console/)

Image description

Step 2:
Navigate to the EC2 Dashboard ( search for EC2 )

Image description

Step 3:
Click on Instance

Image description

Step 4:
Click on the "Launch Instance" button.

Image description

Step 5:
Name your EC2 Instance:

Image description

Step 6:
Choose an Amazon Machine Image (AMI)
An AMI is a pre-configured image that contains the software and operating system you want to use on your instance.

We'll use AWS Linux in this tutorial

Image description

Step 7:
Select an Instance Type
An Instance Type determines the hardware specifications of your virtual machine, such as CPU, memory, and storage.

Image description

Step 8:
Create a key pair
A key pair is a set of public and private keys that allows you to securely connect to your instance over SSH.

Image description

Step 9:
Configure the Network Instance Details, such as the VPC settings, the subnet.

Image description

Configure Security Group settings to allow inbound traffic to your instance.

You can add rules to your security group to allow access over specific ports or protocols, such as SSH or HTTP.

Image description

Step 10:
Add Storage to your instance
You can choose the storage type (such as SSD or HDD), size, and number of volumes. You can add up 30GB on the free tier account

Image description

Review Summary
A summary of your configurations will be displaced you can also select the number of instances you'd like, if you're happy with everything you can click on launch

Image description

Step 11:
Launch your instance and connect

After a few minutes, your virtual machine will be launched and ready to use.

Image description

You've successfully created a virtual machine (EC2) in AWS.

You can now connect to your instance by following the steps below:
1. Click on the check box **
**2. Click on connect

Image description

Connect using SSH client
Image description

Open an SSH client
In the AWS Management Console, at the top of the screen, choose the AWS CloudShell icon

Image description

Locate your private key file.
The key used to launch this instance is sips.pem

Image description

Run this command
To ensure your key is not publicly viewable.
chmod 400 sips.pem

Connect to your instance
using its Public DNS:
ec2-3-90-208-38.compute-1.amazonaws.com

Run command:

ssh -i "sips.pem" ec2-user@ec2-3-90-208-38.compute-1.amazonaws.com

Image description

Voila! You've successfully created a virtual machine (EC2) in AWS and used AWS cloudshell to SSH into it.