Skip to content

Latest commit

 

History

History
112 lines (80 loc) · 5.23 KB

6.4. Cost Optimization Best Practices.md

File metadata and controls

112 lines (80 loc) · 5.23 KB

Cost Optimization Best Practices

Save on infrastructure

Use Azure credits

  • $50 per month for Visual Studio Professional, $150 per month for Visual Studio Enterprise
  • Separate Azure subscription under your account that renews each month while you remain an active Visual Studio subscriber
  • ❗No SLA, development and testing only
    • Azure suspends VMs used for production or that run more than 120 hours.

Use spending limits

  • ❗ Not available on pay-only subscriptions, only for subscriptions with a monthly Azure credits.
  • Helps you to prevent from exhausting the credit on your account within each billing period.
    • Resets after each period
  • Activated by default, you can adjust the spending limit as desired or turn it off.

Use reserved instances

  • Purchase Windows/Linux VMs for one-year or three-year terms with payment of entire period or monthly.
  • Allows to save save up to 70 to 80 percent off the pay-as-you-go cost
  • 💡 Good for static and predictable virtual machines.

Choose low-cost locations and regions

  • Prices vary across locations and regions
  • 💡 Good idea to use them in locations and regions where they cost less.
  • ❗ Consider also that moving data between locations can cost extra and total price can get more expensive.
    • Good idea to have them in same region to reduce egress (outgoing network bandwith) traffic between them.

Research available cost-saving offers

  • Keep up to date with offers, and switch to ones with most benefits
  • See Azure Updates for updates, roadmaps and announcements.

Right-size underutilized virtual machines

  • Over-sized virtual machines are a common unnecessary expense on Azure
  • Azure Cost Management & Azure Advisor might recommend right-sizing or shutting down VMs.
  • Right-sizing = resizing it to a proper size
    • E.g. downgrading Standard_D4sv3 with 90% idle VM to Standard_D2sv3 to reduce 50% cost.
  • ❗ Resizing a VM requires it to be stopped, resized, and then restarted.
    • 💡 Takes a few minutes so plan for an outage, or shift your traffic to another instance

Deallocate virtual machines in off hours

  • No need to run VMs every hour of every day if they're only used during certain periods.
  • Shut down when not in use and start back up on a schedule
    • Saves money on compute costs, 📝 but you still pay for storage.
  • Can use automation accounts or auto-shutdown feature on a virtual machine to schedule automated shutdowns.

Delete unused virtual machines

  • Saves you on infrastructure costs but also potentially on licensing and operations.

Migrate to PaaS or SaaS services

  • Evaluate your architecture if it's beneficial to move to PaaS.
    • Azure operateS hardware efficiently and therefore offer PaaS services cheaper.
  • Neutral evolution is to go from IaaS to PaaS iteratively when moving to cloud.
  • PaaS saves on resource and operational costs.
  • Effort varies
    • SQL Server to => Azure SQL Database is very easy.
    • Hard to move multi-tier application to a container or serverless-based architecture
      • No quick winds from cost-saving perspective
  • Azure Architecture Center can give ideas for transforming application & best-practices.

Save on licensing costs

Linux vs. Windows

  • The cost of the product can be different based on the OS you choose.
  • Useful to compare pricing to determine whether you can save money.

Azure Hybrid Benefit

  • Allows you to use existing
    • on-premises Windows Server licenses on Azure VMs. (Azure Hybrid Benefit for Windows Server)
    • SQL Server licenses for Azure SQL Databases. (Azure Hybrid Benefit for SQL Server)
  • Pay only linux rates for those virtual machines
  • ❗ Through Software Assurance licenses only.

Use Dev/Test subscription offers

  • If you're on Enterprise Agreement: Enterprise Dev/Test
  • Discounts:
    • No license charges for Windows workloads, only billing you at the Linux rate
    • SQL Server & other software under Visual Studio subscription (formerly known as MSDN) are included.
  • ❗Users (except testers) must be covered under a Visual Studio subscription
  • ❗Only for non-production workloads

Bring your own SQL Server license

  • ❗ For customers with Enterprise Agreement
  • Use unused on-prem licenses on Azure
  • In Azure marketplace search for BYOL SQL

Use SQL Server Developer Edition

  • Free product for nonproduction use.
  • Has all the same features that Enterprise Edition has
  • Can find SQL Server images for Developer Edition on the Azure Marketplace for development & testing.

Use constrained instance sizes for database workloads

  • Many have high requirements for memory, storage, or I/O bandwidth.
    • Often have low requirements for CPU core counts
  • Can use VM sizes with lower vCPU count
  • Databases like SQL Server and Oracle are licensed per CPU
    • Allows you to reduce licensing cost by up to 75 percent.