The first lesson clarified what the cloud is and who is responsible for what. Now the question is why companies use it: how you pay there, what "serverless" means and which benefits the cloud brings.
The consumption-based model
Cloud computing works on a consumption-based model. You pay for the IT resources you use, and for nothing beyond that. Instead of buying and operating a datacenter of your own, you rent computing power and storage and give them back when you are done.
In traditional IT planning you meet two terms:
- CapEx (capital expenditure): Money you spend up front on physical infrastructure, that is, on servers, network equipment and space in the datacenter.
- OpEx (operational expenditure): Spending on services that is spread over time.
Because you pay for cloud services while you consume them, cloud computing counts as operational expenditure. That brings four benefits: no up-front costs for hardware or a datacenter, no purchase of capacity that then sits idle, the ability to add resources when demand rises, and the ability to release them again when demand falls.
Two pricing models compared
In a traditional datacenter, you estimate future demand in advance. If you estimate too high, you spend money on technology that sits unused. If you estimate too low, your applications suffer from poor performance. To fix that, you have to order, install and set up hardware, power and cooling.
In the cloud, you adapt resources to actual demand. If you need more, you add virtual machines. When demand falls, you remove them again. You don't pay for idle time. This is called pay-as-you-go: You usually pay only for the services you consume. That helps you plan and control running costs, operate the infrastructure more efficiently and grow or shrink with demand.
| Traditional datacenter | Cloud | |
|---|---|---|
| Type of spending | CapEx: purchase up front | OpEx: payment by consumption |
| Capacity | estimated in advance and fixed | adapts to demand |
| Estimated too high | unused technology costs money anyway | you release resources and stop paying for them |
| Estimated too low | performance suffers until new hardware runs | you add resources |
Serverless
Between "I operate the machine myself" and "I use a ready-made application" there is the option of running only your own code. This is called serverless. The name is misleading: Your code still runs on a server. The difference is that your team no longer takes care of the server infrastructure. The cloud provider carries that responsibility.
Serverless services mostly run event-driven: An event triggers the code, for example a message in a queue or a newly uploaded file. The services scale up and down as needed. Billing is usually based on usage. If nothing is consumed, there are no costs.
A well-known Azure service for this is Azure Functions: You write small blocks of code that react to events, and the service does the rest. A second example is Azure Logic Apps for automated workflows.
An example: The made-up photo book company "Bildwerk" wants to shrink every uploaded photo automatically. A small piece of code starts with every upload, shrinks the image and ends. On quiet nights it doesn't run and costs nothing.
The benefits of the cloud
High availability. High availability aims to keep your resources always available, no matter what disruptions occur. Depending on the service, Azure gives availability commitments, which are stated in the service level agreements (SLAs).
Scalability. You adapt resources to demand. There are two kinds. Scaling vertically means changing the performance of a resource: You give a virtual machine more CPU or memory (scale up) or less (scale down). Scaling horizontally means changing the number of resources: You add more machines or containers (scale out) or remove some (scale in), manually or automatically.
Reliability. This is the ability of a system to recover from failures and keep working. Thanks to the decentralized setup, resources can be located in regions around the world. If one region fails, the others keep running.
Predictability. It concerns performance and cost. For performance, autoscaling, load balancing and high availability help. For costs, you can track consumption in real time, analyze it and estimate future spending, for example with the Azure pricing calculator. According to Microsoft, both depend heavily on the Azure Well-Architected Framework.
Security and governance. Templates make sure that deployed resources meet your technical and legal requirements. An audit in the cloud reports resources that deviate from your requirement. Depending on the operating model, software updates are installed automatically. If you want maximum control, IaaS gives you the resources and leaves the operating system and software to you. If you want to hand off maintenance, PaaS or SaaS fits better. Cloud providers are usually well prepared against distributed denial-of-service (DDoS) attacks.
Manageability. There are two sides here. Management of the cloud: scale automatically, deploy resources from templates, monitor health and replace failed resources automatically, receive alerts based on defined metrics. Management in the cloud: through a web portal, the command line (CLI), programming interfaces (APIs) or PowerShell.
Exercise 1
The made-up online pharmacy "Kräuterweg" has twice as many visitors every December as in the rest of the year. So far it buys servers for the peak every fall, and they then run almost empty for ten months. In addition, a partner uploads a price list once a day, which a small program has to read in.
a) Assign the purchase of the servers and payment by consumption to the terms CapEx and OpEx. b) With which kind of scaling does Kräuterweg cover the December peak, and what would be the alternative? c) What kind of service is suitable for reading in the price list, and why?
Solution 1
a) Buying the servers in the fall is CapEx: Money is spent up front on physical infrastructure. Payment by consumption is OpEx, which is how the cloud works.
b) For additional visitors, Kräuterweg adds more virtual machines or containers, which is horizontal scaling (scale out), and releases them again in January (scale in). The alternative is vertical scaling: giving one machine more CPU and memory.
c) A serverless service such as Azure Functions: The code reacts to an event (the uploaded file), runs only briefly, and without consumption there are no costs. Kräuterweg doesn't have to maintain any servers.
Further reading
- Describe the benefits of using cloud services: Microsoft's learning module on the benefits of the cloud.