Labs ICT
Pro Login

EC2 Introduction

What is EC2?

EC2 stands for Elastic Compute Cloud. In plain English, it's a virtual computer in the sky. You can rent one, install an operating system on it, and use it like any physical server — except you don't have to buy hardware or deal with broken hard drives.

Think of EC2 like renting a car. You pick the model, the size, and how long you want it. When you're done, you return it and stop paying. No insurance, no parking, no mechanic needed.

Instance Types

AWS offers different instance types optimized for different workloads. General Purpose (t3, m5) are balanced all-rounders. Compute Optimized (c5) are great for number-crunching. Memory Optimized (r5) handle large datasets in RAM. Storage Optimized (i3) are built for fast local storage.

Each instance type has different sizes too — from nano (tiny) to metal (bare metal). The naming convention is straightforward: t3.micro means type t3, size micro. Pick what fits your workload and budget.

Amazon Machine Images (AMIs)

An AMI is like a template for your virtual computer. It comes pre-loaded with an operating system (like Ubuntu or Windows Server) and optionally with software already installed.

You can pick from hundreds of community AMIs or create your own. Think of AMIs as recipe cards — they tell AWS exactly what ingredients to put in your server when you launch it.

Key Pairs for Security

To connect to your EC2 instance, you need a key pair — a special file that acts like a digital password. AWS gives you the private key when you create the pair, and you use it to SSH into your instance.

Losing your private key is like losing your house key — you're locked out. Store it somewhere safe and never share it. If you do lose it, you'll need to create a new key pair and reconfigure your instance.

EC2 Pricing Models

On-Demand is pay-by-the-hour with no commitment. Reserved Instances give you a discount (up to 75%) if you commit to 1 or 3 years. Spot Instances let you bid on unused capacity for massive savings, but AWS can take them back with 2 minutes notice.

Savings Plans are a newer option that combines flexibility with discounts. For learning, stick with On-Demand or the free tier. For production, explore Reserved or Savings Plans to keep costs down.