Skip to content

Latest commit

 

History

History
215 lines (181 loc) · 8.24 KB

5. Compute - Virtual machines (VMs).md

File metadata and controls

215 lines (181 loc) · 8.24 KB

Virtual Machines (VMs)

Concepts

  • Storage resource provider (SRP)
    • Disks (blob)
    • Storage account
  • Compute resource provider (CRP)
    • VMs
  • Networking resource provider (NRP)
    • NICs, IP addresses, subnets load balancers..

Common VM Operations

Moving a VM

  • Helps for
    • high availability
    • reduce latency for serving from VMs closer to users
  • 💡 You can move virtual machines with the managed disks & in Availability Zones across subscriptions and VMs.
    • ❗ Not supported:
      • Virtual Machine Scale Sets.
      • Virtual machines created from Marketplace resources with plans attached
  • ❗ To move a virtual machine with a network interface card, you must move all dependent resources.
    • E.g. • virtual network for the network interface card • all other network interface cards for the virtual network • VPN gateways
  • Virtual networks (classic) can't be moved.
  • Can move across regions using

Stopping a VM

  • Deallocation
    • ❗ If you shut down a VM inside VM, Azure still keeps the resources
      • 💡 Deallocate instead
  • Auto shutdown
    • VM blade in Portal

Removing a VM*

  • Deleting VM doesn't remove dependencies such as NICs, storages, OS/data disks, IP addresses
  • 💡 Delete resource group instead, or use taxonomic tags
  • PowerShell or CLI allows you to keep OS and/or Data disks

Azure VM Extensions

  • Extends VM capabilities
  • Requires Azure VM Agent (different for Windows or Linux)
    • Marketplace images already have it
    • For lift & shift, install agent first before uploading to cloud
  • VM Access
    • Backdoor to reset VM password reset
    • Allows to modify RDP/SSH configurations
  • VM Backup
    • Allows to back-up VMs and configurations to recovery vault
  • Custom Script
    • Allows Desired State Configuration (DSC)
      • You can script in Linux (bash), Windows (PowerShell)
      • Puppet, chef etc
  • Microsoft Monitoring Agent
    • Onboards VM in Log Analytics

Sizing

  • Allows vertical scaling, e.g. CPU, RAM and other resources

  • ❗ Resizing requires rebooting VM.

  • Azure Compute Unit (ACU)

    • Standardization without any hardware details
    • 100 ACU = Small (Standard A1) VM
      • A = Family
      • 1 = Size (versioned)
    • DS_V3 = 160-190 ACU
    • Good for estimating for lift and shift.
    • As you raise ACU, per minute runtime charges increases.
  • Types

    Type Sizes Description
    General purpose B, Dsv3, Dv3, DSv2, Dv2, DS, D, Av2, A0-7 Balanced CPU-to-memory ratio. Ideal for testing and development, small to medium databases, and low medium traffic web servers.
    Compute optimized Fsv2, Fs, F High CPU-to-memory ratio. Good for medium traffic web servers, network appliances, batch processes, and application servers.
    Memory optimized Esv3, Ev3, M, GS, G, DSv2, DS, Dv2, D High memory-to-CPU ratio. Great for relational database servers, medium to large caches, and in-memory analytics.
    Storage optimized Ls High disk throughput and IO. Ideal for Big Data, SQL and NoSQL databases.
    GPU NV, NC, NCv2, NCv3, ND Specialized virtual machines targeted for heavy graphic rendering and viedo editing, as well as model training and inferencing (ND) with deep learning. Available with single or multiple GPUs
    High performance compute H, A8-11 Our fastest and most powerful CPU virtual machines with high-throughput network interfaces (RDMA).

Disk Types

  • OS Disk
    • ❗ Generation 1. VHD only
      • If you use Generation 2 Hyper-V you need to convert from .vhdx to .vhd.
    • Registered as SATA drive
    • ❗ Maximum capacity of 1 TB
  • Data Disk
    • Dependent # on VM instance size
    • Registered as SCSI disk
    • ❗ Max capacity 4 TB
  • Temprorary Disk
    • D: or /dev/sdb1
    • Bound to the hardware host
    • Do not store permanent data!

Storage

