How to create EC2 instace in AWS

How to create EC2 instace in AWS

In this tutorial, we will learn about how to create EC2 instances in AWS step by step.

So, let's get started...

What is AWS?

Amazon Web Services is very popular and reliable platform to host our application on top of their servers.There are many types of amazon’s services that we can use to host our app, but we will use EC2 (Elastic Compute Service). It is free and provides a very customized configuration during the creation process. We we create an instance: a set amount of resources initialized (OS, disk space, Ram, etc).

Why EC2?

Why EC2? Because it’s free and provide very customizable configurations to the end user. We can select our favourite Linux based operating system and install all the required utilities and software on that OS.

Step:1 Create an account on Aws

Go to and create a new account on AWS. If you are already registered on AWS then go to AWS console.

In the signup form, Choose personal account type, provide all the required information and fill the signup form.

An AWS new account lets you try the free tier of Amazon EC2, Amazon S3, and Amazon DynamoDb services for 12 months.

Step:2 Launch an EC2 instance

Now that the signup process is complete, go to aws console and provide login credentials. Once you are logged in you can see all the aws services under the AWS Services section.

Click on the EC2 Service under Computer Service,it will show us EC2 Dashboard page, on this page just click on Launch Instance button under Create Instance Section.

We have to choose Amazon Machine Image for launching our instance. Amazon provides various types of images, but we will stick with Ubuntu 18.04. It is more secure and 70 servers are using different versions of linux operating system.

Select Ubuntu 18.04 for image for our machine. After selecting the machine, we have to configure our machine (you can skip all these next steps and launch instance directly). Click on Next Add Storage button.

Select default storage configuration and click the Next Add Tags button.

Now, we can see the Add Tags page. In this section, we have to add at least single tag using key-value pairs. For example, you can add Key=ServerName and value=Nodejs_Server. After adding tag click on Next: Configure Security Group Button.

After adding these tags we have to open some ports of our server to communicate with outer world. We can also configure these ports after launching the server. Click on Add Tag button and add 80, 8080, and 22 ports.

Click on Next Review and Launch button.

Now we are very close to launching our EC2 server. Click on the Launch Button and we will see a dialog box. Create a new key pair and download it on your local machine. You can not generate this key after launching your instance.

Step:3 SSH into your instance

So we have successfully launched our EC2 server. Now we will access the server from our local machine using terminal on Linux and putty on Windows. If you are using Windows you need to change your .pem key to .ppk format. You can follow this link to convert your key. Go to your local directory where you downloaded the private key. Go to AWS instances console and click on the Connect button and follow the simple steps.

Congratulations! You're connected with your EC2 remote server.

After generating the key pair click on Launch Instances button.

1: Login to EC2 instace using SSH

Subscribe to our Newsletter

Stay up to date! Get all the latest posts delivered straight to your inbox.

If You Appreciate What We Do Here On TutsCoder, You Should Consider:

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

You might also like

Leave a Comment