DEV Community

Cover image for Amazon EC2 – Instance Types & Sizing (Beginner-Friendly Notes)
Micheal Angelo
Micheal Angelo

Posted on

Amazon EC2 – Instance Types & Sizing (Beginner-Friendly Notes)

What Is Amazon EC2?

Amazon EC2 (Elastic Compute Cloud) is one of the most popular and core services provided by AWS.

EC2 provides Infrastructure as a Service (IaaS), which means:

  • AWS manages the physical data centers and hardware
  • You rent virtual machines and control the operating system, applications, and configuration

What EC2 Primarily Enables

Amazon EC2 mainly gives you the capability to:

  • Rent virtual machines → EC2 Instances
  • Store virtual disks → Elastic Block Store (EBS)
  • Distribute traffic across instances → Elastic Load Balancer (ELB)
  • Automatically scale resources → Auto Scaling Groups (ASG)

EC2 Sizing & Configuration Options

When launching an EC2 instance, you must make several configuration decisions.


1. Operating System (OS)

Common options include:

  • Linux (Amazon Linux, Ubuntu, RHEL, etc.)
  • Windows Server

2. Compute Power (CPU / vCPU)

  • vCPU stands for virtual CPU
  • A vCPU usually represents:
    • One physical CPU core or
    • One hyperthread of a physical core (depends on instance type)

Key idea:

More vCPUs allow better parallel processing and higher compute capacity.


3. Memory (RAM)

  • Measured in GiB (Gibibytes), not GB
  • Used for:
    • Running applications
    • Caching data
    • In-memory workloads

Key idea:

More RAM improves performance for memory-intensive applications.


4. Storage Options

EC2 supports two main storage models.


(a) Network-Attached Storage

Includes:

  • Elastic Block Store (EBS)
  • Elastic File System (EFS)

Characteristics:

  • Data persists even after instance stop or termination
  • Network-based storage
  • Slightly higher latency than local disks

(b) Hardware-Attached Storage (Instance Store)

Characteristics:

  • Physically attached to the host machine
  • Very high performance (often NVMe SSD)
  • Data is lost when the instance stops or terminates

Best suited for:

  • Temporary data
  • Caches
  • Buffers
  • Scratch space

5. Network Configuration

Includes:

  • Network bandwidth (NIC speed)
  • Public IPv4 address
  • Private IP address
  • VPC and subnet placement

6. Security

  • Security Groups act as virtual firewalls
  • They control:
    • Inbound traffic
    • Outbound traffic

Security Groups operate at the instance level.


7. Bootstrap Scripts (User Data)

  • EC2 User Data allows scripts to run at first launch
  • Common uses:
    • Installing packages
    • Configuring services
    • Automatically starting applications

Understanding EC2 Instance Types

EC2 instance types are compared based on:

  • vCPU count
  • Memory (GiB)
  • Storage type
  • Network performance
  • EBS bandwidth

How to Read Instance Type Names

Example: c5d.4xlarge

  • c → Compute-optimized family
  • 5 → Instance generation
  • d → Instance store (local NVMe storage included)
  • 4xlarge → Instance size

When to Use Which Instance Family

  • t-series → Burstable workloads (testing, small services)
  • c-series → CPU-intensive workloads (batch jobs, APIs)
  • m-series → Balanced, general-purpose workloads
  • r-series → Memory-intensive workloads (databases, caching)

Key Takeaways

  • EC2 is the backbone of compute services in AWS
  • Choosing the right instance depends on:
    • CPU requirements
    • Memory needs
    • Storage type
    • Network performance
  • Proper sizing helps avoid over-provisioning and unnecessary cost

References

Top comments (0)