Interview Handbook by Sayed Elmahdy العربية

Topic 23 · Quality & operations

Cloud fundamentals

IaaS, PaaS, SaaS, Azure and AWS services, serverless, storage, scaling, cost, infrastructure as code.

16 questionsJunior · 4Mid · 7Senior · 510 quiz

Concepts

What you will learn: A cloud service choice decides who operates the system, how it handles a regional failure or traffic growth, and what appears on the bill. Compare options against a real workload and place data, permissions, and backups deliberately instead of choosing by product name alone.

Before you start: A workload is an application and the resources it needs; a region is a geographic operating area, and an availability zone is an isolated failure area within it, potentially containing one or more datacenters. Know whether your application needs a database, network, and storage. Azure and examples compare roles; exact features and prices vary by service and region.

Select a term with a dotted underline for its meaning, then continue reading from the same place.

#IaaS, PaaS, SaaS and FaaS: who owns what?

Cloud is more than a remote server: it is a choice about how much operation you own. Managed services reduce infrastructure work, but you still own data, permissions, application behavior and cost.

Renting an entire kitchen resembles ; a maintained kitchen resembles ; a prepared meal resembles ; preparing an order on arrival resembles . Each removes work while limiting customization.

ModelYou manageExamples
IaaS, patching, runtime and applicationAzure , Amazon EC2
PaaSApplication, configuration and data within platform constraintsAzure App Service, Elastic Beanstalk
SaaSUsers, configuration and data governanceMicrosoft 365
FaaSFunction code, triggers and permissionsAzure Functions,

FaaS is managed, event-driven execution, not a guarantee that every request is cheap. Choose the least operational burden that meets the requirements. VMs help when OS control is essential but add ongoing work.

#Regions, availability zones and recovery

A worked example
  1. Suppose the team targets restoration within one hour and at most ten minutes of data loss. The hour is ; ten minutes is : different objectives.
  2. Daily backups alone may not meet a ten-minute loss target without additional recovery mechanisms. Having a backup also does not prove restoration within an hour.
  3. Exercise restoration and measure time and recovered data. Availability zones address a class of failures within a region; they do not automatically replace backups or regional recovery planning.

Two replicas on one machine do not protect against a datacenter failure. A region is a geographic service area; availability zones are fault-isolated locations within a region, with independent power, cooling and networking according to the provider's design. Zone availability and support depend on the service and SKU.

  1. Define the , RTO for acceptable recovery time, and RPO for acceptable data loss measured in time.
  2. Distribute compute and data across zones where supported; selecting a region alone does not imply zone redundancy.
  3. If a regional outage must be tolerated, plan cross-region routing, and failover.
  4. Exercise recovery including , secrets, permissions and backups, not only compute.

Multi-region designs add , cost and consistency complexity. Active-active is not universally necessary; tested backup recovery or warm standby may meet the objective more simply. Replication is not backup because accidental deletion can replicate too.

#Azure and AWS mapping: similar roles, different contracts

This map transfers concepts, not unchanged code or configuration. Review limits, pricing, delivery guarantees and identity models before choosing.

NeedAzure
Virtual machinesVirtual MachinesEC2
Managed web hostingApp ServiceElastic Beanstalk
Managed containersContainer AppsECS with Fargate
KubernetesAKSEKS
FunctionsFunctions
Relational databaseAzure RDS
Cosmos DynamoDB
Object storageBlob StorageS3
Queues and pub/subService BusSQS + SNS
Event routingEvent GridEventBridge
SecretsKey VaultSecrets Manager
Identity and accessMicrosoft Entra ID
MonitoringApplication InsightsCloudWatch

RDS offers multiple engines rather than cloning Azure SQL. Cosmos DB and DynamoDB have different models and consistency contracts. Entra ID provides user and workload identity; IAM focuses on AWS resource access, with IAM Identity Center supporting workforce federation and access. Application Insights belongs to Azure Monitor; CloudWatch is broader than APM, and tracing may require additional services or integrations. See the official comparison guide.

