DEV Community

Cover image for How To Create an EC2 Instance on AWS
Sarah Aligbe
Sarah Aligbe

Posted on

How To Create an EC2 Instance on AWS

Introduction

For week 1 at She Code Africa Cloud School, we were required to write an article to document the process of creating an AWS EC2 instance.
An EC2 (Elastic Compute Cloud) instance is a virtual machine hosted on AWS that allows users run their applications.
EC2 instances are highly scalable, flexible, and customizable, allowing users to configure the instances to meet their specific needs. With EC2 instances, users can quickly launch new instances, change the instance type, increase or decrease storage capacity, and scale their applications up or down to meet changes in demand.

Pre-requisites

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

Creating an EC2 Instance

  1. Log into your AWS account, search EC2 in the search bar, and click on it.
    EC2 search

  2. In the EC2 dashboard select instances
    select instances

  3. Click Launch instances
    launch instance

  4. Give your instance a name
    instance name

  5. Select the appropriate AMI for your instance
    AMI
    An Amazon Machine Image (AMI) is a pre-configured virtual machine image that is used to create EC2 instances. It is a fundamental building block in the EC2 service as it enables users to easily and quickly launch an instance that is pre-configured with their desired operating system and application stack, saving significant time and effort in configuring and deploying new instances.
    We will be using the Ubuntu 20.04 AMI for this instance.

  6. Select an instance type and a key pair
    instance type and key pair
    An Instance type is a specification for the virtual hardware of an EC2 instance. It determines the amount of CPU, memory, storage, and networking capacity that an EC2 instance has.
    You can choose the instance type to use based on your specific workload.
    AWS offers certain instance types as part of its free tier such t2.micro and t3.micro.

    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.

    key pair

    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.

  7. Enter your preferred network settings
    network settings
    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.

  8. Select the number of instances you want to create and review your selection
    review

  9. Click launch instance
    successful

  10. The instance is running and has passed the checks
    running instance

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.

Top comments (1)

Collapse
 
chymee profile image
Amadi Chimeremma

good job