How to Launch Amazon EC2 Linux Instance | Step-by-Step Process -2023

Mudasir
4 min readApr 17, 2023

--

What is Amazon EC2?

Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) Cloud. Using Amazon EC2 eliminates your need to invest in hardware upfront, so you can develop and deploy applications faster. You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage. Amazon EC2 enables you to scale up or down to handle changes in requirements or spikes in popularity, reducing your need to forecast traffic.

Source: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html

Why use AWS EC2?

  1. You don’t require any hardware units
  2. Easily scalable (up or down)
  3. You only pay for what you use
  4. You have complete control
  5. Highly secure
  6. You can access your assets from anywhere in the world

Prerequisites:

To create Linux EC2 Instance you need to have an AWS account, if not, you can create an account on AWS right now.

Steps To launch the EC2 instance:

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
    Note: Be sure to select the AWS Region that you want to launch the instance in, for me it is (N. Virginia) us-east-1.
  2. After you, login into the Amazon management console, open EC2 Dashboard, click on the Launch Instance drop-down list, and click on Launch Instance:

3. Once the Launch an instance window opens, provide the name of your EC2 Instance:

4. Choose the AMI. Here you see multiple AMI options for selection. AMI stands for Amazon Machine Image, which is basically the software and the operating system that you want to launch on the server, in my case I chose Ubuntu 22.04.

5. Choose an Instance Type. Here you can select the type of machine, number of vCPUs, and memory that you want to have. Select t2.micro which is free-tier eligible.

6. Select an already existing key pair or create a new key pair. Here, I will create a new key pair. Click on Create new key pair as shown below:

A new window will open, enter the Key pair name and click on Create key pair.

This key pair will allow you to access using SSH into the machine you just created. Create the key pair and download it, make sure to keep it safe as you will not be able to download it again.

7. Now under Network Settings, Choose the default VPC with Auto-assign public IP in enable mode. Create a new Security Group, provide a name for your security group, and allow ssh traffic, HTTPS, and HTTP from anywhere (later on we can modify the rules)

8. Select the amount of storage you want your instance to have, for the free tier, you can choose up to 30 GB of EBS. I’ll leave this to default and Click on “Launch Instance”

9. On the screen you can see a success message after the successful creation of the EC2 instance, click on Connect to instance button:

10. Now connect to instance wizard will open, go to SSH client tab and copy the provided chmod and SSH command:

11. Open the Command Prompt or PowerShell in your local machine and paste the following two commands and you will be able to access your EC2 machine:

To terminate your instance:

  1. In the navigation pane, choose Instances. In the list of instances, select the instance.
  2. Choose Instance state, Terminate instance.
  3. Choose Terminate when prompted for confirmation.
  4. Amazon EC2 shuts down and terminates your instance. After your instance is terminated, it remains visible on the console for a short while, and then the entry is automatically deleted. You cannot remove the terminated instance from the console display yourself.

Conclusion

In this blog, we learned how to launch and terminate Linux EC2 instance using an Amazon EC2 console.

If this blog helped you in any way do let me know in the comments section and please follow and click the clap 👏 button below to show your support 😄

Thanks

Mudasir

--

--

Mudasir

AWS Community Builder | DevOps Engineer | 3x AWS | 1x Azure | CCNP | Palo Alto | NSE 3 | Ansible | Terraform | Docker | Jenkins | Git