#Managed identity instead of copied keys

A copied connection key must be stored and rotated; a leak grants access until revocation. Azure managed identity gives an application an identity for short-lived to services supporting Entra authentication. workloads use roles and temporary credentials. This example requires Azure.Identity, Azure.Storage.Blobs, an existing blob and Storage Blob Data Reader permission at an appropriate scope.

using Azure.Identity;
using Azure.Storage.Blobs;

var account = Environment.GetEnvironmentVariable("STORAGE_ACCOUNT")
    ?? throw new InvalidOperationException("STORAGE_ACCOUNT is required");
var credential = new DefaultAzureCredential(); // (1)
var service = new BlobServiceClient(
    new Uri($"https://{account}.blob.core.windows.net"), credential); // (2)
var blob = service.GetBlobContainerClient("invoices").GetBlobClient("invoice.txt");
await blob.DownloadToAsync("invoice.txt"); // (3)
🧾 Code walkthrough
  1. (1) The credential chain selects an available identity, such as a developer login locally or managed identity in Azure. Constrain the chain or select an explicit credential in production for predictable identity selection.
  2. (2) The endpoint is configuration, not a secret; identity supplies the token.
  3. (3) Reading needs a data-plane role, not merely account-management permission. Treat authentication or network failures explicitly rather than silently falling back to a hidden key.

Identity does not automatically grant permissions or bypass firewalls. Separate workload identities and apply least privilege. If a service cannot use workload identity, keep its key in Key Vault or Secrets Manager and rotate it. See Container Apps managed identity.

#Serverless: scale-to-zero still uses servers

Serverless transfers server management to the platform. Functions suit events such as invoice uploads and queue messages. A cold start initializes a new instance, including runtime, dependencies and application setup. Not every invocation is cold; startup time depends on the plan, runtime and application.

BenefitTrade-off
Automatic scaling and event integrationService-specific execution, concurrency and runtime limits
Low idle consumption on suitable plansCold starts and potentially higher cost under steady load
Less infrastructure operationDistributed debugging and stronger platform coupling

Make handlers because many triggers may redeliver. Minimize initialization and reuse connections, but keep important business state outside instance memory. For strict , evaluate minimum instances or provisioned capacity where offered, accepting reduced scale-to-zero savings. Long or sustained workloads may fit container jobs or services better.

#Scaling without overwhelming downstream systems

Vertical scaling enlarges an instance; horizontal scaling adds instances. Vertical scaling has machine-size limits and may require restarts. Horizontal scaling needs requests to distribute safely; in-memory sessions, uploads and job state obstruct reliable scale-out.

  1. Identify the bottleneck: , database waits or queue backlog.
  2. Choose a suitable signal: CPU for computation, queue age and backlog for workers, and as an outcome metric.
  3. Set minimums, maximums and stabilization or cooldown rules to prevent oscillation.
  4. Check connection pools and concurrency; twenty replicas can overwhelm one database.
  5. On scale-in, stop accepting new work, drain and preserve retry safety.

Autoscaling reacts with delay: instance startup and metrics collection take time. Sudden bursts need headroom or queues and . Sticky sessions can be a temporary aid, but do not replace shared session design.

#Storage tiers, lifecycle and backup

Product images and PDFs need not live in relational rows. Object storage keeps blobs addressed by keys with metadata; block storage suits disks; file storage provides shared filesystem semantics. Choose by access pattern rather than size alone.

CategoryUseWatch for
Hot or frequent accessActive product imagesStorage, operations and transfer charges
Cool or infrequent accessRarely read invoicesRetrieval fees and service-specific minimum retention
ArchiveLong-term, rarely retrieved recordsPossible restore or rehydration delay

