DEV Community

Cover image for How To Create and Connect To Your First AWS EC2 Instance: A Beginners Guide
Marvelous Osondu
Marvelous Osondu

Posted on

How To Create and Connect To Your First AWS EC2 Instance: A Beginners Guide

Introduction:

In today’s time and age, cloud technology has become the backbone of numerous industries. From startups to multinational corporations, nearly everyone has embraced the cloud to improve scalability, reduce costs, and enhance flexibility. This rapid adoption has changed how businesses operate, making it essential for professionals across all domains to understand the basic concepts of cloud computing.

Among the many services offered by Amazon Web Services (AWS), EC2 (Elastic Compute Cloud) is unarguably one of the most popular and versatile. EC2 provides scalable compute capacity in the cloud, enabling users to deploy virtual servers in minutes. Whether you're hosting a website, running complex apps, or experimenting with machine learning models, EC2 is a go-to solution for developers and organizations alike.

Learning how to create and manage an EC2 instance is a foundational skill for anyone working in tech today. In this guide, I’ll walk you through the process of launching your very first EC2 instance and connecting to it alike.

Prerequisites:

  • An account on AWS: You need an active AWS account to access the AWS Management Console. If you don’t already have one, sign up at AWS.

  • Basic understanding of cloud and EC2: Having a foundational understanding of cloud computing and what EC2 offers (virtual servers for scalable compute capacity) will help you make better decisions about configurations and settings.

  • Familiarity with the CLI and SSH: You should have some idea about interacting with the shell through the CLI and familiarity with Secure Shell (SSH) is also essential to connect to your instance securely.

  • Internet access: Ensure your system has internet access.

Getting Started

Let's now dive fully into the creation process.

Step 1: Log in to the AWS Management Console

Image description

Step 2: Navigate to the EC2 Dashboard

  • Search for EC2 in the search bar at the top and select EC2 under "Services."

Image description

Step 3: Launch an Instance

  • Click on the launch instance button

Image description

Step 4: Configure the Instance

  • Name and Tags: Enter a name for your instance (e.g., "My First EC2").
  • Application and OS Images (AMI): Select an Amazon Machine Image (AMI).

Image description

  • Instance Type: Choose an instance type based on your needs. For beginners select ( t2.micro ) - it's eligible for free tier

Image description

  • Key Pair: Create a new key pair (for secure SSH access) or use an existing one - Download the .pem file when creating a key pair (keep it secure).

  • Network Settings: Set up your security group - Add rules to allow traffic (e.g., SSH on port 22 for Linux or RDP on port 3389 for Windows).

Image description

  • Storage: Configure the instance's storage. Defaults are usually fine for Free Tier users (8 GiB SSD).

Step 5: Launch your Instance

  • Review your configuration.
  • Click Launch Instance.

Image description

Step 6: Access Your Instance

  • Go to the EC2 Dashboard and click Instances in the sidebar.
  • Find your instance and copy its Public IPv4 Address.
  • Connect to the instance: Use a terminal to run this command ssh -i "your-key.pem" ec2-user@your-public-ip Replace with your own details.

Once logged in, you can update the OS and Install software or deploy applications.

Top comments (0)