Azure API ManagementのAvailability Zoneサポート

このエントリは2021/04/22現在の情報に基づいています。将来の機能追加・変更に伴い、記載内容との乖離が発生する可能性があります(2021/05/26に情報追加)。

先日、Azure API Management(以下、APIM)でAvailability Zone(可用性ゾーン)がサポートされた。これはAPIMにデプロイできるようになったことと、デプロイ後にAvailability Zoneを利用できるように構成変更できるようになったことを意味する。さらに2021/05/26のBuildでも発表された。

制約事項

  • Premium SKUのみで利用可能
  • 現時点では、Availability ZoneへのデプロイはARMテンプレートを活用したデプロイのみ
  • Azure Portalを利用する場合は、Availability Zoneが使えるリージョンにPremium SKUのインスタンスを作成後に構成変更する必要がある
  • Azure CLIでのaz apim createやPowerShellのNew-AzApiManagementを使ったデプロイは現時点ではできない

ドキュメントは以下を参照。

Azure API Management の可用性ゾーンのサポート / Availability zone support for Azure API Management
https://docs.microsoft.com/azure/api-management/zone-redundancy

Availability Zoneへのデプロイを可能にしているARMテンプレートが公開されている。

Deploy API Management into Availability Zones
https://azure.microsoft.com/en-us/resources/templates/101-api-management-simple-zones/

GitHubから見るならこちら。

Very simple deployment of a Azure API Management in an Availability Zone
https://github.com/Azure/azure-quickstart-templates/tree/master/101-api-management-simple-zones

Azure Portalからデプロイして、構成を変更

Premium SKUでインスタンスを作成し、しばし待つとできあがるので、Deployment & Infrastructureの場所を開く。今回は東日本リージョンで作成したので、東日本をクリックすると、可用性ゾーンの設定ができる。なお、ゾーンの個数だけユニットを増やしておく必要がある。

以下の例は外部公開用API Managementインスタンスの場合で、この場合はパブリックIPアドレス(Standard SKU)が必要。ゾーン冗長のIPを作成しておくと簡単。

ARM Templateを使ってデプロイ

まずは、リソースグループを作成。

$ az group create -n apim-zone -l japaneast

実行すると以下のようなJSONが出るので、Succeededになっていることを確認。

{
  "id": "/subscriptions/{Subscription ID}/resourceGroups/apim-zone",
  "location": "japaneast",
  "managedBy": null,
  "name": "apim-zone",
  "properties": {
    "provisioningState": "Succeeded"
  },
  "tags": null,
  "type": "Microsoft.Resources/resourceGroups"
}

このリソースグループにAPI Managementインスタンスを作成する。ARMテンプレートを使ったデプロイは以下のよう。パラメータを渡したいのであれば、--parameters オプションを使って渡してあげるという、いつものお作法でOK。

$ az group deployment create -g apim-zone --template-uri https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-api-management-simple-zones/azuredeploy.json --parameters @myparameters.json

--parameters オプションを使って渡さない場合は、途中で以下の入力を求められる。なお、このARMテンプレートは最もシンプルなもの(換言するとほぼハードコードされている)ゆえ、インスタンス名やその他細かい設定は指定できない。指定したい場合にはARMテンプレートに手を入れる必要がある。

publisherEmailサービス利用者のメールアドレス
publisherNameサービス利用者の名前

出力結果は以下。当方のテストにおいて所要時間は35分30秒ぐらい。