Azure and offer different tiers and conditions; archival tiers do not all have identical offline behavior. Define lifecycle policies using supported age or access signals and review retention requirements, versioning and soft deletion. helps with infrastructure failures; versioned backups and tested restores protect against logical deletion or corruption.

Do not expose invoice buckets or containers publicly. SAS and presigned URLs grant temporary access; review their duration, scope and leakage risk.

#VNets, VPCs and private endpoints

A cloud service is not automatically private. Azure VNets and VPCs provide logical networks, with subnets dividing them. Routes determine paths, security groups or NSGs control allowed traffic, and determines addresses; any of these can cause a timeout.

  1. Define a clear application and data topology with intentional public entry points.
  2. Use the service's appropriate private endpoint or private-access mechanism for private data paths.
  3. Configure private DNS so the usual hostname resolves internally from the application network.
  4. Disable public access where appropriate while preserving a known administration path.
  5. Test identity and permissions separately from network access.

A private endpoint does not provide encryption or authorization; retain and identity controls. Outbound does not create a public inbound application route. Consider NAT charges, transfer costs and overlapping address ranges when connecting networks. Check resolution, route and port reachability before blaming credentials.

#Cost awareness and Infrastructure as Code

Cloud cost includes more than compute: databases, storage operations, egress, , logs, backups and idle resources matter. Tag ownership and environments and configure budgets and alerts; an alert is not a guaranteed spending cap. Compare cost per successful order or request rather than one server bill.

makes infrastructure reviewable and repeatable. Bicep targets Azure; Terraform uses declarative providers and state; Pulumi uses general-purpose languages and also maintains state. This complete Bicep example creates storage in an existing resource group and requires Azure , login and deployment permission. Its derived name meets lowercase and length constraints.

param location string = resourceGroup().location

resource invoices 'Microsoft.Storage/storageAccounts@2023-05-01' = {
  name: 'st${uniqueString(resourceGroup().id)}' // (1)
  location: location
  sku: { name: 'Standard_LRS' }
  kind: 'StorageV2'
  properties: {
    supportsHttpsTrafficOnly: true
    minimumTlsVersion: 'TLS1_2'
    allowBlobPublicAccess: false // (2)
    allowSharedKeyAccess: false
  }
}
output storageName string = invoices.name
🧾 Code walkthrough
  1. (1) Naming is stable for the same resource group. The illustrative SKU provides local, not zone, redundancy.
  2. (2) Anonymous blobs and shared-key access are disabled; data roles and network policy remain necessary. This does not automatically create a private endpoint.

Preview a plan or what-if before applying, protect state because it may contain secrets, and review drift and destructive changes. Avoid making permanent console-only production changes that never return to IaC. See the storage resource reference.

#The 12-factor app and ASP.NET Core deployment

Portability needs more than a container. The twelve factors cover one versioned codebase, explicit dependencies, external configuration, attached backing services, separate build/release/run stages, stateless processes, port binding, process-based concurrency, fast startup and graceful disposal, development/production parity, logs as event streams and separate administrative tasks. These are guidelines; sensitive configuration belongs in a secret store rather than Git.

PathDeployment stepsWatch for
Azure App ServiceSelect a supported runtime or container; deploy an artifact; configure identity, settings and healthPlan, slots and tier-specific network features
Azure Container AppsRegistry image, environment, revision, target port, identity and scaling rulesMinimum replicas, ingress and traffic splitting
Elastic BeanstalkSelect a platform, upload a publish bundle, configure environment and healthRuntime support and platform updates
AWS ECS FargateECR image, task definition, task role, service and load balancerRoutes, security groups, ports and logs

For every path, run migrations separately, observe startup and requests, and exercise smoke tests and rollback. If the managed runtime does not suit .NET 10, consider an appropriate container or self-contained publish where supported; verify current platform support. Do not rely on local files for uploads or sessions. See .NET deployment on Elastic Beanstalk.

Interview questions

Check your reasoning

Why does this choice fit? When would it fail? What changes under higher load or a dependency failure?

