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/)
Step 2:
Navigate to the EC2 Dashboard ( search for EC2 )
Step 3:
Click on Instance
Step 4:
Click on the "Launch Instance" button.
Step 5:
Name your EC2 Instance:
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
Step 7:
Select an Instance Type
An Instance Type determines the hardware specifications of your virtual machine, such as CPU, memory, and storage.
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.
Step 9:
Configure the Network Instance Details, such as the VPC settings, the subnet.
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.
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
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
Step 11:
Launch your instance and connect
After a few minutes, your virtual machine will be launched and ready to use.
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
Connect using SSH client
Open an SSH client
In the AWS Management Console, at the top of the screen, choose the AWS CloudShell icon
Locate your private key file.
The key used to launch this instance is sips.pem
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
Voila! You've successfully created a virtual machine (EC2) in AWS and used AWS cloudshell to SSH into it.
Top comments (0)