How To Create an EC2 Instance on AWS
Tags: aws, cloud, devops, ec2
Published: 2023-07-08 08:07:31


In this guide, i will be demonstrating the process of setting up a Linux virtual machine on the cloud, specifically using Amazon EC2. Amazon Elastic Compute Cloud (Amazon EC2) is a service that offers scalable and secure compute resources in the cloud, functioning as Infrastructure as a Service (IaaS).<br><br>



##Pre-requisites

1. An AWS account
2. Familiarity with the AWS management console 



##Create EC2 Instance <br><br> 

**- Sign in to the [Amazon Management Console.]
(https://console.aws.amazon.com)**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kqdvvzeh1n6t7g5h7f71.png) <br><br><br>



**- From the navigation bar, choose a suitable geographic region that meets your requirements.**
_Tip: Choose a nearer geographic region from your location to get faster responses_


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5eo7gnruhfbixt8fslyz.png) <br><br><br>



**- Search EC2 in the search bar, and click on it.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9kdsl9iwnrlyhqbei69x.png) <br><br><br>


**- In the EC2 dashboard, select instances.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a7xmf8lr8aynjp11nbwq.png) <br><br><br>


**- Click Launch instances.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jgu2sth3ot7u6bzbcftw.png) <br><br><br>


**- Give your instance a name.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h2gqyubaqz60ukwcauzi.png) <br><br><br>


**- Select the appropriate AMI for your instance.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqypbzh9xtheac6re47p.png) 

An **Amazon Machine Image (AMI)** is a pre-configured virtual machine image that is used to create EC2 instances.

It contains the software configuration (operating system, application server, and applications) required to easily and quickly launch your instance that is pre-configured with their desired operating system and application stack, saving significant time and effort in configuring and deploying new instances. <br><br><br>


**- Select an instance type and a key pair.** 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/49o9vu2vlkfgrwofp1cs.png)

NB: [Read for more](https://dev.to/oyohedmond/amazon-ec2-basics-11ik) <br><br><br>


**- Select create new key pair.** 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g8c8fkpv6xpo42byv4r2.png) <br><br><br>


A key pair is a set of security credentials that are used to securely authenticate a user's login credentials to an EC2 instance. 

It consists of two parts: a public key and a private key. The public key is shared with the instance, while the private key is kept secure by the user. <br><br><br>


**- Enter Key pair name.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vchpokghf59xlr946znm.png) <br><br><br>

AWS key pairs can be downloaded in **.pem or .ppk formats**.
The **.pem format** is commonly used with SSH clients on Unix/Linux systems.
The **.ppk file format ** is a proprietary format used by PuTTY, a popular SSH client for Windows.

It is important to keep your private keys secure and should not be shared with others as anyone with access to your private key can gain access to your instance.

**Key pair types**
RSA encryption works for both windows and MacOs/Linux instances. ED25519 keys work with Linux and Mac instances only.' <br><br><br>


**- Enter your preferred network settings.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cnz26twa4dwhc7qtdt8o.png) <br><br><br>

Your network settings include **setting your VPC (Virtual Private Cloud)** which is a virtual network infrastructure provided by AWS that allows users to launch resources in a logically isolated section of the AWS Cloud.

Your VPC enables you to create your own IP address ranges, subnets, route tables, security groups, etc.

AWS assigns a default VPC to every account, we'll use the default VPC and create a new security group that only allows SSH access to the instance. <br><br><br>


_**Select Allow HTTPS traffic from the internet
Select Allow HTTP traffic from the internet to allow access to the EC2 webpage.**_ <br><br><br>


**- Select the number of instances you want to create and review your selection, then click launch instance.**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k524wlsauz0yjx4tzwgd.png)<br><br>

**- The instance is running and has passed the checks**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gq87kj65tcfnpyk47s5i.png)<br><br><br>


**Conclusion**
In this article, we discussed how to create an EC2 instance on AWS.

We covered the basic steps involved in launching an EC2 instance, including selecting an Amazon Machine Image (AMI), choosing an instance type, configuring security settings, and creating a key pair to connect to the instance.

We also discussed some important concepts related to EC2 instances, such as instance types, key pairs, and the free tier offering. Additionally, we provided a brief overview of VPCs and their importance in creating a secure and isolated environment in the cloud.

If you are new to AWS or cloud computing, creating an EC2 instance can be a great way to get started and learn about the benefits of cloud computing.

So, if you're interested in trying it out for yourself, sign up for an AWS account and launch your own EC2 instance today.