23.1How do IaaS, PaaS, SaaS and FaaS differ?Junior
Model answer

I compare them by responsibility. With I manage the operating system and application on rented infrastructure. manages more of the hosting platform while I own code, configuration and data. provides a finished product that I configure and govern. runs event-triggered functions within platform limits. I choose the lowest operational burden that meets the requirements, remembering that none of these models removes responsibility for access control or data protection.

23.2What is the difference between a region and an availability zone?Junior
Model answer

I use a region as a geographic deployment area and availability zones as fault-isolated locations within that region. Distributing instances across zones can improve resilience to a datacenter-level failure, but only if the selected service and configuration support it. It does not protect against every regional failure. I also check where the database, secrets and routing live, because spreading application replicas alone does not make the whole system highly available.

23.3How would you choose between App Service, Container Apps and Kubernetes?Mid
Model answer

I start with the workload and operational requirements. App Service suits managed web hosting with limited infrastructure work. Container Apps suits containerized services and jobs that benefit from revisions and event-driven scaling. Kubernetes provides more orchestration control and ecosystem flexibility but brings substantial operational responsibility. I evaluate networking, scaling, compliance and deployment needs, then choose the simplest platform that satisfies them rather than adopting Kubernetes just because the application already has a Dockerfile.

23.4What is the AWS equivalent of Azure Blob Storage?Junior
Model answer

I would map Azure Blob Storage to Amazon S3 at the capability level: both provide object storage suitable for images, documents and other blobs. I would not assume identical , access policies, lifecycle rules or storage classes. For a migration I review naming, metadata, signed access, retention and transfer cost. I also distinguish object storage from a shared filesystem because applications cannot always replace one with the other without changing their access pattern.

23.5Why prefer managed identity or workload roles to stored keys?Mid
Model answer

I prefer workload identity because the application can obtain short-lived credentials without carrying a long-lived key in configuration. Azure managed identities and workload roles support that pattern. I grant only the permissions the workload needs and separate identities between services and environments. This reduces secret distribution and rotation work, but does not remove authorization or network controls. I still verify the selected identity, data-plane permissions and audit trail when troubleshooting access failures.

23.6What causes a serverless cold start?Mid
Model answer

I call it a cold start when the platform must initialize a new execution environment before handling work. That can include runtime startup, loading dependencies and application initialization. The impact depends on the service, plan and application, so I measure it rather than quoting a universal delay. I reduce startup work and consider minimum instances or provisioned capacity where available, while recognizing that those options trade some idle-cost savings for more predictable .

23.7When would serverless be a poor fit?Mid
Model answer

I would question serverless for sustained heavy work, execution exceeding service limits, or a workload requiring very predictable low without paying for warm capacity. It can also complicate tightly coupled workflows and local debugging. I compare a realistic cost and latency model with a managed container service or job. Serverless can still be appropriate, but I would not choose it solely because the workload is small or because the billing model is consumption based.

23.8What is vertical versus horizontal scaling?Junior
Model answer

I scale vertically by giving one instance more resources and horizontally by adding instances. Vertical scaling is simpler for some workloads but has size limits and may involve a restart. Horizontal scaling supports distribution but requires safe shared-state handling and routing. I move durable state outside process memory and check downstream capacity. Adding application replicas does not automatically increase database and can actually overload it through more connections and concurrent operations.

23.9How would you design autoscaling rules?Senior
Model answer

I choose metrics that reflect the workload's bottleneck, such as for computation or queue age and backlog for workers. I define minimum and maximum capacity, stabilization rules and enough headroom for startup delay. I verify that database pools and downstream concurrency stay within limits as replicas grow. I also test scale-in, including draining and retry safety, because a rule that scales out well can still lose work when instances are removed.

23.10How do you choose an object-storage tier?Mid
Model answer