Standard vs. Premium Disk Storage

  • Standard Disks
    • Backed by cost-effective HDDs
    • High availability: several replication options
    • Stored in Azure storage account
    • Standard SSD available for managed disks (dev/test/entry elvel production applications)
    • Standard storage provides maximum IOPS values for each VHD
    • On portal
      • You can see disks in Azure Disks.
      • Azure names managed disks like dc1_data-disk1, dc1_OSDisk for a VM named dc.
      • By clicking on it, you can manage the disk.
        • You can e.g. export, create a snapshot
  • Premium Disks
    • Backed by high-speed SSDs
    • IOPS values are predictable, expected performance levels
    • Pre-pay for all storage used (fixed sized disk sizes)
      • 💡 Predictable speed and IOPS
      • P10, 128 GB, 500 IOPs, 50 MB/sec
    • ❗ Supports only Generation 1 VHD
      • If you use Generation 2 Hyper-V you need to convert from .vhdx to .vhd.
      • 💡 Azure Site Recovery migration handles this automatically
      • On portal
        • You can see unmanaged disks in Blob Containers → VHDs → you see VHDs
        • A security problem is that someone by mistake can give public access to the blobs in the storage account.

Managed vs. unmanaged Disk Storage

  • Unmanaged Disks
    • Original method to store VM VHDS
      • Legacy
    • VHDS are stored as page blobs in an Azure storage account
    • ❗ Maximum 256 TB of storage per VM
    • ❗ You need to manage storage account availability
    • ❗ 20,000 IOPS limit across all VM disks in a standard storage account
    • In storage account they're in Blob Containers → VHDS container.
      • They're leased
        • They a re locked
        • You need to stop & deallocate VMs to delete them
      • You can break lease in Storage Explorer by right clicking
  • Managed Disks
    • 💡 Always use
    • Azure manages the disks, you don't have to worry about storage account-level IOPS restrictions.
    • Pre-pay for disk size (no need for SA)
      • S10, 128 GB, 500 IOPS, 60 MB/sec
    • Supports Standard and Premium SSD and Standard HDD
    • ❗ LRS replication only for Premium managed disks
    • ❗ You can resize only when they're unattached or owner VM is stopped & deallocated

Costs

  • Use Azure Pricing Calculator
  • Optimizing costs
    • 💡 Reserved Virtual Instances are the cheapest option.
      • You pay 1 to 3 year term for a particular VM instance size in aspecific region.
    • 💡 Reuse on-prem Microsoft licensens, up to 49% discount
  • VM Chooser (azurevmchooser.kvaes.be)
    • Open source applications to get recommendations
      1. Give total VCPUs, RAMs etc.
      2. Select a recommended VM
      3. VM optimizer: Choose usage patterns, region etc.

IP addressing

  • You always have a private IP and you can optionally have a public IP
  • Public IP addresses
    • Best practice is to never have a public IP
      • Consider a load balancer to map the private IP.
    • First 5 public IPs are free then it costs
    • You have to NSG with an public IP
    • Public IPv4 addresses can be associated with:
      • VM vNICs, public load balancers, VPN gateways, and application gateways
    • Public IP Address SKUs
      • Basic SKU
        • Open by default
        • Static or dynamic allocation
      • Standard SKU
        • Secure by default (NSG)
        • Static allocation only
        • HA: Availability zone aware, can span to different availability zones
  • DNS Naming
    • For VMs you can configure & use host name
    • VM -> Overview -> Configure DNS Name then you can have like somename.eastus2.cloudapp.azure.com

Monitoring

Boot Diagnostics

  • Periodic screenshots of the console
  • Enables serial console
    • You can connect to VM when you can't SSH/RDP for fixing e.g. boot state
    • Requires you to have VM Contributor or higher privileges.
    • No need to open SSH/RDP ports

Guest OS diagnostics

  • Requires storage account
  • Event logs, performence counters etc.
  • Lowest level IaaS monitoring extension
  • For more diagnostics:
    • Windows: AzurePerformanceDiagnostics
    • Linux: Linux Diagnostic Extension (LAD) 3.0

Azure Log Analytics

  • Enabled by deploying the Microsoft Management Extension
  • Onboards VMs into Log Analytics workspace

System Center Operations Manager (SCOM)

  • Hybrid cloud approach
  • You can track your cloud VMs on on-premises or visa versa