Getting Started with EC2: A Beginner's Guide to Launching Your First Cloud Instance.
Tags: beginners, devops, aws, learning
Published: 2024-02-20 08:47:34



Amazon Elastic Compute Cloud (EC2) is a highly scalable and versatile cloud computing service provided by Amazon Web Services (AWS). EC2 allows you to launch and manage virtual servers, known as instances, in the AWS cloud. In this blog post, we will walk you through the step-by-step process of creating an EC2 instance, enabling you to set up and configure your own virtual server within the AWS ecosystem.


##Prerequisites:
Before we begin, ensure that you have the following prerequisites:


1. An active AWS account.
2. Familiarity with the AWS Management Console.
3. Basic understanding of networking concepts and security groups.



## Accessing the EC2 Dashboard:

Log in to the AWS Management Console.
Navigate to the EC2 service by clicking on "Services" and selecting "EC2" from the list of services or you could type EC2 in the search bar, here select EC2 from the options provided.


![AWS ec2 creation page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8nsyr042wv37znhjsydu.png)


![AWS EC2 creation 2nd stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ep1anwwd0qzlge9cpt4.png)


On the EC2 dashboard, click the "Launch Instance" button to initiate the instance creation process.


![AWS EC2 creation 3rd stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfqxrjuol52rc0hzie73.png)


Give your EC2 a name, give it a unique name to help you differentiate your instances.


![AWS EC2 creation 4th stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u0lfbom1d35zbxcgm3xf.png)

Choose an Amazon Machine Image (AMI) based on your requirements. This serves as the operating system for your instance, here we have selected Ubuntu under the free tier eligible. 

when you register an account with AWS for the first year you are allowed access to some services for free this is one of those services.


![AWS EC2 creation 5th stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jnmkxus1pzil9zu7om4d.png)

Select an instance type that aligns with your desired computing resources, such as CPU, memory, and storage capacity, for the purpose of writing this blog I would stick to the free tier t2 micro.


![AWS EC2 creation 6th stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hqv7mindc44d6qpshjrg.png)


## Create New Key Pair :
Select an existing key pair or create a new one. A key pair is necessary to securely access your EC2 instance using Secure Shell (SSH).

If creating a new key pair, follow the instructions to generate and download the private key file (.pem). Keep this file in a secure location.

I will be creating a new key pair to demonstrate how it is done.

![AWS EC2 creation 7th stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y40e8qjw4fwksmtml0rc.png)


Click on create new key Pair.

![AWS EC2 creation 8th stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0rg01uunytznzmwgeutr.png)

First, you give your key pair a name, and you select the key pair type.

In this blog, we would not be going into the details of the difference between the two key pair types available but we would go with the RSA key pair type.

click on Create key pair to continue, this automatically creates a key pair and downloads a pem file into your downloads.

![AWS EC2 creation 9th stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jtnekt0912dt31tq99oi.png)

We now have a key pair.

![AWS EC2 creation 10th stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/risidmd8s8dgi9nklltw.png)


## Network Setting:
Network Settings for this blog we would leave it as the default, AWS provides every account on the AWS platform with default VPC settings so we would work with that.

![AWS EC2 creation 11th stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o2806q4nt4ipop8cuf8r.png)


## Configure Security group(firewall)

Configure security groups to control inbound and outbound traffic for your instance.

We would create a new security group for this EC3 instance we are creating

we would allow port 22 which allows secured traffic via SSH also HTTPS connections which use TCP port 443 and HTTP, the unsecured protocol, uses port 80 these are all inbound rules.

![AWS EC2 creation 12th stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1dnod6ft5rd0ssp4n3xj.png)


## Other Configurations :

We would go ahead to configure other instance details, including the number of instances, and storage options. for the purpose of this blog, we would leave the number of instances at one and for the storage option, we would also leave it as default.

Review the instance configuration and make any necessary adjustments.

If creating a new key pair, follow the instructions to generate and download the private key file (.pem). Keep this file in a secure location.

Once you have reviewed the instance details, click "Launch" to initiate the creation of your EC2 instance.

##EC2 Dashboard:

The instance creation process will commence. You can monitor the progress and view the instance status on the EC2 dashboard.

![AWS EC2 creation 13th stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r3h79bu1b3h1sn3s2ycu.png)


After initialization, you check if your instance is healthy by confirming that you have 2/2 checked and passed.

![AWS EC2 creation final stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c59kyhyuyvmo27cs9dez.png)


## Conclusion:
Congratulations! You have successfully created an EC2 instance on AWS. 

By following the comprehensive steps outlined in this guide, you have gained the knowledge to launch and configure your own virtual server within the AWS cloud. 

Remember to monitor and manage your instances using the EC2 dashboard, and explore additional AWS services to enhance the functionality and scalability of your EC2 instances.

We hope this comprehensive guide has provided you with a clear understanding of the process involved in creating an AWS EC2 instance. 

Embrace the power of EC2 to meet your computing requirements in the cloud, and unlock the potential of AWS for your business needs. Happy cloud computing!