I choose a tier from access frequency, retention period and acceptable retrieval delay. Hot storage suits active objects, infrequent-access tiers can suit rarely read records, and archival tiers may suit long retention with delayed retrieval. I include operations, retrieval and transfer charges rather than comparing storage price alone. I also check minimum retention and lifecycle rules, because moving short-lived or frequently read data into a colder tier can increase the total cost.

23.11Does a private endpoint make a service secure automatically?Senior
Model answer

I treat a private endpoint as one network-access control, not complete security. I still need correct , routing, , identity and authorization, and I review whether the public endpoint remains enabled. A workload with network reachability can still be unauthorized, while a valid identity can still be blocked by network policy. I test those dimensions separately and retain a controlled administration path so private networking does not make recovery depend on undocumented access.

23.12What are RTO and RPO?Senior
Model answer

I use to describe the target time to restore service after a disruption and to describe the acceptable data-loss window. They guide backup frequency, , standby capacity and recovery automation. I agree them with the business rather than deriving them from whatever infrastructure already exists. I then test recovery end to end, including permissions and routing, because a backup schedule or replication dashboard alone does not prove either objective can be met.

23.13What does Infrastructure as Code solve?Mid
Model answer

I use Infrastructure as Code to make infrastructure changes reviewable, repeatable and traceable alongside application changes. Bicep is Azure focused, while Terraform and Pulumi support broader provider ecosystems with state management. I preview changes, protect state and credentials, and investigate drift from manual edits. reduces undocumented setup, but it can also repeat a mistake very efficiently, so destructive plans and permissions deserve the same careful review as production code.

23.14How do you control cloud costs without hurting reliability?Senior
Model answer

I establish ownership tags, budgets and a cost-per-business-outcome baseline, then inspect idle resources, oversized capacity, transfer charges and telemetry retention. I right-size using measurements and keep enough headroom to meet the reliability objective. I also review autoscale maximums and database connection growth. Budget alerts help detect surprises but are not guaranteed spending caps. I verify the impact of each change rather than cutting replicas or backups simply because they appear expensive.

23.15How would you deploy an ASP.NET Core service to AWS?Mid
Model answer

I would choose a suitable managed path, such as Elastic Beanstalk for a supported publish bundle or ECS with Fargate for a container image. For Fargate I publish to ECR, define task resources and a task role, configure networking and a service behind a load balancer, and verify health and logs. I keep migrations separate, use managed secrets and test rollback. I confirm current runtime support before selecting the platform version.

23.16Which 12-factor ideas matter most when scaling a .NET API?Senior
Model answer

I pay particular attention to stateless processes, explicit configuration, attached backing services and graceful disposal. Replicas should not depend on local uploads or in-memory sessions, and logs should flow to collection rather than disappear with an instance. Separating build, release and run helps promote the same artifact with different configuration. These principles improve portability, but I still evaluate platform-specific identity and storage behavior rather than treating the checklist as a complete cloud architecture.

Test yourself

Quiz answers and completed-topic marks are saved in this browser; they do not sync across devices.

Score: 0 / 0

Who normally patches the guest OS in IaaS?

leaves guest management to the customer.

What does spreading replicas across zones primarily address?

A regional outage requires additional recovery design.

Closest AWS capability to Azure Blob Storage?

Both provide object storage, with different detailed contracts.

A managed identity exists but Blob reads return 403. What should you inspect?

An identity does not automatically have data-plane access.

Why can scaling an API from 2 to 20 replicas cause database failures?

Downstream capacity must be checked as replicas increase.

Which recovery objective describes the acceptable data-loss window?

concerns data loss; concerns recovery time.

What is missing from a private endpoint alone?

Networking is one control; identity, and permissions remain necessary.

What should happen before applying a production IaC change?

A preview exposes replacements and destructive changes before execution.

An archive tier is best evaluated using which requirements?

Storage price alone is not total cost.

Which statement about budget alerts is safest?

Understand notification behavior and any separate automation.