Cloud Basics
What is Cloud Computing?
Cloud computing is the on-demand delivery of computing resources like servers, storage, databases, networking, and software over the internet with pay-as-you-go pricing.
Why Cloud?
- No upfront infrastructure cost
- Scale when traffic spikes
- High availability by default
- Faster deployment
Key Concept:
You rent computing power instead of buying and maintaining physical servers.
What are the service models: IaaS, PaaS, SaaS?
Cloud services are offered at three levels of abstraction:
IaaS (Infrastructure as a Service)
- You rent virtual machines, storage, networks
- You manage: OS, runtime, applications
- Examples: AWS EC2, Azure VMs, Google Compute Engine
PaaS (Platform as a Service)
- You deploy applications
- Platform manages: OS, runtime, scaling
- Examples: AWS Elastic Beanstalk, Google App Engine, Heroku
SaaS (Software as a Service)
- You use complete applications
- Everything is managed for you
- Examples: Gmail, Salesforce, Office 365, Dropbox
Rule of thumb: IaaS = most control, SaaS = least control. More control = more responsibility.
Cloud vs On-Premise
| On-Premise | Cloud |
|---|---|
| High CAPEX | Low CAPEX |
| Manual scaling | Auto scaling |
| Maintenance headache | Managed services |
| Limited availability | Multi-region HA |
| Slow provisioning | Instant provisioning |
When to use on-premise:
- Strict regulatory requirements
- Legacy systems that can't migrate
- Extremely predictable workloads
Cloud Deployment Models: Public, Private, Hybrid, Multi-Cloud
Public Cloud
- Shared infrastructure
- Cost-effective
- Scalable
- Examples: AWS, Azure, GCP
Private Cloud
- Dedicated resources
- More control
- Higher cost
- Examples: VMware, OpenStack
Hybrid Cloud
- On-prem + public cloud
- Common in enterprises
- Flexibility in data placement
Multi-Cloud
- Multiple cloud providers
- Avoid vendor lock-in
- Complex networking and monitoring
Advantages and Disadvantages of Cloud
Advantages:
- Cost efficiency – Pay only for what you use
- Scalability – Handle traffic spikes automatically
- Global reach – Deploy in multiple regions
- Speed – Provision resources in minutes
- Reliability – Built-in redundancy and backups
- Security – Enterprise-grade security by default
Disadvantages:
- Vendor lock-in – Hard to switch providers
- Downtime – You depend on cloud provider's uptime
- Limited control – Less control than on-premise
- Compliance – May not meet all regulatory requirements
- Cost unpredictability – Bills can spike if not monitored
What is Virtualization?
Virtualization means running multiple virtual machines on one physical machine using a hypervisor.
Hypervisor Types:
Type 1 (Bare Metal)
- Runs directly on hardware
- Used in production
- Examples: VMware ESXi, Hyper-V, KVM
Type 2 (Hosted)
- Runs on host OS
- Used for testing
- Examples: VirtualBox, VMware Workstation
Why virtualization matters:
- Better hardware utilization
- Isolation
- Scalability
Virtualization is the foundation of cloud computing. Without it, cloud wouldn't exist.
Containers vs Virtual Machines
Virtual Machines
- Each VM has its own OS
- Heavy
- Slower boot time
- More isolation
Containers
- Share host OS kernel
- Lightweight
- Faster startup
- Better resource utilization
Interview line:
👉 Containers solve deployment consistency, not security by default.
When to use what:
- VMs: Need different OS, strong isolation, legacy apps
- Containers: Microservices, fast deployment, resource efficiency
Scalability vs Elasticity (Asked Constantly)
Scalability
Ability to increase capacity.
- Vertical: Bigger machine (scale up)
- Horizontal: More machines (scale out) – preferred
Elasticity
Ability to automatically scale based on real-time demand.
- Responds to traffic changes
- Scales up when needed, scales down when idle
- Cost optimization
Key Difference:
Scalability = capacity. Elasticity = automatic + dynamic.
High Availability vs Fault Tolerance
High Availability
- System minimizes downtime
- Uses redundancy
- Example: Multiple instances behind a load balancer
- 99.9% uptime
Fault Tolerance
- System continues working even when components fail
- More expensive
- Used in mission-critical systems
- Example: Active-active replication across regions
| High Availability | Fault Tolerance |
|---|---|
| Minimizes downtime | Zero downtime |
| Acceptable brief outages | No outages |
| Cost-effective | Expensive |