Skip to main content

Command Palette

Search for a command to run...

AWS EC2 (Elastic Compute Cloud)

Understanding the concept of virtual servers

Published
โ€ข4 min read
AWS EC2 (Elastic Compute Cloud)
R

Hi, I'm Rojarani Daasari. I'm a Devops Engineer with 2.9 years of experience in automated deployments, CI/CD Pipelines, cloud infrastructure and configuration management.

In this article, weโ€™ll understand all about EC2 instances in this day-2 of AWS Series.

If you are starting your AWS journey, EC2 (Elastic Compute Cloud) is one of the most important services you must understand.

By the end of this blog, you will:

  • Understand what EC2 is and why itโ€™s used

  • Learn regions & availability zones

  • Create an EC2 instance

  • Connect to it using SSH

  • Deploy your first application (Jenkins) on AWS

  • Access it from the internet ๐ŸŒ

๐Ÿ”น What is EC2?

  • EC2 stands for Elastic Compute Cloud
  • It provides virtual servers (virtual machines) on AWS cloud

  • When you launch an EC2 instance, AWS gives you combination of:

    • CPU

    • RAM

    • Storage

    • Network

This virtual server behaves just like a real physical server โ€” but without hardware headaches.

๐Ÿ”น Why is it called Elastic Compute Cloud?

  • Elastic โ†’ Can scale up/down (CPU, RAM, storage)

  • Cloud โ†’ Runs on AWS public cloud

  • Compute โ†’ Provides computing power (virtual server)

In short:
EC2 = Scalable virtual server on cloud.

EC2 vs Physical Servers:

Physical Servers:

โ†’ High upfront cost

โ†’ Manual maintenance

โ†’ Fixed capacity

โ†’ Difficult to manage

EC2:

โ†’ No upfront cost

โ†’ AWS manages infra

โ†’ Elastic scaling

โ†’ Easy & fast

๐Ÿ”น Why Should We Use EC2?

Before cloud, companies had to:

  • Buy physical servers

  • Maintain hardware

  • Handle failures

  • Pay full cost even when servers were idle

    With EC2:

    • No hardware purchase

    • No maintenance

    • Pay only when server runs

    • Stop instance โ†’ No compute charges

This is why companies prefer EC2 over traditional servers

No physical server management

No hardware purchase

No manual upgrades

AWS handles:

โ†’ hardware failure

โ†’ maintenance

โ†’ security patches

โ†’ Pay-as-you-go pricing

โ†’ Stop instance - No compute cost

โ†’ Start instance - Pay only when running

๐Ÿ”น Types of EC2 Instances:

AWS provides multiple EC2 types based on workloads:

  • General Purpose :

    โ†’ Balanced CPU, RAM, storage

    โ†’ Used for demos, web apps, learning

  • Compute Optimized :

    โ†’ CPU heavy workloads.

    โ†’ Gaming servers, ML workloads

  • Memory Optimized :

    โ†’ High RAM applications.

    โ†’ Big data, analytics

  • Storage Optimized:

    โ†’ Disk intensive app.

    โ†’ Databases, data warehousing.

  • Accelerated Computing:

    โ†’ GPU-based workloads.

    โ†’ AI, ML, graphics processing

๐Ÿ‘‰ Instance/instance type selection depends on application requirement, not random choice.

๐Ÿ”น AWS Regions & Availability Zones

Regions

Regions are geographical locations where AWS has data centers.
Example:

  • Mumbai

  • North Virginia

  • Frankfurt

Used for:

  • Low latency

  • Data compliance

  • Security requirements

  • Customer proximity

Availability Zones

Each region has multiple Availability Zones (AZs) (or) Multiple data centers inside a region.

Example:

  • us-east-1a

  • us-east-1b

Used for:

  • Independent data centers

  • Used for high availability

  • Protects against downtime

    ๐Ÿ‘‰ if one AZ fails โ†’ app still works

๐Ÿ”น Creating an EC2 Instance (Hands-On)

  1. Login to AWS Console

  2. Go to EC2 โ†’ Launch Instance

  3. Select OS (Ubuntu โ€“ Free Tier)

  4. Choose instance type: t2.micro

  5. Create or select Key Pair (Very Important)

    • Used for SSH login

    • Password login is disabled

    • Contains:

      • Public key (AWS)

      • Private key (.pem file โ€“ YOU)

    • Never share private key

  6. Keep default networking

  7. Launch instance ๐Ÿš€

    Specs:

    • 1 vCPU

    • 1 GB RAM

Limit:

  • 750 hours/month

๐Ÿ‘‰ Always stop instance after practice

๐Ÿ”น Connecting to EC2 Using SSH

chmod 600 aws-login.pem

ssh -i aws-login.pem ubuntu@<PUBLIC_IP>

Once connected, you are inside your cloud server.

๐Ÿ”น Deploying First Application on EC2 (Jenkins)

Update system

sudo apt update

Install Java

sudo apt install openjdk-11-jdk

Install Jenkins

sudo apt install jenkins

Verify Jenkins

sudo systemctl status jenkins

๐Ÿ”น Access Jenkins from Browser

  1. Open EC2 Security Group

  2. Allow inbound traffic on port 8080

  3. Open browser:

    http://<PUBLIC_IP>:8080

๐ŸŽ‰ Jenkins is live on AWS!

๐ŸŽฏ Final Thoughts

EC2 is the foundation of AWS compute services.
Once you master EC2, learning advanced services like Load Balancer, Auto Scaling, Kubernetes (EKS), CI/CD pipelines becomes much easier.

๐ŸŽ‰ First application deployed successfully!

AWS

Part 3 of 3

In this series, I'll add all concepts of aws cloud services from basic to advanced.

Start from the beginning

Introduction to AWS

A Beginnerโ€™s Guide to Cloud Computing with Amazon Web Services