{
  "id": "/subscriptions/{Subscription ID}/resourceGroups/apim-zone/providers/Microsoft.Resources/deployments/azuredeploy",
  "location": null,
  "name": "azuredeploy",
  "properties": {
    "correlationId": "08470636-747f-4834-bfd2-bec9803e8da8",
    "debugSetting": null,
    "dependencies": [],
    "duration": "PT35M29.8527266S",
    "error": null,
    "mode": "Incremental",
    "onErrorDeployment": null,
    "outputResources": [
      {
        "id": "/subscriptions/{Subscription ID}/resourceGroups/apim-zone/providers/Microsoft.ApiManagement/service/{API Management Instance}",
        "resourceGroup": "apim-zone"
      }
    ],
    "outputs": null,
    "parameters": {
      "availabilityZones": {
        "type": "Array",
        "value": [
          "1",
          "2",
          "3"
        ]
      },
      "location": {
        "type": "String",
        "value": "japaneast"
      },
      "publisherEmail": {
        "type": "String",
        "value": "{publisherEmail}"
      },
      "publisherName": {
        "type": "String",
        "value": "{publisherName}"
      },
      "sku": {
        "type": "String",
        "value": "Premium"
      },
      "skuCount": {
        "type": "Int",
        "value": 3
      }
    },
    "parametersLink": null,
    "providers": [
      {
        "id": null,
        "namespace": "Microsoft.ApiManagement",
        "registrationPolicy": null,
        "registrationState": null,
        "resourceTypes": [
          {
            "aliases": null,
            "apiProfiles": null,
            "apiVersions": null,
            "capabilities": null,
            "defaultApiVersion": null,
            "locationMappings": null,
            "locations": [
              "japaneast"
            ],
            "properties": null,
            "resourceType": "service"
          }
        ]
      }
    ],
    "provisioningState": "Succeeded",
    "templateHash": "1954741353723787288",
    "templateLink": {
      "contentVersion": "1.0.0.0",
      "id": null,
      "queryString": null,
      "relativePath": null,
      "uri": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-api-management-simple-zones/azuredeploy.json"
    },
    "timestamp": "2021-04-22T02:18:06.774659+00:00",
    "validatedResources": null
  },
  "resourceGroup": "apim-zone",
  "tags": null,
  "type": "Microsoft.Resources/deployments"
}

デプロイが完了すると、publisherEmailで指定したメールアドレスに対して、デプロイ完了の旨のメールが送信される。

見てみよう

Azure Portalの概要ページを見ても、Availability Zoneを利用しているか否かはわからない。

az apim showで見ても、Availability Zoneを利用していることを示す出力はない。

{
  "additionalLocations": null,
  "apiVersionConstraint": {
    "minApiVersion": null
  },
  "certificates": null,
  "createdAtUtc": "2021-04-22T01:42:59.999838+00:00",
  "customProperties": {
    "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": "False",
    "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": "False",
    "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": "False",
    "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": "False",
    "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": "False",
    "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": "False",
    "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": "False",
    "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": "False"
  },
  "developerPortalUrl": "https://{API Management Instance}.developer.azure-api.net",
  "disableGateway": false,
  "enableClientCertificate": null,
  "etag": "AAAAAAALQEc=",
  "gatewayRegionalUrl": "https://{API Management Instance}-{region}-01.regional.azure-api.net",
  "gatewayUrl": "https://{API Management Instance}.azure-api.net",
  "hostnameConfigurations": [
    {
      "certificate": null,
      "certificatePassword": null,
      "defaultSslBinding": true,
      "encodedCertificate": null,
      "hostName": "{API Management Instance}.azure-api.net",
      "keyVaultId": null,
      "negotiateClientCertificate": false,
      "type": "Proxy"
    }
  ],
  "id": "/subscriptions/{Subscription ID}/resourceGroups/{ResourceGroup}/providers/Microsoft.ApiManagement/service/{API Management Instance}",
  "identity": {
    "principalId": "{guid}",
    "tenantId": "{guid}",
    "type": "SystemAssigned",
    "userAssignedIdentities": null
  },
  "location": "{region}",
  "managementApiUrl": "https://{API Management Instance}.management.azure-api.net",
  "name": "{API Management Instance}",
  "notificationSenderEmail": "apimgmt-noreply@mail.windowsazure.com",
  "portalUrl": "https://{API Management Instance}.portal.azure-api.net",
  "privateIpAddresses": null,
  "provisioningState": "Succeeded",
  "publicIpAddresses": [
    "{Public IP}"
  ],
  "publisherEmail": "{publisherEmail}",
  "publisherName": "{publisherName}",
  "resourceGroup": "{ResourceGroup}",
  "scmUrl": "https://{API Management Instance}.scm.azure-api.net",
  "sku": {
    "capacity": 3,
    "name": "Premium"
  },
  "tags": {},
  "targetProvisioningState": "",
  "type": "Microsoft.ApiManagement/service",
  "virtualNetworkConfiguration": null,
  "virtualNetworkType": "None"
}

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト /  変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト /  変更 )

%s と連携中