3.2 コンピュート
Azure Compute Services
Azureのコンピュートサービスは、Virtual Machines(IaaS)からApp Service(PaaS)、Functions(サーバーレス)まで、抽象度の異なる選択肢を提供する。Windows Server環境との親和性が高いことが特徴である。
Virtual Machines
@startuml
skinparam backgroundColor #FEFEFE
rectangle "リソースグループ" as RG #F3F4F6 {
rectangle "VNet" as VNet #E5E7EB {
rectangle "サブネット" as Subnet #DBEAFE {
rectangle "Virtual Machine" as VM #93C5FD {
rectangle "OS Disk\n(Managed Disk)" as OSDisk #60A5FA
rectangle "Data Disk\n(オプション)" as DataDisk #60A5FA
rectangle "NIC" as NIC #60A5FA
}
}
}
rectangle "NSG\n(セキュリティグループ)" as NSG #FCA5A5
rectangle "Public IP\n(オプション)" as PIP #FEF3C7
}
rectangle "可用性オプション" as Avail #D1FAE5 {
rectangle "可用性セット" as AS #6EE7B7
rectangle "可用性ゾーン" as AZ #6EE7B7
rectangle "VMSS\n(スケールセット)" as VMSS #6EE7B7
}
NSG --> Subnet
PIP --> NIC
VM --> Avail
@enduml
図1: Azure Virtual Machineの構成要素
| VMシリーズ | 用途 | AWSとの対応 |
|---|---|---|
| Bシリーズ | バースト可能、開発/テスト | T3 |
| Dシリーズ | 汎用、Webサーバー | M5/M6i |
| Eシリーズ | メモリ最適化、DB | R5/R6i |
| Fシリーズ | コンピュート最適化 | C5/C6i |
| NCシリーズ | GPU(NVIDIA)、ML | P4d |
App Service(PaaS)
@startuml
skinparam backgroundColor #FEFEFE
rectangle "App Service" as AppService #D1FAE5 {
rectangle "App Service Plan\n(ホスティングプラン)" as Plan #6EE7B7 {
rectangle "Web App 1" as App1 #34D399
rectangle "Web App 2" as App2 #34D399
rectangle "API App" as API #34D399
}
}
rectangle "デプロイソース" as Deploy #DBEAFE {
rectangle "GitHub" as GH #93C5FD
rectangle "Azure DevOps" as DevOps #93C5FD
rectangle "Local Git" as LocalGit #93C5FD
rectangle "Docker Hub" as Docker #93C5FD
}
rectangle "統合サービス" as Integrated #FEF3C7 {
rectangle "Azure SQL" as SQL #FDE68A
rectangle "Entra ID" as AD #FDE68A
rectangle "Key Vault" as KV #FDE68A
}
Deploy --> AppService : CI/CD
AppService --> Integrated : 接続
note bottom of Plan
料金プラン:
- Free/Shared: 開発用
- Basic: 小規模本番
- Standard: 自動スケール
- Premium: 高性能
end note
@enduml
図2: App Serviceのアーキテクチャ
App Serviceは、Webアプリケーション、REST API、モバイルバックエンドをホストするフルマネージドのPaaSサービスである。.NET、Java、Node.js、Python、PHP等をサポートし、デプロイメントスロットによるBlue-Greenデプロイも可能 [1]。
Azure Functions
@startmindmap skinparam backgroundColor #FEFEFE * Azure Functions ** トリガー *** HTTP *** Timer (cron) *** Blob Storage *** Queue Storage *** Event Grid *** Cosmos DB ** ホスティングプラン *** 従量課金プラン **** 自動スケール **** コールドスタート **** 無料枠あり *** Premiumプラン **** ウォームインスタンス **** VNet統合 *** App Serviceプラン **** 既存リソース活用 **** 予測可能なコスト left side ** Durable Functions *** オーケストレーション *** 長時間実行ワークフロー *** ステートフル関数 ** AWS Lambdaとの違い *** 最大実行時間長い *** バインディング機能 *** Logic Appsとの統合 @endmindmap
図3: Azure Functionsの特徴
| 特性 | AWS Lambda | Azure Functions |
|---|---|---|
| 最大実行時間 | 15分 | 無制限(Premiumプラン) |
| 入出力バインディング | なし | あり(宣言的接続) |
| ワークフロー連携 | Step Functions | Durable Functions / Logic Apps |
| ローカル開発 | SAM CLI | VS Code拡張機能 |
Azure Functions のバインディング
入力/出力バインディングにより、トリガーソースやデータストアとの接続コードを書かずに宣言的に定義できる。これはAWS Lambdaにはない特徴である。
入力/出力バインディングにより、トリガーソースやデータストアとの接続コードを書かずに宣言的に定義できる。これはAWS Lambdaにはない特徴である。
出典
[1] Microsoft. App Service Documentation. https://docs.microsoft.com/azure/app-service/
[2] Microsoft. Azure Functions Documentation. https://docs.microsoft.com/azure/azure-functions/
[2] Microsoft. Azure Functions Documentation. https://docs.microsoft.com/azure/azure-functions/
発展学習
→ Azure VM Scale Sets
→ Durable Functions patterns
→ Azure VM Scale Sets
→ Durable Functions patterns