API Management - Hands-on Lab Script

Home

Additional Topics - Self-hosted Gateway

With the API Management self-hosted gateway, organisations have the ability to deploy an instance of the APIM gateway component to the environments where they host their applications and/or APIs - for example, in an on-premise data center.

The self-hosted gateways are hosted in a Docker or Kuberenetes environment, and are managed from the API Management service they are connected to.

This part of the lab assumes that the user has Docker Desktop installed. Installation instructions are here

There are two terms to become familiar with:

There can be multiple Gateway Deployments and multiple Gateway Nodes. The Gateway Deployments are chargeable - the Gateway Nodes are free i.e. an organization pays for the management control plane, but the compute is free (you are running on the organizations own hardware)

Deploy the Self-hosted Gateway

To deploy a self-hosted gateway:

The added gateway will appear in the list … this is the Gateway Deployment.

docker run -p 80:8080 -p 443:8081 --name OnPremiseGateway --env-file env.conf mcr.microsoft.com/azure-api-management/gateway:latest

From a command line - elevated to Administrator (needed for Docker commands)

The first time this is executed, it will need to pull down the Docker image - and so there will be a small delay. Subsequently - if restarted - it will just use the downloaded image.

Once downloaded, the log output from the container will display a Sputnik logo (this was an internal code name) and some diagnostic logs.

Note that in the Gateway blade we can see the status - it will show there is one healthy Gateway Node connected to the Deployment. The Gateway Node will keep in sync, and be automatically updated should any of the Gateway Deployment config changes.

Testing the API

Our Gateway Node is now deployed - and we can test that it works.

Diagnostics for the API call will be logged by the container.


Home