Chapter 5: Amazon EC2 (Elastic Compute Cloud)
5.1 Why EC2? Cloud vs on-premises
Mitranno, let's first understand why EC2 exists at all. Imagine your college wants to host a result portal. The traditional on-premises way: buy servers (₹2–5 lakh each), a UPS, air-conditioning, network switches, a server room, hire an admin, wait weeks for delivery, and still the site crashes on result day when lakhs of students log in together.
With cloud computing, you rent compute power over the internet and pay only for what you use.
| Point | On-premises | AWS EC2 (cloud) |
|---|---|---|
| Upfront cost | High capital expense (CapEx) | Zero upfront; pay-as-you-go (OpEx) |
| Time to get a server | Weeks | Minutes |
| Scaling | Buy more hardware; slow | Launch more / bigger instances in minutes; Auto Scaling |
| Maintenance | You handle hardware, power, cooling | AWS handles physical infrastructure |
| Availability | One building; single point of failure | Multiple Availability Zones and Regions |
| Global reach | Hard | Deploy in any AWS Region worldwide |
| Security | Fully your responsibility | Shared responsibility: AWS secures the cloud, you secure what is in the cloud |
Cloud service models: IaaS (you manage OS and above — EC2), PaaS (you manage only code — Elastic Beanstalk), SaaS (you just use the software — Gmail). EC2 is IaaS.
Shared responsibility model
AWS is responsible for the data centres, hardware, hypervisor and global network. You are responsible for the guest OS (updates, patches), security group rules, users and keys, applications and data. A hacked EC2 because of an open port 22 with a weak password is your responsibility.