Service models: IaaS, PaaS, SaaS, FaaS
- IaaS
- infrastructure as a service
- PaaS
- platform as a service
- SaaS
- software as a service
- FaaS
- function as a service
Junior Always asked 8 min
On this page
The question
What is the difference between IaaS, PaaS, SaaS and serverless?
30-second answer
They differ in how much of the stack the provider runs. With IaaS you rent virtual machines, networks and disks, and you install, patch and scale everything on them. With PaaS you hand over your app, a jar or an image, and the platform runs the OS (operating system), runtime and instances. With SaaS you use finished software and manage only your data and users. Serverless, or FaaS, runs your code per event, scales to zero and bills per call. More provider work means less control and more lock-in.
Understand it
Who manages each layer
ExploreIaaS: the provider runs the facility, servers and virtualization. You rent a virtual machine and install, patch and scale everything on it.
View as text
A stack of eight layers, from the top: Data and access, Application code, Scaling, Runtime (JVM), Operating system, Virtualization, Servers and storage, Network and facility. Each row says who manages it, you, the provider or both, for the chosen service model, with example products above the stack.
On-premises: you buy the servers, run the data center and patch everything from the network up to the app. Full control, and all of the work. Examples: Your own data center. You run all 8 layers.
IaaS: the provider runs the facility, servers and virtualization. You rent a virtual machine and install, patch and scale everything on it. Examples: EC2, Azure VMs, Compute Engine. You run 5 of 8 layers alone.
PaaS: you hand over the jar or image and set scaling rules. The platform patches the OS and runtime and runs the instances. Examples: Elastic Beanstalk, App Service. You run 2 of 8 layers alone.
FaaS: you write functions. The platform runs one copy per concurrent event, scales to zero and bills per call, so scaling is no longer yours. Examples: Lambda, Azure Functions. You run 2 of 8 layers alone.
SaaS: you use finished software, such as email or a code host. You still own your data and decide who can reach it. Examples: Gmail, Microsoft 365, GitHub. You run 1 of 8 layers alone.
A stack of eight layers, from the top: Data and access, Application code, Scaling, Runtime (JVM), Operating system, Virtualization, Servers and storage, Network and facility. Each row says who manages it, you, the provider or both, for the chosen service model, with example products above the stack.
On-premises: you buy the servers, run the data center and patch everything from the network up to the app. Full control, and all of the work. Examples: Your own data center. You run all 8 layers.
IaaS: the provider runs the facility, servers and virtualization. You rent a virtual machine and install, patch and scale everything on it. Examples: EC2, Azure VMs, Compute Engine. You run 5 of 8 layers alone.
PaaS: you hand over the jar or image and set scaling rules. The platform patches the OS and runtime and runs the instances. Examples: Elastic Beanstalk, App Service. You run 2 of 8 layers alone.
FaaS: you write functions. The platform runs one copy per concurrent event, scales to zero and bills per call, so scaling is no longer yours. Examples: Lambda, Azure Functions. You run 2 of 8 layers alone.
SaaS: you use finished software, such as email or a code host. You still own your data and decide who can reach it. Examples: Gmail, Microsoft 365, GitHub. You run 1 of 8 layers alone.
Takeaway: Each step from on-premises to SaaS hands more of the stack to the provider: less control, less work. Whatever the model, your data and who can access it stay yours.
Shared responsibility: who secures what
Tap the partsSelect a part to see what it does.
Tap a part. The left column is the provider’s security of the cloud; the right column is yours, security in the cloud.
View as text
Two columns. The left one, the provider, holds security of the cloud: facilities, hardware, the hypervisor and the engines of managed services. The right one, the customer, holds security in the cloud: identities, data, firewall rules and the guest operating system on IaaS. The split moves up as the service model moves from IaaS to SaaS, but identities and data never leave the customer's side.
Facilities: Data centers, guards, power and cooling are always the provider’s.
Hardware: Servers, disks and the network between them.
Hypervisor: The virtualization layer that keeps your virtual machines apart from other customers’ on the same host.
DB engine: On a managed database, such as managed PostgreSQL, the provider patches the engine and its OS.
Identities: Who can do what: users, roles, policies and access keys.
Data: Your data is always yours to protect: classify it, encrypt it at rest and in transit, choose who holds the keys, back it up.
Firewall: Network rules: which ports are open, which subnets are public, which addresses may connect.
Guest OS: On IaaS you patch the guest operating system, the JVM and every library.
Two columns. The left one, the provider, holds security of the cloud: facilities, hardware, the hypervisor and the engines of managed services. The right one, the customer, holds security in the cloud: identities, data, firewall rules and the guest operating system on IaaS. The split moves up as the service model moves from IaaS to SaaS, but identities and data never leave the customer's side.
Facilities: Data centers, guards, power and cooling are always the provider’s.
Hardware: Servers, disks and the network between them.
Hypervisor: The virtualization layer that keeps your virtual machines apart from other customers’ on the same host.
DB engine: On a managed database, such as managed PostgreSQL, the provider patches the engine and its OS.
Identities: Who can do what: users, roles, policies and access keys.
Data: Your data is always yours to protect: classify it, encrypt it at rest and in transit, choose who holds the keys, back it up.
Firewall: Network rules: which ports are open, which subnets are public, which addresses may connect.
Guest OS: On IaaS you patch the guest operating system, the JVM and every library.
Takeaway: The provider secures the cloud itself: buildings, hardware, the hypervisor and managed services. You secure what you put in it: identities, data, network rules and, on IaaS, the guest OS.
| Model | AWS (Amazon Web Services) | Azure | GCP (Google Cloud Platform) |
|---|---|---|---|
| IaaS: virtual machines | EC2 (Elastic Compute Cloud) | Virtual Machines | Compute Engine |
| PaaS: run my app | Elastic Beanstalk | App Service | App Engine |
| FaaS: run my function | Lambda | Azure Functions | Cloud Run functions |
| SaaS: finished software | Amazon WorkMail | Microsoft 365 | Google Workspace |
In code
# On a fresh Amazon Linux 2023 VM: everything above the hypervisor is your job
sudo dnf -y upgrade # OS patches, every week, forever
sudo dnf -y install java-21-amazon-corretto-headless
sudo useradd --system orders
sudo install -D -o orders orders.jar /opt/orders/orders.jar
sudo tee /etc/systemd/system/orders.service >/dev/null <<'EOF'
[Unit]
Description=orders
[Service]
User=orders
ExecStart=/usr/bin/java -XX:MaxRAMPercentage=75 -jar /opt/orders/orders.jar
Restart=always
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable --now orders # restarts a crashed JVM; a dead VM is still yours to replace# app.yaml, deployed with: gcloud app deploy target/orders.jar
runtime: java21
instance_class: F2
entrypoint: java -XX:MaxRAMPercentage=75 -jar orders.jar
automatic_scaling: # you set the rules; the platform adds and removes instances
min_instances: 1
max_instances: 10
target_cpu_utilization: 0.65
env_variables:
SPRING_PROFILES_ACTIVE: prodpublic class OrderPlacedHandler implements RequestHandler<Map<String, Object>, String> {
// Static fields live as long as the execution environment: read once on a cold start, reused while warm
private static final String TABLE = System.getenv("ORDERS_TABLE");
@Override
public String handleRequest(Map<String, Object> event, Context context) {
String orderId = String.valueOf(event.get("orderId"));
context.getLogger().log("order placed: " + orderId + " in " + TABLE);
// Keep no state between calls: the next event may land on another copy
return "ok:" + orderId;
}
}# Shared responsibility: a public bucket is a customer mistake, in every service model
Wrong aws s3api put-bucket-acl --bucket acme-invoices --acl public-read
# Block every form of public access on the bucket instead, and share single files with presigned URLs
Right aws s3api put-public-access-block --bucket acme-invoices \
Right --public-access-block-configuration \
Right BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=trueSolve it
Who fixes it? Three incidents under shared responsibility
A Spring Boot service runs on IaaS virtual machines and stores invoices in object storage. In one month: a physical host fails and the VM on it dies; a scanner reports a CVE (Common Vulnerabilities and Exposures entry) in the VM’s OpenSSL; and a customer finds another customer’s invoice through a public bucket link. For each, say who must act, and what changes if the service moves to PaaS.
- Draw the line first. The provider secures the cloud: facilities, hardware, hypervisor and managed service engines. The customer secures what runs in it: identities, data, network rules and, on IaaS, the guest OS and everything above it.
- Host failure: the provider replaces the hardware, you recover the service. The provider owns the host, but nothing restarts your VM elsewhere unless you built for it: an instance group across two zones, health checks and stateless nodes.
- OpenSSL in the guest OS: yours on IaaS. Patch the image and roll the instances. On PaaS the platform patches the OS and runtime, but a vulnerable library inside your jar, such as an old Jackson, stays yours in every model.
- Public invoices: always yours. The storage service did its job; the bucket’s access settings were yours. Block public access, rotate the leaked links, and share single files with short-lived presigned URLs instead.
- Check. For each incident, name the layer in the stack and the side of the line. Data and access stay yours from IaaS to SaaS; only the OS and runtime row moves when you change models.
# 3: patch the guest OS on each VM, one zone at a time (or bake a patched image and roll the group)
sudo dnf -y upgrade openssl && sudo systemctl restart orders
# 4: no more public objects, and a 15-minute link for the one invoice a customer asks for
aws s3api put-public-access-block --bucket acme-invoices \
--public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
aws s3 presign s3://acme-invoices/2026/11/inv-1042.pdf --expires-in 900How to answer
- Draw the stack, from network to data, and show where each model draws the line.
- IaaS gives the most control and the most operations; SaaS the least of both.
- Serverless means no servers to manage and pay per use, not no servers at all.
- Data and access are the customer's in every model.
- Name one product per model, such as EC2 (Elastic Compute Cloud), App Service, Lambda and Microsoft 365.
Common mistakes
- Calling every managed service SaaS, or describing a virtual machine as PaaS.
- Saying that in SaaS the provider is responsible for who can access your data.
Follow-up questions
What does serverless really mean? Is it only functions?
Serverless means you never manage, size or patch servers: the platform allocates capacity per request, scales to zero when idle and bills for actual use. Functions, such as AWS (Amazon Web Services) Lambda, are the best-known kind, but serverless containers such as Cloud Run, serverless databases such as DynamoDB or Aurora Serverless, and managed queues follow the same model. The servers exist; they are simply the provider's.
- Scale to zero and pay per use are the defining traits.
- Limits come with it, such as cold starts, execution time caps and vendor-specific events.
- Best for spiky or event-driven work; steady high load is often cheaper on containers.
A team of four must ship a Spring Boot API in a month. Which service model would you pick?
A managed platform: PaaS or serverless containers, such as App Service, Cloud Run or Elastic Beanstalk, with a managed database. Four people cannot also run patching, scaling and monitoring for virtual machines, and the platform gives health checks, rolling deploys and autoscaling for free. I would move down to IaaS only for a hard need: special hardware, an OS-level agent, or a cost at scale that a platform cannot match.
- Start from the team's operational capacity, not from maximum control.
- Package the app as a container image, so moving between platforms stays cheap.
- Revisit the choice when load, cost or compliance needs change.
Moving up the stack reduces operations but increases lock-in. How do you limit lock-in?
Keep the expensive-to-move parts portable and accept lock-in where it pays. Package services as standard container images, use open protocols and engines, such as PostgreSQL, Kafka and OpenTelemetry, and keep provider SDKs (software development kits) behind your own interfaces, as in hexagonal architecture. Write the infrastructure as code. Then a managed queue or function is a contained choice: the business logic does not know which cloud runs it.
- Lock-in is a cost to weigh, not a rule to avoid every managed service.
- Data gravity, egress fees and identity integration lock you in more than compute does.
- Multi-cloud for its own sake usually doubles the work and keeps the weakest common features.
A critical OpenSSL vulnerability is published. Who patches it on IaaS, on PaaS and on SaaS?
It depends on where OpenSSL lives. On IaaS the guest OS is yours: you patch the image and roll the instances. On PaaS or FaaS the platform patches the OS and runtime it provides, often without you doing anything. On SaaS the provider patches everything. But a copy bundled inside your own artifact, such as in a container image or a jar, is yours in every model, so you still rebuild and redeploy.
- Find the layer first, then the owner.
- Container images carry their own OS libraries, so you patch them even on managed platforms.
- Automate it with image scanning and regular rebuilds.
See it in the infographic: Shared responsibility: who secures what
Where do managed containers and managed Kubernetes fit?
Between IaaS and PaaS, sometimes called CaaS (containers as a service). You ship an image instead of a jar, so you own the OS libraries and JVM (Java Virtual Machine) inside it, while the provider runs the hosts and, for managed Kubernetes, the control plane. Serverless containers such as Cloud Run or Fargate sit closer to PaaS: no nodes to manage at all.
Is a managed database such as Amazon RDS (Relational Database Service) IaaS, PaaS or SaaS?
PaaS, in the sense of the stack: the provider runs the hardware, OS and database engine, patches and backups, and you manage the schema, the data, the users and the network access. Many people call it a managed service, or DBaaS for database as a service; the useful answer names what you still own, not the label.
Check yourself
Show answers
- The provider: Correct. On PaaS the platform runs and patches the OS and runtime.
- You, as on IaaS: Incorrect. That is IaaS, where the guest OS is yours.
- Nobody; managed platforms have no operating system: Incorrect. Every app runs on an OS; on PaaS it is simply not yours.
Show answers
- The customer's, who configured access to the bucket: Correct. Access to your data is always on the customer's side of the line.
- The provider's, who runs the storage service: Incorrect. The service worked as configured; security of the cloud held.
- Both equally, since storage is a shared layer: Incorrect. The provider runs the service; who may read your objects is yours.
Show answers
- FaaS, which scales to zero and bills per call: Correct. Idle time costs nothing; you pay per invocation.
- IaaS, with a small virtual machine: Incorrect. A virtual machine bills every hour it runs, idle or not.
- On-premises, on an existing server: Incorrect. The server, power and staff cost money whether it is called or not.