In the previous lesson we described PaaS as "a platform that runs your code", and we used a web application service in the style of Azure App Service as our mental model. But under the PaaS label live very different services: platforms where you upload your application, databases you do not administer, services that run containers without you seeing a single server, and functions that only exist for the milliseconds they take to process an event. Each type distributes control, scaling and the bill differently, and a real application such as hortalia-shop usually combines several of them. In this lesson you will walk the spectrum that runs from IaaS to SaaS by way of containers, application platforms and functions; you will get to know the real services of each type; you will package Marc's store in a container with a Dockerfile, deploy it on Cloud Run and write a serverless function that resizes product photos. By the end you will have criteria for choosing the right type within PaaS.
- The spectrum of managed computing
In Comparing IaaS, PaaS, and SaaS we mentioned acronyms such as CaaS, DBaaS and FaaS. Now we put them in order. If we arrange the services by how much the provider manages and what the unit you hand over is, a continuous spectrum appears:
flowchart LR
I["IaaS<br/>You hand over: an OS image<br/>Unit: the VM"] --> C["CaaS<br/>You hand over: a container image<br/>Unit: the container"]
C --> P["Application PaaS<br/>You hand over: code or a package<br/>Unit: the application"]
P --> F["FaaS / serverless<br/>You hand over: a function<br/>Unit: the invocation"]
F --> S["SaaS<br/>You hand over: nothing, you just configure<br/>Unit: the user"]
| Point on the spectrum | What you control | What the provider manages | How it is typically billed |
|---|---|---|---|
| IaaS | OS, runtime, application | Hardware, virtualization | Per running VM (time) |
| CaaS | The container image (including the base OS and the runtime inside it) | Servers, orchestration, scaling | Per CPU/memory of the running container |
| Application PaaS | Code and platform settings | OS, runtime, web server, scaling | Per plan instance (time) |
| FaaS | The code of a function and its triggers | Everything else, including when an instance exists at all | Per invocation and per execution time |
| SaaS | Configuration and data | The whole application | Per user or per usage |
Managed databases are not a point on this axis but a cross-cutting category: they do not run your code, they hold your data. We will look at them in their own section.
Two observations before we go on:
- The boundaries are blurred. Cloud Run runs containers (CaaS) but scales by requests and down to zero like a serverless service; Azure App Service runs code and containers too. Classifying is there to help you reason, not to argue about labels.
- "Serverless" is not only FaaS. Today serverless is the name given to any service where you do not manage servers or capacity, it scales to zero and you pay per use: functions, but also serverless containers (Cloud Run, Azure Container Apps) and serverless databases.
- Application PaaS
This is "classic" PaaS, the one we described in Definition and Characteristics of PaaS: you upload code in a supported language and the platform builds it, runs it, scales it and exposes it over HTTPS.
| Service | Provider | Notable features |
|---|---|---|
| Azure App Service | Microsoft | Web apps and APIs on Linux or Windows (Python, Node.js, Java, .NET, PHP) or with your own container; tiered plans; slots; integration with Entra ID and virtual networks |
| AWS Elastic Beanstalk | Amazon | Orchestrates IaaS resources for you (EC2, load balancer, autoscaling group) from your code; you see and pay for those resources underneath |
| Google App Engine | One of the longest-standing PaaS offerings; the standard environment scales to zero for the supported runtimes | |
| Heroku | Salesforce | Pioneer of the git push deployment model; it no longer has a free plan (withdrawn in 2022); you pay per dyno |
| Render, Fly.io, Railway | Specialised companies | "Developer-focused" PaaS: minimal configuration, deployment from Git, simple pricing; fewer integrated services than the large providers |
One detail helps to understand the spectrum: Elastic Beanstalk is in fact an automation layer on top of IaaS. It creates EC2 machines that you can see in your account and that the platform maintains for you (including platform updates if you enable them). App Service, by contrast, hides the machines completely: all you see is the plan and its instances.
When it fits: web applications and APIs written in a standard language with more or less continuous traffic. It is the candidate type for the hortalia-shop prototype. The individual providers are compared in Popular PaaS Providers.
- Managed databases (DBaaS)
A managed database is a database engine (PostgreSQL, MySQL, SQL Server, Oracle, MongoDB...) that the provider installs, maintains and protects for you. You create databases, tables and users, and you connect with an ordinary connection string.
| Service | Provider | Engines |
|---|---|---|
| Azure Database for PostgreSQL – Flexible Server | Microsoft | PostgreSQL (there is also a MySQL variant) |
| Azure SQL Database | Microsoft | Managed SQL Server |
| Amazon RDS | Amazon | PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, Db2 |
| Amazon Aurora | Amazon | Its own engine compatible with PostgreSQL and MySQL, with distributed storage and a serverless mode |
| Cloud SQL | PostgreSQL, MySQL, SQL Server | |
| AlloyDB | PostgreSQL-compatible engine aimed at high performance |
3.1 What the provider does and what it does not
Remember how Laura planned the SQL Server backups on the ERP VM: a full backup daily, the log every 30 minutes, immutable storage, restore tests. In a managed database, much of that work turns into settings:
| Task | On a VM (IaaS) | On a DBaaS |
|---|---|---|
| Installing and patching the OS and the engine | Customer | Provider, in a maintenance window the customer can choose |
| Automatic backups and point-in-time restore | The customer designs and schedules them | The provider takes them; the customer chooses the retention (on PostgreSQL Flexible Server, from 7 to 35 days) |
| High availability with a standby replica and automatic failover | The customer builds a cluster | Provider, by enabling an option (at an extra cost: you pay for the replica) |
| Read replicas | The customer configures them | Provider, with one command |
| Schema design, indexes and slow queries | Customer | Customer |
| Size (vCPU, memory, storage) and its cost | Customer | Customer (the provider makes it easy to change) |
| Users, permissions and encryption of sensitive data | Customer | Customer |
| Network exposure (public or private) | Customer | Customer |
| Long-term retention and proof that backups restore | Customer | Customer (automatic backups cover weeks, not years) |
| Upgrading to a new major version (e.g. PostgreSQL 16 → 17) | Customer | The customer decides and tests; the provider supplies the tool |
For Marc, this means that the store's database no longer requires him to administer PostgreSQL, but it does require him to decide the size, the backup retention, whether to enable high availability, and that the database is only reachable from the private network, as we set out in Hortalia's responsibility matrix.
- Managed containers (CaaS) and the Kubernetes borderline
A container (we saw it in Virtualization and Data Centers) packages the application with its runtime and its libraries into an image that runs the same on Marc's laptop as in the cloud. Managed container services run those images without you administering the machines.
| Service | Provider | Notable features |
|---|---|---|
| Cloud Run | Runs HTTP containers (services), batch tasks (jobs) and functions; scales by concurrent requests and to zero; HTTPS URL included | |
| Azure Container Apps | Microsoft | Serverless containers built on Kubernetes without exposing it; scales by events (HTTP, queues...) and to zero; revisions and traffic splitting |
| AWS Fargate (with Amazon ECS) | Amazon | Serverless compute engine for containers: you define tasks and services in ECS and Fargate supplies the capacity, with no EC2 instances to manage |
4.1 Why containers and not an application PaaS?
- Freedom inside the image: if the store needed a system library that the platform does not ship (for example, a binary to generate PDFs), in a container you install it yourself. It solves the "no root" limitation we saw in the previous lesson.
- Portability: the same image runs on Cloud Run, Azure Container Apps, App Service (which also accepts containers) or a Kubernetes cluster. It reduces vendor lock-in.
- The price: the image includes a base OS and a runtime that are now yours. If the image starts from
python:3.12-slim, you are the one who has to rebuild it regularly to pick up the patches. A little of the responsibility PaaS took away comes back.
4.2 Managed Kubernetes: the borderline between IaaS and PaaS
Kubernetes is the industry-standard container orchestrator. The big three offer it managed: Azure Kubernetes Service (AKS), Amazon Elastic Kubernetes Service (EKS) and Google Kubernetes Engine (GKE).
| Aspect | What the provider manages | What is still yours |
|---|---|---|
| Control plane (the cluster's "head") | Yes: availability, patches, backup of its state | Choosing the version and planning the upgrades |
| Nodes (the VMs that run the containers) | Supplies the image and the upgrade tooling | In standard mode: size, number, upgrading and capacity of the node pools |
| Network, storage, ingress, security policies | Base components | Designing and configuring them |
| The applications | No | Manifests, images, scaling, secrets |
That is why it is considered the borderline between IaaS and PaaS: it takes the control plane off your hands, but it leaves you plenty of operations. The more automated modes (GKE Autopilot, EKS Auto Mode, AKS Automatic) push that borderline towards PaaS by managing the nodes as well. For a company like Hortalia, with one developer and an already overloaded IT manager, Kubernetes would be using a sledgehammer to crack a nut: it makes sense with many services and a dedicated platform team.
- Hortalia: the store in a container and on Cloud Run
Marc wants to see what the store would look like in containers, as an alternative to an application PaaS. He starts from the PaaS-ready app.py of the previous lesson and writes a Dockerfile:
# 1. Official Python base image, slim variant
FROM python:3.12-slim
# 2. Python settings for containers
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# 3. Working directory inside the image
WORKDIR /app
# 4. Dependencies first (this takes advantage of the layer cache)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 5. Then the code
COPY . .
# 6. Do not run as root
RUN useradd --create-home shop
USER shop
# 7. Default port and start-up command
ENV PORT=8080
CMD exec gunicorn --bind 0.0.0.0:$PORT --workers 2 --threads 4 --timeout 60 app:appExplanation, instruction by instruction:
FROM python:3.12-slim: the image starts from another, ready-made one, with a slimmed-down Debian and Python 3.12. This line is what makes the base OS Marc's responsibility: he has to rebuild the image when patches come out.ENV: defines environment variables inside the image.PYTHONDONTWRITEBYTECODE=1avoids creating unnecessary.pycfiles andPYTHONUNBUFFERED=1makes the logs come out of standard output immediately (without waiting to fill a buffer), which the platform needs in order to show them in time.WORKDIR /app: every following instruction runs in/app.COPY requirements.txt .andRUN pip install ...: copy only the list of dependencies and install them. Each instruction creates a layer; ifrequirements.txtdoes not change, Docker reuses the layer it already built and the build is much faster even when the code changes.--no-cache-diravoids storing pip's cache and keeps the size down.COPY . .: copies the rest of the project. It is worth pairing it with a.dockerignorefile that excludes.venv/,.git/and any file holding secrets.useraddandUSER shop: creates an unprivileged user and runs the application as that user. If somebody exploited a vulnerability in the store, they would not have administrator rights inside the container.ENV PORT=8080andCMD: Cloud Run tells each container which port to listen on through thePORTvariable (8080 by default).CMDstarts gunicorn listening on that port with 2 processes and 4 threads per process;--timeout 60cuts off requests that take longer than 60 s.execmakes gunicorn replace the shell and receive the platform's stop signals directly (disposability, from the twelve-factor app).
And the matching requirements.txt:
The ==3.1.* notation pins the major and minor version and accepts patch releases, a middle ground between pinning everything and pinning nothing. With the container ready, Marc deploys it on Cloud Run, in the Madrid region:
gcloud run deploy hortalia-shop \
--source . \
--region europe-southwest1 \
--allow-unauthenticated \
--min-instances 0 \
--max-instances 10 \
--concurrency 8 \
--cpu 1 --memory 512Mi \
--set-env-vars APP_ENV=test \
--set-secrets SECRET_KEY=hortalia-shop-secret-key:latestgcloud run deploy hortalia-shop: creates or updates thehortalia-shopservice (the same name we used in 01-04). Every deployment creates a new, immutable revision.--source .: uploads the current folder; as it contains aDockerfile, Cloud Build builds the image with it and stores it in Artifact Registry. If there were none, it would use buildpacks to detect the language automatically.--region europe-southwest1: Madrid.--allow-unauthenticated: allows public access, which a store needs. Without this option, only authorized identities could call the service.--min-instances 0/--max-instances 10: scales to zero when there is no traffic (no compute is billed) and never goes above 10 instances.--concurrency 8: each instance serves up to 8 simultaneous requests before Cloud Run creates another one. It is Cloud Run's main scaling metric, instead of CPU. The default value is 80, but Marc tunes it to what his container can really serve: 2 gunicorn processes × 4 threads = 8 requests at a time.--cpu 1 --memory 512Mi: resources for each instance.--set-env-varsand--set-secrets: environment variables; the second one takes its value from a secret held in Secret Manager, so the key never appears in the command or in the code.
The result is a https://hortalia-shop-....run.app URL. It is only a proof of concept: the prototype's platform will be decided in the next lesson and the definitive one in module 5.
- Serverless and functions (FaaS)
In the FaaS model (Functions as a Service) you do not deploy an application that listens for requests continuously; you deploy small functions that the platform runs when an event happens.
| Service | Provider | Languages (among others) |
|---|---|---|
| Azure Functions | Microsoft | Python, JavaScript/TypeScript, C#, Java, PowerShell |
| AWS Lambda | Amazon | Python, Node.js, Java, .NET, Go, Ruby and custom runtimes |
| Cloud Run functions (formerly Cloud Functions) | Python, Node.js, Go, Java, .NET, Ruby, PHP |
6.1 The event model
A function always has a trigger and, optionally, inputs and outputs wired to other services.
flowchart LR
E1["HTTP request"] --> F["Function"]
E2["New file in<br/>storage"] --> F
E3["Message on a queue"] --> F
E4["Timer<br/>(every day at 06:00)"] --> F
F --> S1["Database"]
F --> S2["Other storage"]
F --> S3["Email / notification"]
6.2 Cold start
If there are no instances running and an event arrives, the platform has to create one: reserve resources, load the runtime, import the libraries and initialise your code. That delay, from a few hundred milliseconds to several seconds, is the cold start. For a background process it does not matter; for a store's home page at Christmas, it does. It is mitigated with always-ready instances (Azure Functions Flex Consumption lets you configure them; Cloud Run and other platforms offer a minimum number of instances; Lambda offers provisioned concurrency), at the price of paying for them even when they are not used, and with code that loads few libraries at start-up.
6.3 Pay per invocation
The typical FaaS bill has two components: number of invocations and execution time multiplied by the memory allocated (measured in GB-seconds). An illustrative example with the order of magnitude of published rates (real prices vary by provider, region and date, and there is usually a monthly free tier):
- Hortalia uploads about 2,000 photos a month; each resize takes 2 seconds with 0.5 GB of memory.
- Time: 2,000 × 2 s × 0.5 GB = 2,000 GB-s. At a price of the order of €0.000016 per GB-s, about €0.03. The invocations, at around €0.20 per million, are negligible.
- A small VM running all month for the same job would cost tens of euros. For occasional workloads, FaaS is unbeatable; for continuous, heavy workloads, paying per invocation can work out dearer than fixed instances.
6.4 Limits
| Limit | Example (published values; check them in the current documentation) |
|---|---|
| Maximum duration of one execution | AWS Lambda: 15 minutes. In Azure Functions, HTTP functions must answer within about 230 seconds because of the load balancer |
| Memory | AWS Lambda: up to 10,240 MB; other providers, similar configurable values |
| State | None between invocations: each execution may land on a different instance |
| Package and request size | Limited (of the order of tens or hundreds of MB for the code and a few MB for the synchronous request) |
| Concurrency | Quotas per account or per region that can be raised |
If a task does not fit within these limits (for example, a process that takes hours), there are alternatives such as Cloud Run or Azure Container Apps jobs, or workflow orchestrators (Durable Functions, AWS Step Functions, Google Workflows).
- Hortalia: a function that resizes product photos
Every time Sara or the buying team upload a photo of a new product, it arrives in high resolution (4-8 MB) from a phone. The store needs a version 800 pixels wide. Marc writes an Azure function in Python (v2 programming model) that fires when a file appears in the fotos-originales container of the sthortaliashop storage account and leaves the reduced version in fotos-web:
import io
import logging
import azure.functions as func
from PIL import Image
app = func.FunctionApp()
WEB_WIDTH = 800
@app.blob_trigger(
arg_name="original",
path="fotos-originales/{name}",
connection="FOTOS_STORAGE",
source="EventGrid",
)
@app.blob_output(
arg_name="resized",
path="fotos-web/{name}",
connection="FOTOS_STORAGE",
)
def resize_photo(original: func.InputStream, resized: func.Out[bytes]) -> None:
logging.info("Processing %s (%d bytes)", original.name, original.length)
image = Image.open(io.BytesIO(original.read()))
image = image.convert("RGB")
if image.width > WEB_WIDTH:
height = int(image.height * WEB_WIDTH / image.width)
image = image.resize((WEB_WIDTH, height))
output = io.BytesIO()
image.save(output, format="JPEG", quality=82, optimize=True)
resized.set(output.getvalue())
logging.info("Resized photo saved: %d bytes", output.tell())Explanation:
app = func.FunctionApp(): in Python's v2 model, every function is declared in afunction_app.pyfile on top of aFunctionAppobject.@app.blob_trigger(...): the trigger.path="fotos-originales/{name}"states which container to watch;{name}captures the file name so it can be reused.connection="FOTOS_STORAGE"is not the connection string but the name of the setting that holds it (or that states which account to reach with a managed identity): the secret is not in the code.source="EventGrid"makes the notification arrive through Event Grid (an event service), which is faster and more reliable than polling the container, and is the required option on the Flex Consumption plan; it requires creating an event subscription on the storage account.@app.blob_output(...): an output binding. The function does not need the storage SDK in order to write: it assigns the bytes toresizedand the platform saves them infotos-web/{name}, under the same name as the original.original: func.InputStream: the file that triggered the function.original.read()returns its bytes.- Pillow (
PIL):Image.openopens the image from memory;convert("RGB")normalises formats (for example, PNG with transparency) so that it can be saved as JPEG; if it is wider than 800 px, the proportional height is calculated and it is resized. image.save(..., quality=82, optimize=True): saves as JPEG with quality that is good enough for the web and much lighter.resized.set(...): hands the bytes over to the output binding.logging.info: the messages go to the platform's monitoring (Application Insights).
The function's requirements.txt includes azure-functions and Pillow. Notice what is not there: no web server, no waiting loop, no instance management. If 300 photos are uploaded one Monday, the platform runs many copies in parallel; if none is uploaded on a Sunday, nothing is running and no compute is billed.
In AWS Lambda the idea is identical, in a different shape: a file with a lambda_handler(event, context) function that receives the data of the S3 notification (bucket and object key) in event and uses the boto3 library to read and write. The syntax and the names change; the event model is the same.
- Other PaaS services
Around the four main types there are many managed services that are also PaaS:
| Type | What it is for | Examples |
|---|---|---|
| Queues and messaging | Decoupling components: the store leaves an "order created" message and another process handles it later | Azure Service Bus, Amazon SQS/SNS, Google Pub/Sub |
| Cache | Keeping frequent responses and shared sessions in memory | Azure Managed Redis, Amazon ElastiCache, Memorystore |
| Integration (iPaaS) | Connecting applications with flows and connectors without programming everything | Azure Logic Apps, Amazon EventBridge, Google Application Integration |
| BaaS (Backend as a Service) | A complete backend for web and mobile apps: authentication, database, storage, functions | Firebase (Google), Supabase (built on PostgreSQL), AWS Amplify |
| Low-code / no-code | Building applications with visual editors, aimed at business users | Microsoft Power Apps, among others; they sit halfway between PaaS and SaaS |
| Managed APIs | Publishing, protecting and measuring APIs | Azure API Management, Amazon API Gateway, Apigee |
Some of these services will show up in PaaS Use Cases, especially the queues and the integration between the store and the ERP.
- Comparison table of the types
| Criterion | Application PaaS | DBaaS | CaaS (serverless containers) | Managed Kubernetes | FaaS |
|---|---|---|---|---|---|
| What you hand over | Code or a package | Schema and data | Container image | Images and manifests | Functions |
| Control | Medium | Medium (engine settings) | Medium-high (everything inside the image) | High | Low |
| Scaling | By rules (CPU, requests); normally never below 1 instance | Simple vertical scaling; read replicas | By concurrent requests or events, to zero | By rules and by nodes; you configure it | Automatic, per event, to zero |
| Billing | Per plan instance and time | Per size, time and storage | Per CPU/memory in use (or per instance if a minimum is set) | Per node (VM) + control plane | Per invocation and GB-s |
| Operations for the customer | Low | Low-medium | Medium (rebuilding images) | High | Very low |
| Cold start | No (instances always running) | Not applicable | Yes, if it scales to zero | No, normally | Yes |
| Typical cases | Websites and APIs with continuous traffic | Data for any application | APIs and websites with irregular traffic; special OS needs | Many microservices and a platform team | Event-driven processes, scheduled tasks, integrations |
| At Hortalia | Candidate for the store | Candidate for the store's PostgreSQL | Alternative for the store | Ruled out for now | Photos, scheduled tasks |
- Criteria for choosing the type within PaaS
A simple decision tree for a new piece of software:
flowchart TB
A["What is the piece?"] --> D{"Is it data that<br/>has to be stored?"}
D -- "Yes" --> DB["Managed database"]
D -- "No, it is code" --> E{"Does it run only<br/>when something happens<br/>and finish quickly?"}
E -- "Yes" --> FAAS["FaaS"]
E -- "No, it serves traffic<br/>continuously" --> G{"Does it need something<br/>the platform does not ship<br/>(OS, binaries, language)?"}
G -- "Yes" --> CAAS["Serverless containers"]
G -- "No" --> H{"Very irregular traffic,<br/>with hours at zero?"}
H -- "Yes" --> CAAS2["Serverless containers<br/>or a PaaS that scales to zero"]
H -- "No" --> PAAS["Application PaaS"]
CAAS --> K{"Dozens of services<br/>and a platform team?"}
K -- "Yes" --> K8S["Managed Kubernetes"]
Other criteria worth weighing up:
- The team's profile: for Marc, a Python developer, an application PaaS feels natural; containers add Docker knowledge and the responsibility of rebuilding images.
- Traffic pattern: continuous traffic favours fixed instances; occasional traffic favours scaling to zero and paying per use.
- Latency on the first request: if it matters, avoid the cold start or pay for minimum instances.
- Portability: containers and code faithful to the twelve factors reduce vendor lock-in.
- The surrounding services: identities, private networks, monitoring and billing that you already have with one provider.
Applied to hortalia-shop, the map Marc writes down is: web store → application PaaS (or serverless containers as an alternative); PostgreSQL → managed database; product photos → FaaS; scheduled tasks → FaaS. Kubernetes, ruled out because of the size of the team.
Common Mistakes and Tips
- Believing that "serverless" means free. Scaling to zero saves money during idle hours, but a function called millions of times or with slow starts can work out expensive. Do the maths with your own traffic pattern.
- Forgetting that the container image is yours. An image built a year ago has a year of unpatched vulnerabilities. Rebuild it regularly.
- Choosing Kubernetes "because it is the standard". For one or two applications, the operating cost far outweighs the benefits.
- Assuming the DBaaS does everything. Indexes, slow queries, long retention, network exposure and restore tests are still yours.
- Putting heavy logic into functions with a time limit. If something can take minutes, use queues, jobs or orchestrators.
- Tip: combine types. The usual set-up is an application on PaaS or containers, a managed database and functions for the asynchronous tasks. Choosing a single type for everything is usually a mistake.
Exercises
Exercise 1. Assign the most suitable type of PaaS (application PaaS, DBaaS, serverless containers, managed Kubernetes or FaaS) and justify it: a) storing the store's orders; b) sending a confirmation email every time an order is created; c) the web store, if it needed to install a system binary to generate invoices as PDFs; d) a company with 60 microservices and a platform team of 8 people; e) the store's API, with continuous traffic and a team that only writes Python.
Exercise 2. Look at the store's Dockerfile. Marc suggests changing it like this to "simplify": remove USER shop, put COPY . . before RUN pip install and set CMD python app.py. Explain the consequences of each change.
Exercise 3. Work out (illustratively) the monthly cost of the photo function if Hortalia moves to uploading 20,000 photos a month, each one taking 3 s and the function using 1 GB of memory. Use €0.000016 per GB-s and €0.20 per million invocations, with no free tier. Does the conclusion change compared with a small VM?
Solutions
Solution 1. a) DBaaS: it is data that has to persist with backups and high availability. b) FaaS, triggered by a queue message or an "order created" event: it is short and occasional. c) Serverless containers: the image lets you install the binary. d) Managed Kubernetes: many services and a team able to operate it. e) Application PaaS: continuous traffic, supported language, minimal operations.
Solution 2.
- Removing
USER shop: the application would run as root inside the container; a vulnerability would give the attacker more power. COPY . .beforepip install: any change in the code would invalidate the dependencies layer, and every build would reinstall all the libraries (slower builds).CMD python app.py: it would use Flask's development server, not fit for production, and the port would depend on the code instead of$PORT.
Common mistake: thinking that the order of the instructions in the Dockerfile does not matter. It affects the layer cache and therefore the build time.
Solution 3. Time: 20,000 × 3 s × 1 GB = 60,000 GB-s × €0.000016 = €0.96. Invocations: 20,000 / 1,000,000 × €0.20 = €0.004. Total ≈ €0.96/month (illustrative). The conclusion does not change: it is still far below the cost of a VM running all month. FaaS stops being advantageous when the load is heavy and continuous, not because of the volume of an occasional process like this one.
Conclusion
In this lesson you have put the spectrum of managed computing in order: IaaS → CaaS → application PaaS → FaaS → SaaS, with managed databases as a cross-cutting category. You have seen what each type brings, what the provider does in a DBaaS and what is still yours, why managed Kubernetes is the borderline between IaaS and PaaS, what the event model, the cold start and FaaS's pay per invocation imply, and other services such as queues, cache, iPaaS, BaaS and low-code. On top of that, you have packaged hortalia-shop in a container, deployed it on Cloud Run and written a function that resizes photos. The practical conclusion: a real application combines several types.
Now that you know which types of platform exist, the next question is who offers them and on what terms: supported languages, scaling to zero, entry price, regions in Spain and degree of lock-in. In Popular PaaS Providers we will compare the large providers, the developer-focused platforms and the open-source options, and we will follow Marc as he chooses the platform for the hortalia-shop prototype.
