- Learn
- Computer Science & IT
- Information Technology
- Cloud Computing Fundamentals
- Cloud Compute Options
Cloud Compute Options
BeginnerLesson 3 of 7 in Cloud Computing Fundamentals Course
What you will learn
- Explain what a cloud virtual machine is, what it needs to run and how its lifecycle affects cost, and choose an instance family and size that fit a workload.
- Describe a cloud virtual machine and what it needs to runExplain how a provider turns physical servers into virtual machines, name the resources a VM needs, and describe its lifecycle and who manages what.
- Choose an instance family and sizeRead instance type names, match the main instance families to workloads, size a VM from its needs and recognize interruptible Spot capacity.
- Describe a cloud virtual machine and what it needs to run
- Explain scaling, elasticity and high availability, describe how auto scaling adds and removes instances, and explain how load balancers spread traffic across healthy instances.
- Explain scaling, elasticity and high availabilityDistinguish vertical from horizontal scaling and scalability from elasticity, and explain how spreading instances across zones and fault domains keeps an application running.
- Explain how auto scaling adds and removes instancesDescribe a scaling group's template, minimum, desired and maximum size, health checks and scaling policies, and work out how a target-tracking policy responds to load.
- Explain how a load balancer spreads trafficDescribe what a load balancer does, how health checks and distribution methods work, how layer 4 and layer 7 load balancers differ, and which service each provider offers.
- Explain scaling, elasticity and high availability
- Compare containers with virtual machines, explain what managed Kubernetes does, and describe the container services that run containers without managing servers.
- Compare containers with virtual machinesExplain what a container, a container image and a registry are, how containers differ from VMs in size, speed and isolation, and why containers suit microservices.
- Explain what managed Kubernetes does for youDescribe the main parts of a Kubernetes cluster, how it keeps the desired state and scales, and what Amazon EKS, Azure Kubernetes Service and Google Kubernetes Engine manage for you.
- Run containers without managing serversDescribe Amazon ECS with AWS Fargate, Azure Container Instances, Azure Container Apps and Google Cloud Run, and decide when serverless containers fit.
- Compare containers with virtual machines
- Explain how serverless functions run and are billed, when they fit, and how application hosting platforms run web apps while the provider manages the infrastructure.
- Explain serverless functions and when they fitDescribe the event-driven function model, its triggers, billing, limits and cold starts, and decide when functions fit a workload better than servers.
- Host web applications on a managed platformDescribe what application hosting platforms do for you, compare AWS Elastic Beanstalk, Azure App Service, Google App Engine and simpler hosting options, and know what you still manage.
- Explain serverless functions and when they fit
- Compare virtual machines, containers, serverless functions and hosting platforms on control, responsibility, scaling, cost and portability, and recommend an option for a business scenario.
- Compare compute options side by sidePlace the compute options on a spectrum from most control to least management, and compare who manages what, how each scales and is billed, and how portable each is.
- Recommend a compute option for a business scenarioApply a short set of questions to real scenarios, justify a recommendation, and plan a move from lifting and shifting to modernizing.
- Compare compute options side by side
Cloud Compute Options study guide
1Run workloads on cloud virtual machines
A cloud VM gives you a familiar computer to configure, but its resources, lifecycle and maintenance still need decisions. Learn which choices launch an instance, which charges can remain after it stops, and who patches the operating system. Then use workload needs to choose a family and size, read the provider names, and distinguish short CPU bursts from capacity that can be taken back.
1.1 Launch and manage a virtual machine
A virtual machine (VM) is a computer defined in software. It has virtual processors, memory, disks, a network connection and its own operating system. A hypervisor divides a physical server among VMs and keeps them isolated. A running cloud VM is also called an instance.
Choose the resources
The core services are Amazon EC2, Azure Virtual Machines and Google Compute Engine. Each rents you infrastructure; you manage the operating system and application. This is infrastructure as a service (IaaS).
Launching a VM involves several connected choices:
- Location: a region and, where offered, an availability zone.
- Image: a template containing the operating system and preinstalled software. AWS calls it an Amazon Machine Image (AMI); Azure and Google offer public and custom images.
- Size: the vCPUs, memory and related capacity. A vCPU is the processing unit assigned to the VM.
- Disk: persistent storage from which the operating system boots.
- Network: an interface in a subnet, plus traffic rules. A public IP address is optional.
AWS uses EBS volumes, VPC subnets and security groups. Azure uses managed disks, VNet subnets and network security groups. Google uses persistent disks, VPC subnets and firewall rules. The names differ, but the resources serve comparable roles.
Follow a launch decision
A team needs a Linux web server in Frankfurt. It selects the Europe (Frankfurt) Region, an Ubuntu AMI and m7g.large, with 2 vCPUs and 8 GiB of memory. It adds a 30 GiB EBS boot volume and connects the VM to a VPC subnet. Its security group allows HTTPS on port 443 from the internet and SSH on port 22 only from the office network. The image supplies the software starting point; the size supplies computing capacity; the traffic rules decide who can connect.
Track the lifecycle and the bill
A VM is created, runs, can be stopped and started, and is eventually deleted. Compute charges accrue while it is allocated for running, even if CPU use is near zero. Stopping normally ends compute charges, but retained disks and reserved public IP addresses can still cost money. On Azure, check for "Stopped (deallocated)": shutting down inside the guest operating system can leave the VM in "Stopped", with compute still billed.
Temporary local disks are different from persistent boot disks. AWS instance store, Azure temporary disks and Google Local SSD keep data on the physical host; stopping, moving or deallocating a VM can lose it. Put files that must survive in persistent storage. After deleting a VM, review retained billable resources. A security group alone has no standalone charge, while an undeleted disk can keep generating one.
Know who maintains it
The provider maintains the datacenter, physical hardware and hypervisor. You patch the guest operating system, update installed software, protect data and manage access and firewall settings. Renting a VM does not transfer guest patching to the provider.
A dedicated host reserves a physical server for your use, useful for licenses tied to physical cores. A bare-metal instance exposes hardware without a hypervisor layer. Azure Virtual Desktop and Amazon WorkSpaces instead stream cloud-hosted desktops to users' devices.
Key Takeaways
- A VM gives you a guest operating system that you maintain.
- An image supplies software; a size supplies vCPUs and memory.
- Persistent disks and temporary local disks have different lifetimes.
- Check Azure deallocation and retained resources when ending charges.
- Dedicated hosts can satisfy physical-core licensing requirements.
1.2 Match a VM family and size to the workload
An instance family sets the balance of processing, memory, storage and accelerators. Its size sets how much of those resources you get. Choose the family from the workload's main need, then choose a size that meets all its requirements.
Recognize the main families
| Family | Main strength | Typical work | Examples |
|---|---|---|---|
| General purpose | Balanced CPU and memory | Web and application servers | AWS M, Azure D, Google E2/N2 |
| Compute optimized | Processing capacity | Encoding, batch jobs, modeling | AWS C, Azure F, Google C2/H3 |
| Memory optimized | More memory per vCPU | Caches, in-memory databases | AWS R/X, Azure E/M, Google M |
| Storage optimized | Fast local reads and writes | High-I/O databases | AWS I, Azure L, Google Z3 |
| Accelerated | GPUs or other accelerators | Training models, rendering | AWS P/G, Azure N, Google A/G |
Fast local storage does not make data persistent. A workload that uses storage-optimized instances still needs a plan for data that must survive host loss.
Read the name
In m7g.large, m means general purpose, 7 is the generation, g indicates AWS Graviton and large is the size. The same family grows from 2 vCPUs and 8 GiB at large to 4 vCPUs and 16 GiB at xlarge, then 8 vCPUs and 32 GiB at 2xlarge.
In Azure's Standard_D4s_v5, D is the family, 4 is the vCPU count, s indicates premium SSD support and v5 is the version. Google's e2-standard-4 names the E2 series, standard memory ratio and 4 vCPUs. A vCPU is often a hardware thread; on Graviton it is a whole core. Do not treat every provider's vCPU as an identical physical core.
Work through a sizing choice
An internal reporting app needs 2 vCPUs and 6 GiB at peak. Compare these AWS sizes:
c7g.large: 2 vCPUs and 4 GiB; memory is insufficient.m7g.large: 2 vCPUs and 8 GiB; both requirements fit, with 2 GiB spare.r7g.large: 2 vCPUs and 16 GiB; it supplies much more memory than this app needs.
The general-purpose size is the sensible starting point. Its memory per vCPU is GiB. The compute-optimized and memory-optimized choices provide 2 and 8 GiB per vCPU, respectively. Google's E2 highcpu, standard and highmem 4-vCPU types similarly vary memory: 4 GB, 16 GB and 32 GB.
Right-sizing means measuring real use and adjusting the choice. Inspect memory, disk and network use alongside CPU before downsizing. AWS Compute Optimizer, Azure Advisor and Google's machine type recommendations can help. Resizing an existing VM requires a stop or restart, so plan for interruption to a single-server app.
Distinguish bursts from interruption
Burstable AWS T, Azure B and shared-core Google E2 types suit quiet workloads with short peaks. AWS T and Azure B earn CPU credits below a baseline and spend them above it. When credits run out, Azure B and AWS T standard mode return to baseline; current AWS T types default to unlimited mode and can charge for surplus CPU.
Spot VMs use spare capacity that the provider can reclaim at short notice. They fit restartable batch work with saved progress. A single production database is a poor match. Google's older preemptible VMs also have a 24-hour maximum lifetime; that limit is not the defining rule for modern Spot VMs.
Key Takeaways
- Choose the family by the scarce resource, then check the full size.
- A vCPU is not always a whole physical core.
- Right-size from measured CPU, memory, disk and network use.
- Burstable capacity suits brief peaks; sustained CPU use can throttle or cost extra.
- Spot workloads must tolerate interruption.
- Resizing one VM can interrupt its application.
2Keep applications available and responsive as demand changes
An application needs enough capacity for busy periods and enough healthy copies to survive failures. Learn how changing machine size differs from changing machine count, why shared state matters, and how zones reduce failure risk. Follow auto scaling from a template to a capacity decision, then see how load balancers direct requests to healthy targets while other systems handle repair.
2.1 Scale capacity and survive failures
A service faces two different problems: more work arriving, and equipment failing. Scaling changes capacity. High availability keeps the service usable when parts fail. A design can solve one problem while leaving the other unresolved.
Change size or change count
Vertical scaling changes one machine's size: for example, 2 vCPUs and 8 GiB become 8 vCPUs and 32 GiB. Scaling up adds resources; scaling down removes them. It is a direct way to give an existing application more capacity, but the machine must usually restart, the largest size is finite, and the machine remains one failure point.
Horizontal scaling changes the number of copies. Three web servers can become nine, then return to three. Scaling out adds instances; scaling in removes them. A load balancer shares web requests, while background workers can take jobs from a shared queue. The application must support multiple copies doing useful work together. A shared database can still limit throughput or fail even when many web servers remain healthy.
| Change | Direction | What changes? |
|---|---|---|
| Scale up/down | Vertical | Resources in each machine |
| Scale out/in | Horizontal | Number of machines |
Scalability is the ability to handle more work by adding resources. Elasticity is automatic, timely growth and shrinkage as demand changes. A shop that automatically changes from 4 servers at night to 20 during a sale is elastic. A fixed fleet with spare capacity may be highly available without being elastic.
Make copies replaceable
A stateless application instance keeps no unique data needed by a later request. Store carts, sessions and uploaded files in a shared database, cache or storage service. Then a request can reach any instance, and scaling in can remove one without losing its users' carts.
For example, a cart held only in one web server's memory disappears when that server is terminated. Keeping the user on that server with a sticky session does not protect the cart from server failure. Moving the cart into shared storage changes what can safely be removed.
Keep enough capacity after a zone fails
Availability zones are separate locations within a region with independent power, cooling and networking. Spreading instances across zones protects against a whole zone failing. Several instances in one zone still share that zone's risk.
Suppose an application must retain the capacity of 4 instances after losing any one of 3 zones. The two surviving zones must each supply 2 instances:
Run 2 instances in each zone, for 6 total. Losing any zone leaves 4. This is spare capacity for failure, not an increase in the workload's normal requirement. A load balancer directs requests to the survivors; any shared data service also needs suitable availability.
Recognize Azure availability sets
An availability set spreads VMs within one datacenter across hardware fault domains and maintenance update domains. A fault domain shares hardware such as power and network switches. Sets support up to 3 fault domains; update domains default to 5 and can reach 20. They reduce rack and planned-restart risks. Zones address the larger risk of an entire datacenter location becoming unavailable.
Key Takeaways
- Vertical scaling changes size; horizontal scaling changes instance count.
- Elasticity adds automatic growth and shrinkage to scalability.
- Shared state lets application instances be removed safely.
- Plan capacity for the surviving zones, not only for normal operation.
- Availability sets spread rack and maintenance risk within a datacenter.
2.2 Follow an auto scaling decision
Auto scaling adds and removes instances as demand changes. Amazon EC2 Auto Scaling uses Auto Scaling groups, Azure uses Virtual Machine Scale Sets with autoscale rules, and Google uses managed instance groups with an autoscaler.
Start from a repeatable template
A new instance needs the same image, size, network settings and startup instructions as its peers. AWS uses a launch template, Azure a scale set VM model and Google an instance template. A change made by hand inside one running VM will disappear when that VM is replaced unless it is included in the repeatable setup.
The group has three capacity settings:
- Minimum: the floor the group maintains.
- Desired: the count it currently aims to run.
- Maximum: the ceiling it must not exceed.
With minimum 2, desired 4 and maximum 10, the group aims for 4 instances. Policies can move desired capacity between 2 and 10. The maximum is permission to grow; setting it to 10 does not itself run or bill 10 VMs. It caps instance count, not every charge in the application.
Choose what drives a change
Target tracking tries to keep a metric near a target, such as average CPU use of 50%. Step or rule-based scaling changes capacity when a threshold is crossed, such as adding 2 instances after CPU stays above 70% for 5 minutes. Scheduled scaling sets capacity at known times. Predictive scaling forecasts demand from past patterns and prepares capacity ahead of it.
A daily rush at 08:00 favors preparing instances before 08:00. Waiting for a high-CPU alarm means the rush has already arrived while the extra VMs are still starting.
Work out target-tracking capacity
Four identical instances average 80% CPU, and the target is 50%. For a simplified constant-load estimate, first total the work in instance-percentage units:
Divide by the target per instance:
Round up to 7 instances because 6 would leave the average above target. With 7, the estimate is . If the group's maximum is 6, it stops there and averages about 53.3%.
Separate readiness from failure recovery
A VM needs time to boot, run its startup tasks and pass health checks. Warm-up prevents a new instance's incomplete measurements from distorting a scaling decision. A cooldown limits rapid back-and-forth changes.
Scaling groups can also replace failed VMs to restore desired capacity. Application-level checks and repair actions need configuration: a VM can be running while its web application is broken. On Azure a repair action can restart, reimage or replace; Google calls recovery autohealing. A load balancer can detect a broken app, but the scaling group must be configured to use that information for repair.
Scaling in removes instances. Keep logs centrally and lasting data outside their local files so removing a healthy copy does not remove unique information.
Key Takeaways
- A template makes replacement instances repeatable.
- Minimum, desired and maximum mean floor, current aim and ceiling.
- Target tracking responds to a metric; schedules prepare known peaks.
- Round capacity estimates up, then apply the maximum.
- Readiness delays and application health checks affect recovery.
- Scale-in requires replaceable instances and external lasting data.
2.3 Distribute requests across healthy servers
A load balancer gives clients one entry address and forwards incoming traffic to healthy servers. AWS calls the server pool a target group; Azure uses a backend pool; Google uses a backend service. Clients do not need a new address whenever the pool changes.
Route traffic and detect failures
A health check repeatedly tests a target, for example by requesting /health every 10 seconds. After enough failed checks, the target is marked unhealthy and receives no new traffic until it passes again. Detection takes time because the checks run at intervals.
Routing and repair are different jobs. The load balancer stops sending new requests to a failed target. A scaling group or operator repairs or replaces that server. Adding a load balancer alone adds no application processing capacity.
Round robin takes healthy targets in turn. Least connections or least outstanding requests favors the target with less work in progress. Hash-based routing maps connection details, including addresses and ports, to a target. One connection stays together, but a new connection from the same user can land elsewhere.
Session affinity, also called sticky sessions, keeps a user's requests on one server. It can support an application with local sessions, but makes traffic less even and leaves sessions exposed to that server's failure. Shared session storage lets other healthy servers continue the user's work.
Calculate the effect of losing a server
Three healthy servers share 900 requests per minute evenly. Each handles:
One server fails its health checks. The same work now goes to two:
If each can handle only 400 requests per minute, healthy routing still leaves an overload. The pool needs spare capacity or more instances. Auto scaling changes capacity; load balancing distributes it.
Pick the layer that fits the routing
| Type | What it understands | Useful when |
|---|---|---|
| Layer 4 | Supported TCP/UDP connections, addresses and ports | Routing network connections without HTTP rules |
| Layer 7 | HTTP/HTTPS hosts, paths and requests | Sending /api/ and /images/ to different pools |
A layer 7 service can also terminate TLS, decrypting HTTPS at the entry point, and can work with a web application firewall. A layer 4 service does not inspect an HTTP path to choose its backend. Check which transport protocols a particular product supports.
AWS Elastic Load Balancing offers Application Load Balancers at layer 7, Network Load Balancers at layer 4 and Gateway Load Balancers for network appliances, within a region. Azure Load Balancer is layer 4; Application Gateway is regional layer 7; Front Door provides a global layer 7 entry point. Google Cloud Load Balancing offers Application and Network Load Balancers in regional and global forms.
Join routing to scaling
With the integration configured, new group instances register as targets and receive traffic once healthy. During removal, connection draining allows active requests to finish before a target disappears. A multi-zone deployment routes to healthy zones during an outage, provided the survivors have enough capacity. Even two servers benefit from this shared entry point and health-based routing.
Key Takeaways
- Health checks control routing; repair requires a scaling group or operator.
- Load balancing shares existing capacity and cannot create more.
- Layer 7 can route by HTTP host or path; layer 4 routes connections.
- Connection draining gives active requests time to finish.
- Healthy survivors still need enough capacity to carry the load.
3Run applications in containers
Containers keep an application and its dependencies together so the same package can move from testing into production. Learn what they share with their host and what that means for speed, isolation and lasting data. Then compare Kubernetes orchestration with services that hide the host machines, using pod capacity, team skills and quiet-hours traffic to understand the choices.
3.1 Package an application in a container
A container runs an application and its dependencies as an isolated process on a host. Packaging its libraries and runtime makes the tested software repeatable in production.
Image, registry and running copy
An image is the read-only template; a registry stores and distributes images; a container is a running copy. Amazon ECR, Azure Container Registry and Google Artifact Registry provide registries. The Open Container Initiative defines standard image formats; Docker helped popularize their use.
For example, a team packages its Python orders API as orders-api:1.4, tests it, pushes it to a registry and starts 3 production containers from that image. Environment settings and access to external services still need configuration.
Share a kernel instead of booting a guest OS
Each VM carries a full guest operating system behind a hypervisor. Containers share the host's kernel, the operating-system core that manages resources and processes. They have less software to carry and start: images are often tens or hundreds of megabytes, and startup takes seconds or less. VM images are commonly gigabytes and boot in minutes. A host can therefore run more containers than full VMs.
Sharing also affects isolation. A host-kernel flaw can affect several containers, while separate guest kernels give VMs a stronger boundary. Linux containers need a Linux kernel; Windows containers need Windows. The image must also match the processor architecture, such as x86 or Arm. Containers often run on cloud VMs.
Replace software and preserve data
Update a container by building a corrected image and replacing old copies. A hand patch disappears on replacement and leaves other replicas unchanged.
The same applies to runtime files in the writable layer. An invoice generated there must be saved to a persistent volume or storage service before replacement. The image registry preserves application packages, not documents created by running containers.
Separate services when that helps
A monolith deploys as one unit. Microservices split an app into network-connected services that deploy and scale separately. A store can add payment-service containers without adding catalog-service copies.
An orchestrator places containers across hosts, restarts failed copies, scales them, rolls out versions and connects services. Kubernetes does this, as do simpler managed container services. Containers do not require Kubernetes.
Key Takeaways
- An image is a template, a registry stores it and a container runs it.
- Containers share a host kernel; VMs have their own guest kernels.
- Image portability requires compatible operating systems and processors.
- Replace containers with new images and keep lasting data externally.
- Microservices can be deployed and scaled separately.
- Orchestration coordinates containers across hosts.
3.2 Keep container workloads running with Kubernetes
Kubernetes deploys and manages containers across a group of machines called a cluster. It is open source, originated at Google and is maintained within the Cloud Native Computing Foundation. The same platform can run across clouds and private datacenters.
Understand the cluster's parts
The control plane stores configuration, schedules work and coordinates the cluster. Worker nodes, usually VMs, provide the processing and memory that containers consume.
A pod is the smallest unit Kubernetes schedules. It contains one or more containers that share a network address and stay together on one node. A pod is not a separate VM. Several pods can share the same worker node if their resource needs fit.
You declare a desired state: for example, 3 replicas of orders-api:1.4. Kubernetes works to keep 3 pods running. When a pod fails, it creates a replacement; after a node fails, replacement pods can run on surviving nodes with available capacity. A Kubernetes Service provides a stable name and address for reaching pods even as their individual addresses change.
Scale pods and machines separately
A horizontal pod autoscaler (HPA) changes pod count using metrics such as CPU demand. A cluster autoscaler changes node capacity when pods cannot fit or nodes become unnecessary. Adding pods without room to run them creates pending work, not more processing capacity.
Suppose each pod requests 0.5 vCPU and each node has 2 vCPUs available for pods. Ignore other resource limits for this example. One node can hold:
If the HPA raises the desired count to 10 pods, two nodes hold only 8. The requirement is:
Round up to 3 nodes. The third node supplies room for the last 2 pods. Use capacity available for pods, because the node's operating system and Kubernetes components also need resources. In real scheduling, memory and placement rules matter alongside CPU.
Divide management responsibilities
Amazon Elastic Kubernetes Service (EKS), Azure Kubernetes Service (AKS) and Google Kubernetes Engine (GKE) run managed control planes. The provider maintains that control plane, including its availability and updates. You manage images, application settings, access and workload resource requests. In many modes, you also manage worker-node choices and updates. Cluster fees can be separate from node charges.
GKE Standard leaves node choices with you and bills for the node VMs. GKE Autopilot provisions and manages nodes, generally charging for requested pod resources. EKS can run eligible pods on AWS Fargate so you do not manage the node VMs. These modes reduce operational work while limiting some host choices.
Decide whether the complexity helps
Kubernetes fits many independently deployed services and teams that need a common platform across providers. Its tools and workload definitions improve portability, though attached cloud databases, identity systems and networking can still require changes.
For one simple web app, a hosting platform or serverless container service can take less work. Managed Kubernetes does not fix a bug in your image or choose the right memory request for you. If an app repeatedly runs out of memory, the team must diagnose the app and its settings even when the control plane is fully managed.
Key Takeaways
- The control plane coordinates; worker nodes run pods.
- A pod is scheduled as a unit and can hold more than one container.
- Desired state drives replacement of failed pods.
- Pod scaling and node scaling solve different capacity problems.
- Managed control planes leave application responsibility with the team.
- Kubernetes portability must be weighed against its operational complexity.
3.3 Run containers with less server work
Serverless container services run your images on provider-managed hosts. You still select resources, maintain the image and configure the app. Scaling and billing depend on the service.
Separate orchestration from compute
Amazon ECS orchestrates containers as tasks. An ECS service maintains a desired task count, optionally behind a load balancer. Tasks run on EC2 hosts you manage or on Fargate compute.
Fargate also supports eligible EKS pods. You choose task or pod vCPUs and memory and pay while those resources run; you do not select, patch or scale the underlying EC2 hosts. ECS service autoscaling uses policies you configure. Fargate supplies compute, not the application's desired task count. ECS on EC2 retains more host and instance-family control, with more management work.
Compare Azure and Google services
Azure Container Instances (ACI) starts one container or a small group without a cluster and bills per second. It suits tests and simple finite tasks, but has no built-in autoscaling.
Azure Container Apps hides its underlying Kubernetes platform. Configured rules scale containerized apps on HTTP traffic or events, including down to zero for suitable workloads.
Google Cloud Run offers services for incoming requests and jobs that run to completion. Services can grow from zero and shrink again. Request-based compute billing covers request processing plus startup and shutdown. With no minimum instances and no running instances, idle compute costs nothing; databases and stored images can still incur charges. Cloud Run also hosts Cloud Run functions, which start from function code instead of a customer-supplied app image.
Trade idle savings for startup delay
An internal booking API is busy 08:00–18:00 on weekdays: 10 hours on 5 days, or 50 of the week's 168 hours. Occasional night requests also arrive. Cloud Run or Container Apps can run several copies at peak and reach zero between requests during quiet periods.
A request after idle time may wait for a cold start. Keeping one minimum instance warm reduces delay within its capacity and adds ongoing cost. A burst beyond that capacity can still start extra instances cold.
Choose the host control you need
These services restrict host access and impose resource and duration limits. You cannot install host agents or change the host kernel. VMs or suitable Kubernetes nodes fit those needs. For standard containerized APIs, simpler services can avoid the work of operating Kubernetes; ACI is a direct option for a simple container group.
Key Takeaways
- Fargate supplies compute; ECS or EKS orchestrates workloads.
- ACI has no built-in autoscaling.
- Container Apps and Cloud Run can scale suitable services to zero.
- A warm minimum trades ongoing cost for fewer idle-start delays.
- Serverless containers leave images, app settings and resource limits with you.
4Build with serverless functions and application hosting platforms
Functions run small pieces of code when events arrive; hosting platforms run complete web applications with deployment and management tools. Learn how triggers, state, duration limits and cold starts shape function workloads, and calculate an illustrative usage bill. Compare the main hosting platforms, including which infrastructure the provider maintains and which settings and costs remain yours.
4.1 Run short tasks when events arrive
A serverless function is code that runs when a matching event arrives. The provider manages the servers and managed runtime. AWS Lambda, Azure Functions and Google Cloud Run functions offer this functions as a service (FaaS) model.
Connect a trigger to an invocation
A trigger starts one execution, called an invocation. Triggers include HTTP requests, uploaded files, queue messages, database changes and timers. A photo upload can trigger a function that creates a 200-pixel thumbnail and saves it in storage. With no uploads, an on-demand deployment can have no function compute running.
The provider scales execution as events arrive, within concurrency and service limits. Many simultaneous functions can open many database connections. The function layer may have room to scale even when the database does not. Limit concurrency to what connected systems can handle.
Functions are stateless across invocations. A later invocation may use a new environment, so it cannot depend on an earlier call's memory or temporary files. Store counters, sessions and lasting results in a database, cache or object storage. A warm environment may be reused, but that reuse is not a persistence contract.
Calculate consumption-style usage
Lambda's standard on-demand billing combines invocation count and GB-seconds (GB-s): allocated memory in GB multiplied by running seconds. For an illustrative calculation, assume each of 3,000,000 invocations runs for 0.2 seconds with 0.5 GB of memory. Ignore free allowances and all other services.
At assumed prices of $0.0000167 per GB-s and $0.20 per million requests, compute costs $5.01 and requests cost $0.60, totaling $5.61. These are assumed prices for learning the model. Cloud Run functions also meter CPU; Azure plans may charge for ready or allocated instances.
At 100,000,000 otherwise identical invocations, usage is 10,000,000 GB-s: $167 compute plus $20 requests at those assumed rates. A VM priced at an assumed $0.04 per hour costs $29.20 for 730 hours, but a fair comparison also checks whether it can process the same work and includes its operating effort. Spiky demand favors avoiding idle capacity; steady load can favor always-on compute.
Check execution limits and startup delay
Lambda default compute allows at most 15 minutes per invocation and up to 10,240 MB of memory. A 40-minute conversion cannot fit that invocation. A container job, VM or shorter steps can fit; timeout rules differ for other plans and compute modes.
A cold start occurs when a new execution environment must be prepared, after idle time or during scale-out. Reused warm environments start faster. Lambda provisioned concurrency, always-ready instances on Azure Premium or Flex Consumption, and Cloud Run minimum instances reduce startup delays at extra cost.
The provider maintains servers and the managed runtime. You still fix your code and included libraries, protect secrets, configure permissions and secure data. Serverless removes server administration, not application ownership.
Key Takeaways
- A trigger causes one function invocation.
- Keep lasting state outside function memory and temporary files.
- GB-seconds multiply allocated memory by execution time.
- Billing and timeout rules belong to a specific service and plan.
- Cold starts can occur after idle time and during scale-out.
- Concurrency must fit downstream systems as well as the function service.
- You retain code, library, data and access responsibilities.
4.2 Deploy a web app to a hosting platform
An application hosting platform takes your code or container image and provides the infrastructure for running it. It is platform as a service (PaaS): deployment, health monitoring, server operation and scaling are provided through the platform, while you build the application.
Compare the main platforms
AWS Elastic Beanstalk creates ordinary AWS resources for your app, commonly EC2 instances in an Auto Scaling group behind an Elastic Load Balancer. It handles deployments and health monitoring. Beanstalk itself has no extra service fee; you pay for the resources it creates. Those resources remain visible in your account, and you can customize their configuration.
Azure App Service hosts web apps, APIs and mobile back ends from code or containers. An App Service plan sets the region, instance size and count. Apps in that plan share those instances. Dedicated tiers bill for the plan even when the apps are quiet. Features such as autoscale and deployment slots depend on the chosen tier.
Google App Engine has standard and flexible environments. Standard uses supported runtimes in a sandbox and can scale to zero with suitable automatic scaling. Flexible runs containers on Compute Engine VMs, permits more customization and keeps at least one instance running. Cloud Run is another route for hosting an app already packaged in a container.
| Platform | Infrastructure relationship | Cost reminder |
|---|---|---|
| Elastic Beanstalk | Creates visible AWS resources | Pay for those resources |
| App Service | Apps share a hosting plan | Dedicated plans bill while idle |
| App Engine | Standard or flexible environment | Flexible keeps a minimum instance |
Release a new version safely
A two-person store team uses an App Service tier with deployment slots. It runs 2 instances and deploys a new version into a staging slot, a separate place to test the release before customers use it. After testing, it swaps staging and production. The old version remains available in the other slot for a possible rollback.
During a sale, its configured autoscale rule raises the plan to 5 instances after average CPU remains above 70%, then returns to 2 as demand falls. The platform carries out the scaling, but the team still selects the plan, rules and limits. It never installs the host operating system or web server.
Retain the right responsibilities
You maintain code, included libraries, settings, secrets, data and access in every platform. App Service and App Engine maintain their host operating system and managed runtime. Beanstalk permits more EC2 customization; AWS publishes platform updates, and you apply them or enable managed platform updates. Extra software you install also needs care.
A platform is different from SaaS. With PaaS, you deploy the app you build; with SaaS, you use someone else's finished application, such as an email suite. Platform-specific settings and service integrations can also make a later provider move harder.
Fit simpler hosting needs
Amazon Lightsail bundles a virtual private server, storage and data transfer for a predictable monthly package. It suits small websites but still involves VM responsibilities. A static site consists of files such as HTML, CSS, JavaScript and images. AWS Amplify Hosting, Azure Static Web Apps and Firebase Hosting can serve those files globally without a web server for you to maintain. An app requiring full host operating-system control belongs on VMs.
Key Takeaways
- PaaS hosts the application you build; SaaS provides a finished application.
- Beanstalk creates billable AWS resources and needs a platform-update choice.
- App Service apps share a plan; dedicated capacity costs money while idle.
- App Engine standard and flexible have different minimum-capacity behavior.
- Deployment slots separate testing a release from exposing it to users.
5Choose the right compute option for a workload
The useful compute choice is the one that fits the work and the team running it. Compare control, maintenance, startup, duration, billing and portability across VMs, containers, platforms and functions. Then turn business requirements into a justified recommendation, checking hard constraints before price and seeing how a move can progress from rehosting to modernization.
5.1 Compare control, effort and cost
Compare compute models against the same workload. Check control, operating effort, startup, billing, limits and portability.
Who maintains what?
| Model | Provider maintains | Customer maintains |
|---|---|---|
| VMs | Hardware and hypervisor | Guest OS, runtime and app |
| Managed Kubernetes | Control plane | Images, workloads and often nodes |
| Serverless containers | Hosts and host OS | Image, app settings and limits |
| Hosting platforms | Deployment platform and much of the host | App, configuration and plan choices |
| Functions | Servers and managed runtime | Code, dependencies and permissions |
Data and access remain the customer's responsibility throughout. Elastic Beanstalk also requires choosing how platform updates are applied.
Compare traffic and usable capacity
A VM usually needs a minute or more to boot and pass checks; a container often starts in seconds; a warm function can begin work in milliseconds. A new environment can add cold-start delay. Warm capacity reduces that delay at an ongoing cost.
A directory quiet overnight can benefit from scale to zero; steady demand can favor allocated compute. Compare equivalent throughput, memory and concurrency before monthly totals: one cheap VM may not serve the same work as many simultaneous function invocations. Include operating effort too.
VMs and dedicated hosting plans bill for allocated time, busy or idle. Lambda standard on-demand billing combines requests and GB-seconds; other function plans use different meters. Zero instances removes idle compute charges only when no paid minimum remains. Storage and databases can still bill.
Check limits and movement between platforms
Long-lived processes fit VMs or suitable containers. One Lambda default-compute invocation is limited to 15 minutes, so an uninterrupted two-hour job needs another compatible execution option. Functions cannot depend on local state surviving calls; disposable containers and scaling-group VMs also need external lasting data.
Full guest OS control, kernel changes and specialized licensed software favor VMs. Many independently deployed services can justify Kubernetes. Standard web apps often fit hosting platforms; short event tasks fit functions.
Container images move between compatible hosts, and Kubernetes offers common deployment tools across clouds. Databases, identity and networking can still need changes. VM migration depends on provider formats and tools; functions and platforms tie more closely to provider settings and triggers. Different components can use different models.
Key Takeaways
- More host control brings more responsibility for operating it.
- Compare costs for equivalent workload capacity and traffic.
- Cold starts trade latency against the cost of warm capacity.
- Portability includes dependencies beyond the image or deployment file.
- Different components can use different compute models.
5.2 Choose compute from a business requirement
First check the requirements that could rule an option out. Then compare traffic, cost and team skills.
Find the decisive constraint
- Check guest operating-system access, special software, hardware and licensing.
- For short event-triggered work, check function duration, state and concurrency.
- For containerized apps, compare Kubernetes control with simpler managed services.
- For standard web apps deployed as code, consider a hosting platform.
- Check startup delay, traffic patterns, resource limits and total operating cost.
Match the business cases
A vendor supports an accounting app only on Windows Server, with a core-based license. VMs preserve that environment; use a dedicated host if physical-core licensing requires it. Multi-zone copies need a compatible app and data design. Moving largely unchanged is rehosting, or lift and shift, and retains guest maintenance.
Photo uploads rise from a few at night to thousands per minute. Short independent thumbnail tasks fit functions triggered by uploads. They scale with arrivals; check cold starts, duration limits and the capacity of downstream services.
A retailer has 30 microservices, 6 teams and a two-cloud platform requirement. Managed Kubernetes supplies common orchestration tools. A start-up with 3 services and no Kubernetes experience can use Cloud Run, Container Apps or ECS with Fargate, retaining image and app responsibilities without host work.
A museum's agency builds a ticketing website but has no operations staff. A hosting platform supplies deployment tools and scaling for opening days. App Service and App Engine maintain hosts; Beanstalk needs a platform-update choice, such as managed updates.
A two-hour nightly report fits a container job or VM with a suitable execution limit, not one Lambda default-compute invocation. Spot can reduce cost if the job saves progress and resumes after interruption.
Multi-day GPU training needs accelerated VMs or suitable Kubernetes GPU nodes. Persisted checkpoints make Spot practical by limiting lost progress.
Explain a staged choice
A company can rehost first to leave its datacenter quickly, then modernize selected components with containers, hosting platforms or functions. Rehosting alone keeps the old operating model.
For example: "Use Cloud Run because the API is already containerized, traffic stops at night and the team has no server administrator; allow for a cold start after idle time."
Key Takeaways
- Check hard software, hardware and duration requirements first.
- Match container-platform complexity to team skills and portability needs.
- Use Spot only when interruption and recovery are acceptable.
- Rehosting moves an app largely unchanged; modernization changes how it runs.
- Justify the choice with a workload need and its main trade-off.
Cloud Compute Options examples
1Choose a VM and follow its lifecycle
13 steps
- 1IntroductionA computer you configure
A cloud VM gives you a guest operating system to configure. You choose its software, capacity, storage and networking, then maintain the guest. Follow a server launch, check which charges survive shutdown, and use a reporting app's resource needs to choose a size.
- 2ExplanationChoose software and capacity
An image supplies the operating system and preinstalled software. A size supplies vCPUs and memory.
AWS calls these an AMI and instance type; Azure uses an image and VM size; Google uses an image and machine type. Choosing Linux does not choose the amount of RAM.
- 3ExampleConnect the VM
The Frankfurt web server uses a 30 GiB persistent boot disk, a subnet and traffic rules. HTTPS on port 443 is open to internet users; SSH on port 22 is allowed only from the office network.
These are separate choices: the disk holds data, the network interface connects the VM, and firewall rules control traffic. A public IP address is optional when the application can be reached through another entry point.
- 4Key InsightFollow a shutdown
An Azure administrator shuts down the guest operating system. The console shows "Stopped," so the VM may still have allocated compute and continue incurring compute charges.
Deallocating changes the state to "Stopped (deallocated)." That releases compute allocation, but a retained disk or reserved public IP address may keep billing. Deleting one resource does not delete every supporting resource.
- 5ChallengeCheck what survives
A team stores its only sales records on a VM's temporary local disk, then deallocates the VM. What storage choice should it have made?
---reveal---
The records belong on persistent disks or a storage service. A temporary local disk can lose data when the VM is stopped, moved or deallocated. It is suitable for disposable scratch work, not the only copy of lasting business records.
- 6TipKeep the patching boundary clear
The provider maintains the hypervisor and physical host. The customer patches the guest OS, maintains the app and controls login access.
A dedicated host reserves a physical server, for example for core-based licensing. It changes hardware allocation, not application ownership.
- 7ExampleStart with the scarce resource
A reporting app needs 2 vCPUs and 6 GiB at peak. Compare CPU and memory together before choosing a family.
A compute-optimized VM has more processing per unit of memory; a memory-optimized one has more RAM per vCPU. General-purpose types balance both. GPU types fit accelerated work such as model training, while storage-optimized types target high local-disk read and write rates.
- 8ExampleEliminate sizes that cannot fit
The three candidates each have 2 vCPUs. The
c7g.largehas 4 GiB,m7g.largehas 8 GiB andr7g.largehas 16 GiB.The 4 GiB choice cannot meet the app's 6 GiB need. The 8 GiB choice fits with 2 GiB spare. The 16 GiB choice leaves 10 GiB beyond that need. The general-purpose size is a reasonable starting point to measure in real use.
- 9TipRead a size name
In Azure
Standard_D4s_v5, D identifies the family, 4 the vCPU count, s premium SSD support and v5 the version.AWS
m7g.largeuses a named size; Googlee2-standard-4ends with the vCPU count. Read the full specification before comparing resources. - 10ConnectionCheck a credit-based choice
A quiet development VM has brief bursts above its CPU baseline, so a burstable type may fit. A simulation that stays CPU-bound for hours is different.
AWS T standard mode and Azure B spend earned CPU credits and return to baseline when credits run out. AWS T unlimited can continue bursting with surplus charges. Choose with the sustained workload in mind, not just its average over quiet days.
- 11ChallengeChoose a family from measurements
A service needs 4 vCPUs and 25 GiB of RAM. A general-purpose size has 4 vCPUs and 16 GiB; a memory-optimized size has 4 vCPUs and 32 GiB. What fits, and why?
---reveal---
The memory-optimized size meets both requirements. The general-purpose one lacks 9 GiB even though its CPU count is sufficient. After deployment, measure actual demand before changing the size again.
- 12ChallengeCombine fit with lifecycle
A nightly rendering job can save progress and resume after interruption. Its chosen VM supplies enough CPU and memory. Would Spot be reasonable, and what must survive VM loss?
---reveal---
Spot is reasonable because the job can tolerate reclamation and resume. Its checkpoints and finished outputs must be stored persistently. A low price cannot compensate for losing all progress each time spare capacity is taken back.
- 13RecapUse the right resource for each job
Images supply software; sizes supply capacity. Persistent storage preserves lasting files, while retained resources can keep billing after compute stops.
Choose a family from the limiting resource and measure real demand. Burstable types suit brief peaks; Spot needs interruption tolerance. Guest maintenance remains yours.
2Keep a service running as load changes
16 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionTwo reasons to need more capacity
- 2ExplanationChange size or change count
- 3Key InsightMove carts out of local memory
- 4ExampleCount the surviving zones
- 5ChallengeCheck availability and elasticity
- 6ExplanationSet floor, aim and ceiling
- 7ExampleFind the amount of work
- 8ExampleDivide by the target
- 9TipAllow time for readiness
- 10ChallengeEstimate and apply a ceiling
- 11ExplanationShare one entry point
- 12ExampleLose one target
- 13ChallengeConnect detection to repair
- 14TipPlan a safe removal
- 15ChallengeCombine zones, routing and capacity
- 16RecapSeparate the jobs
3Choose how to run a containerized API
14 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionFollow the package into production
- 2ExampleImage, registry, container
- 3ExplanationShare the host kernel
- 4ChallengeReplace the package
- 5ExplanationDeclare what should run
- 6ExampleCalculate room per node
- 7ExampleRound up to whole nodes
- 8ChallengeCheck both scaling levels
- 9Key InsightKeep application ownership
- 10ExplanationUse a simpler host service
- 11ExampleLet quiet periods reach zero
- 12ChallengeDecide about a warm minimum
- 13ChallengeMatch control to the team
- 14RecapChoose the layer you need
4Estimate function use and deploy a web app
13 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionTwo ways to reduce server work
- 2ExampleStart from an event
- 3ExplanationKeep lasting results elsewhere
- 4ExampleCount running seconds
- 5ExampleMultiply runtime by memory
- 6ChallengeCheck memory-time reasoning
- 7TipRespect duration and startup
- 8ExplanationDeploy the application you build
- 9ConnectionUnderstand allocated platforms
- 10ExampleTest before the release
- 11ChallengeChoose the platform responsibility
- 12ChallengeCompare billing for quiet traffic
- 13RecapCheck the execution and the plan
5Turn workload needs into a recommendation
10 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionMake the choice explainable
- 2ExplanationCompare what the team keeps
- 3Key InsightCompare equivalent work
- 4ChallengeCheck the meaning of portability
- 5ExampleLet a hard requirement lead
- 6ConnectionUse the existing package and skills
- 7ExplanationChoose a home for long work
- 8ChallengeRecommend and name the trade-off
- 9ChallengeChoose the next migration step
- 10RecapLink the need to the choice
Cloud Compute Options practice questions
Set 1: Connect capacity, state and responsibility10 Practice Questions
Question 1 of 10
Show answerHide answer
Question 2 of 10
Show answerHide answer
Question 3 of 10
Show answerHide answer
Question 4 of 10
Show answerHide answer
Question 5 of 10
Show answerHide answer
Question 6 of 10
Show answerHide answer
Question 7 of 10
Show answerHide answer
Question 8 of 10
Show answerHide answer
Question 9 of 10
Show answerHide answer
Question 10 of 10
Show answerHide answer
Set 2: Choose and operate cloud compute10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
/orders/ to one server pool and /help/ to another. What load balancer capability does it need?Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 3: Diagnose scaling and service choices10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 4: Evaluate designs and trade-offs10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Stuck on your own question? Homework Help
Key Terms
A
App Service plan
Application hosting platform
B
Bare-metal instance
Burstable instance
C
Checkpoint
Cluster autoscaler
Cold start
Concurrency
Connection draining
Consumption billing
Container
Container image
Container job
Container registry
Control plane
Cooldown
CPU credits
D
Deallocation
Dedicated host
Deployment slot
Desired capacity
Desired state
Desktop virtualization
E
ECS task
Elasticity
F
Fargate
Fault domain
G
GB-second
H
Health check
High availability
Horizontal pod autoscaler
Horizontal scaling
Hypervisor
I
Instance
Instance family
Instance size
Invocation
K
Kernel
Kubernetes cluster
Kubernetes Service
L
Launch template
Layer 4 load balancing
Layer 7 load balancing
Load balancer
M
Machine image
Maximum capacity
Memory per vCPU
Microservices
Modernization
Monolith
O
Operational responsibility
Orchestration
P
Persistent disk
Platform as a service
Pod
Portability
Predictive scaling
Provisioned concurrency
R
Rehosting
Right-sizing
Round robin
S
Scalability
Scale to zero
Scheduled scaling
Serverless containers
Serverless function
Session affinity
Software as a service
Spot capacity
Stateless instance
Static hosting
T
Target tracking
Temporary local disk
TLS termination
Trigger
U
Update domain
V
vCPU
Vendor lock-in
Vertical scaling
Virtual machine
W
Warm-up period
Worker node
Workload requirement
About this lesson
Make your own Study Materials
Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.