Learning objectives
After reading this article you will be able to:
- Understand what IaaS, PaaS and SaaS provide, with examples
- See in one table who is responsible for each layer in each model
- Pick the right model to host a bot, an API or a website
IaaS, PaaS and SaaS are the three acronyms that have split up cloud computing ever since NIST, the US standards institute, published the definition everyone quotes (SP 800-145). All three describe the same stack seen from different heights: how much of it, from the datacenter to the application, the provider delivers ready and how much stays with you.
If you host a bot, an API or a website, the real choice is usually between IaaS and PaaS. SaaS comes in as an alternative to building something, or as the product you sell yourself. This guide compares the three with a responsibility table and the same project built in each model.
What is each model?#
IaaS (infrastructure as a service) is renting basic computing resources: virtual machines, disks and networks. Per NIST, the customer can run any software, including the operating system, and controls the OS, storage, applications and some networking (a host firewall, for example), but not the underlying cloud infrastructure. A VPS is the simplest example.
PaaS (platform as a service) is an environment ready to run code. You publish applications written in the languages and tools the provider supports, and the provider maintains the network, servers, operating system and runtime. The full explanation is in what is PaaS.
SaaS (software as a service) is a finished application, used in the browser or through an API. The customer controls neither the infrastructure nor the app's features, only some usage settings. Email, CRMs and document editors are the usual examples.
The baseline for comparison is your own server (on-premises): you buy the hardware, pay for datacenter space and answer for every layer. Each cloud model takes part of that list off you.
Who is responsible for each layer?#
The table follows the shared responsibility model Microsoft publishes for its cloud, adapted to the layers that matter when you deploy. "Shared" means the provider supplies a baseline and you configure the rest.
| Layer | Own server | IaaS | PaaS | SaaS |
|---|---|---|---|---|
| Data, accounts and access | You | You | You | You |
| Configuration and secrets | You | You | You | You |
| Application code | You | You | You | Provider |
| Application dependencies | You | You | You | Provider |
| Runtime (Node.js, Python, JVM) | You | You | Provider | Provider |
| Operating system and patches | You | You | Provider | Provider |
| Network controls | You | You | Shared | Provider |
| Virtualization | You | Provider | Provider | Provider |
| Servers, physical network and datacenter | You | Provider | Provider | Provider |
Two rows never change: data and configuration. Even on SaaS, if someone deletes your records with a leaked password, that is your problem. Microsoft says the same: for every cloud deployment type, you own your data and identities.
The row that weighs most day to day is the operating system. It separates whoever has to apply security patches, reboot the server and configure the firewall from whoever only deploys. On a PaaS, the dependencies in your package.json or requirements.txt are still yours, even though the runtime comes from the provider.
What does the same project look like in each model?#
Take a Node.js API that uses a PostgreSQL database.
On IaaS, you create a virtual machine, install Node.js, a reverse proxy and a TLS certificate, set up the firewall and automatic OS updates, and decide whether the database runs on the same machine or another one. For the API to come back on its own after a crash or a reboot, you write a systemd service:
# /etc/systemd/system/api.service
[Unit]
Description=Node.js API
After=network.target
[Service]
User=api
WorkingDirectory=/srv/api
Environment=NODE_ENV=production
EnvironmentFile=/srv/api/.env
ExecStart=/usr/bin/node index.js
Restart=on-failure
[Install]
WantedBy=multi-user.targetThen sudo systemctl enable --now api starts the service now and on every boot. Restart=on-failure restarts the process when it exits with a non-zero code or is killed by a signal other than a normal stop, such as SIGKILL (what each code means is in exit code 137, 143 and 1). The OS, Node.js, the certificate and the firewall are yours to maintain.
On PaaS, you push the same code with package.json, set DATABASE_URL and the other secrets as environment variables, choose the memory and publish. The OS, runtime, proxy and TLS come from the platform. The code, the configuration and the decision on how much capacity to use remain yours.
On SaaS, you wouldn't publish the API at all. Swapping the project for a finished product makes sense when one already solves the problem: a signup form, a CRM, a scheduling tool. You trade control for zero code. The other way around, if your API is the product you sell, it is your customers' SaaS, and you pick IaaS or PaaS to host it (how to host a SaaS).
What are the benefits and costs of each?#
IaaS
- For: full control of the system; any software, port or version; a fixed price on a VPS.
- Against: you apply patches, configure the network and keep the process alive. The first deploy takes hours, and routine maintenance never ends.
PaaS
- For: deploys in minutes with no OS to administer; configuration in the environment; logs and restarts from the platform.
- Against: limited to the runtimes and ports the provider offers; no root access; features vary a lot from one platform to another.
SaaS
- For: nothing to host; updates and availability are the provider's job.
- Against: you use what the product offers; your data lives in the provider's format and location; switching tools can mean exporting and adapting everything.
On cost, none wins every time. A VPS has a fixed price but charges you in hours of work. PaaS plans tend to be predictable. IaaS on a public cloud bills by usage and needs someone watching the invoice. SaaS charges per user or by volume. Run the numbers on your real usage and add the time each model asks of you.
Where do serverless, containers and databases as a service fit?#
The three acronyms don't cover everything, and newer names fit between them:
- Serverless (FaaS): you hand over functions that run per event. Microsoft lists Azure Functions as PaaS, because you administer no machine or OS. The difference is in execution: functions have a duration limit and scale to zero, which doesn't work for a bot with a connection that stays open. See serverless vs containers.
- Containers: running Docker on a machine you administer is still IaaS. Handing an image to a service that runs it (CaaS) sits between IaaS and PaaS, because the system inside the image is yours. The difference from a virtual machine is in containers vs virtual machines.
- Database as a service (DBaaS): the provider delivers a database ready to connect to, and you answer for the schema, the queries and the data. It is the PaaS idea applied to databases.
Which model should you choose?#
- An ordinary bot, API or website in Node.js, Python, Go or Java: PaaS. It is the shortest path from code to live.
- Software with system dependencies, a UDP port, kernel tuning or a wish to learn server administration: IaaS, starting with a VPS. See VPS, cloud or hosting platform.
- Large scale with many coupled services (queues, private networks, fine-grained permissions): IaaS on a public cloud, with time set aside for configuration.
- A problem a finished product already solves (email, CRM, forms): SaaS. Writing and hosting your own only pays off if it is what sets you apart.
- A product you will sell as SaaS: host it on IaaS or PaaS, following the lines above.
Mixing is normal: a transactional email SaaS, the API on a PaaS and a heavy job on a virtual machine sit fine in the same project. The big picture, with public, private and hybrid clouds, is in what is cloud hosting.
How to do this on Square Cloud#
For hosting your own code, Square Cloud follows the platform model from the table: it is self-service hosting where you ship the code and control the deploy, scaling and configuration. Applications run in isolated containers, you pick the runtime (Node.js, Python, Go, Java and others, see Runtimes), and there is no root access, no Dockerfile and no custom image.
The rows the table leaves to you stay with you. Code arrives by ZIP upload in the dashboard, with the CLI, through GitHub or with the VS Code extension; the squarecloud.app file is optional: the dashboard generates it during the deploy, or you write it at the project root. Configuration lives in each application's environment variables, which apply on the next restart. Capacity is your call: you change each application's RAM in its settings or through the API. There is no autoscaling. For your data, there are manual snapshots on every plan and daily automatic application snapshots from Pro up.
See the full list in Square Cloud features.
Deploy
Push from GitHub, the CLI or a ZIP and go live in seconds
FAQs
What is the difference between IaaS, PaaS and SaaS in one sentence?
With IaaS you rent the machine and handle the OS upward; with PaaS you hand over code and the provider maintains the OS and runtime; with SaaS you just use a finished application.
Is a VPS IaaS?
Yes. A VPS gives you a virtual machine with an operating system and root access, and everything above it (packages, runtime, firewall, updates) is yours.
Are Gmail and Notion SaaS?
Yes. You use the application in the browser or the app, and the provider maintains the code and the infrastructure. Your part is the account, the data and the usage settings.
Where do serverless and containers fit in this classification?
Serverless functions are usually classified as PaaS, because you hand over only code. Running containers on a machine you administer is IaaS; handing an image to a service that runs it sits between IaaS and PaaS.
Does a SaaS run on IaaS or PaaS?
Almost always. Whoever builds a SaaS hosts the product on IaaS or PaaS and sells the finished application. For the end customer it is SaaS; for the company building it, it is hosting.
More in Deploy
See all 38 articles- What are environment variables?Environment variables are key-value pairs the operating system hands to a process at startup. Learn to read them in Node.js and Python and keep tokens out of code.
- What is a deployment?A deployment takes a version of your code to a server, prepares it and starts it. See the stages, the methods and how to roll back when it goes wrong.
- How much RAM and CPU does my app need?Size RAM and CPU by measuring your app's real peak and adding about 30% headroom. Learn how to measure in Node.js, Python and Java and what to do if short.
- How much does it cost to host a Node.js app?Hosting a Node.js app costs from nothing, with limits, to a few dollars a month. See what drives the price, how much RAM your app uses and how each option charges.