IaaS Explained: A Hands-On Case Study with AWS EC2
Tags: cloud, aws, devops, beginners
If you've ever wondered where a website actually lives, the short answer is: on someone's computer. Not long ago, that meant your own. Companies bought servers, found room for them, and waited weeks for the hardware to show up before they could launch anything. Infrastructure as a Service (IaaS) flipped that. You rent the machines over the internet, pay for what you use, and get on with building.
I wanted to understand IaaS properly, not just recite the definition, so I used Amazon EC2 as my example. Here's what IaaS is, how it differs from the other cloud models, and how you can go from nothing to a live web server in about ten minutes.
So what is IaaS?
IaaS means a provider hands you the raw ingredients of IT infrastructure whenever you ask for them:
- Compute: virtual machines you can start and stop at will
- Storage: disks, object storage and file storage
- Networking: private networks, firewalls, load balancers and IP addresses
The provider looks after the physical side: buildings, power, cooling, hardware and the virtualization layer. Everything on top is yours. You pick the operating system, install what you need, and keep it patched.
IaaS, PaaS and SaaS: who looks after what?
These three terms get mixed up a lot. The simplest way to tell them apart is to ask, "Whose job is this layer?"
| Layer | On-premises | IaaS | PaaS | SaaS |
|---|---|---|---|---|
| Application | You | You | You | Provider |
| Runtime / middleware | You | You | Provider | Provider |
| Operating system | You | You | Provider | Provider |
| Virtualization, servers, storage, network | You | Provider | Provider | Provider |
With IaaS you get the most freedom, and the most homework. PaaS (think Heroku) takes the servers off your plate so you only push code. SaaS (think Gmail) is a finished product you just use.
Why people choose it
- No big upfront bill. You pay as you go instead of buying hardware.
- Scaling is quick. Traffic spike? Add servers in minutes, then remove them when it calms down.
- You can go global. Run your app in different regions without building a single data center.
- You stay in control. Operating system, network layout and software stack are your call.
- It's built for resilience. Spread your servers across availability zones and one failure won't take you down.
Case study: Amazon EC2
EC2 (Elastic Compute Cloud) is the core IaaS service on AWS. Before we launch anything, here are the pieces you'll bump into.
- Instances are the virtual servers themselves, in sizes from tiny to enormous (general purpose, memory heavy, GPU and so on).
- AMIs (Amazon Machine Images) are templates holding an operating system and any software you want preinstalled.
- EBS (Elastic Block Store) gives your instance persistent disks.
- VPC (Virtual Private Cloud) is your own private network, with subnets and routing.
- Security groups act as firewalls, deciding who can talk to your instance and on which ports.
- Key pairs are how you log in over SSH without a password.
Launching a web server, step by step
1. Launch an instance. In the EC2 console, click Launch instance, choose an Amazon Linux AMI, and pick a small type like t3.micro. Check whether your account qualifies for the free tier first.
2. Set up access. Create a key pair, then a security group that allows SSH (port 22) from your own IP only and HTTP (port 80) from anywhere. Locking SSH down to your IP is one of the best security habits you can form early.
3. Connect and install a web server.
ssh -i my-key.pem ec2-user@<public-ip>
sudo dnf install -y nginx
sudo systemctl enable --now nginx
4. Test it. Paste the instance's public IP into your browser. If you see the default Nginx welcome page, congratulations: you're running a real server on the internet.
5. Clean up. Stop or terminate the instance when you're done. Running resources keep billing, and forgetting about them is probably the most common beginner mistake in the cloud.
What happens when one server isn't enough
The same building blocks scale up without much new theory:
- Save your configured instance as an AMI.
- Put copies behind an Auto Scaling group, which also replaces any that fail.
- Add an Application Load Balancer in front to share out the traffic.
- Give your database its own home, either a managed service or an instance with a dedicated EBS volume.
That's what makes IaaS so powerful. Servers stop being precious things you nurture and become something you can create, copy and throw away.
How you pay
- On-Demand: billed by the second or hour with no commitment. Good for experiments and unpredictable workloads.
- Reserved Instances and Savings Plans: you commit for one or three years in return for a lower rate. Good for steady workloads.
- Spot Instances: spare capacity at a big discount, but AWS can take it back. Good for jobs that can handle interruptions.
Prices and options change, so check the AWS pricing page before you budget anything.
The catch
IaaS gives you control, but control comes with chores. Patching the OS, taking backups, monitoring and securing your apps are all on you. AWS calls this the shared responsibility model: they secure the cloud itself, and you secure what you put in it.
A few habits that will save you pain:
- Use IAM roles with the least access needed instead of sharing keys.
- Tag your resources and set a billing alert so there are no surprises.
- Write your infrastructure as code with Terraform or CloudFormation.
- Snapshot your EBS volumes regularly.
- Use more than one availability zone for anything that matters.
When IaaS is the right call
Go with IaaS when you need control over the operating system or network, when you're moving an existing app to the cloud with few changes ("lift and shift"), or when you run custom or legacy software. If you just want to ship code without thinking about servers, PaaS or serverless will probably suit you better.
Wrapping up
IaaS turns servers into something you can order on demand. With EC2 you pick an image, choose a size, set your network rules, and a few minutes later you have a working machine, plus the tools to scale it when you need to. The price of that freedom is more responsibility, so learn the security and cost basics early.
If you try the walkthrough, tell me how it went in the comments.
Top comments (0)