Comparing Application Hosting Options in Azure
This lesson explains Azure App Service, the Azure container services and virtual machines as options for hosting applications, and how to choose between them.
Learning outcomes
After completing this lesson, you will be able to:
- Describe Azure App Service and the kinds of app it hosts.
- Distinguish Azure Container Instances, Azure Container Apps and Azure Kubernetes Service.
- Identify the appropriate hosting option for an application.
Azure App Service
Azure App Service is an HTTP-based PaaS service for hosting web applications, REST APIs and mobile back ends. It supports .NET, Java, Node.js, Python and PHP on Windows or Linux, and can also run custom containers. Microsoft manages the underlying VMs and operating systems, and App Service adds enterprise features: automatic scaling, built-in load balancing, high availability, continuous deployment from GitHub or Azure DevOps, deployment slots for testing a release before swapping it into production, custom domains with certificates, and built-in authentication.
App Service hosts several kinds of app: web apps, API apps, WebJobs for background tasks, and back ends for mobile apps. An App Service plan defines the compute resources and pricing tier that the apps run on. For a typical web application with no special operating system requirements, App Service is the hosting option with the least management.
App Service features
Container hosting options
Azure offers several services for running containers, which differ in how much orchestration and control they provide. The following table compares them.
| Service | What it is | Best for |
|---|---|---|
| Azure Container Instances (ACI) | Runs individual containers on demand as a PaaS service, with no servers or orchestrator to manage | Simple apps, batch jobs and tasks that need a container quickly |
| Azure Container Apps | A serverless platform for containerized apps with built-in load balancing, scaling (including to zero) and HTTPS | Microservices and web APIs without managing Kubernetes |
| Azure Kubernetes Service (AKS) | A managed Kubernetes service; Azure manages the control plane, and you manage the worker nodes and workloads | Orchestrating many containers with full Kubernetes control |
Container images are usually stored in Azure Container Registry, a private registry from which these services pull images. App Service can also run containers, which suits a containerized web application that benefits from App Service features.
Which container service?
Virtual machines as a hosting option
Virtual machines can host any application, because the customer controls the whole operating system. They are the right choice when the application needs a specific operating system configuration, software that the PaaS options do not support, or a lift-and-shift move with no changes. The cost is that the customer must patch, scale and maintain the servers. A useful order of preference for a new web application is App Service first, containers when the application is containerized or built from microservices, and VMs when neither fits.
Choosing a hosting option
The choice trades management effort for control. The following comparison summarizes the three approaches.
Where should it run?
Choosing a host
A team has packaged a nightly data-cleansing job as a container image. The job runs for about 20 minutes each night and must not incur charges for the rest of the day. The team does not want to manage servers or a Kubernetes cluster. Which Azure service should run the job?
Azure Container Instances runs a container on demand and bills only while the container runs, with no servers or orchestrator to manage, which fits a short nightly job. Azure Container Apps jobs could also run it, but AKS would require managing a cluster whose nodes cost money all day, and a VM would also incur charges while idle unless stopped and started. App Service is designed for continuously running web apps rather than short batch jobs.
Which container service gives full Kubernetes orchestration with a Microsoft-managed control plane?
Show answer
Azure Kubernetes Service (AKS).
Exam Tips
Remember for the exam
- Web apps and APIs with the least management: Azure App Service (PaaS).
- Run a container quickly with no orchestration: Azure Container Instances.
- Serverless microservices in containers: Azure Container Apps. Full Kubernetes orchestration: AKS.
- Use VMs when the app needs full OS control.