Stan
Stan

Reputation: 86

How to put an HTTP Gateway on top of Azure Container Instances?

I would like to use Azure Container Instances behind a gateway (HTTP) to avoid an idle infrastructure when there is no traffic.

Something which looks like this.

enter image description here

There is something like that available in Azure ? (like API Gateway in AWS)

Best

Upvotes: 5

Views: 7013

Answers (2)

Manuel Salvadores
Manuel Salvadores

Reputation: 16525

There is an Azure template that integrates Application Gateway with Container Instances here. In the example ACIs are deployed in a VNET and the Applications Gateway serves as entry point to the APIs.

You can probably accommodate that templates to fit your requirements.

Upvotes: 2

JJCV
JJCV

Reputation: 326

Step by step:

  1. Upload your images to Container Registry
  2. Create two separate container instances.
    • Image Type: Private
    • Fill all required fields, be sure to include the container registry hos name in the image name (the container name can be anything)
    • Expose your ports in the networking tab
    • Add a dns name label. Why? Ip can change, see this docs.
    • Add your env variables if any
    • It should create them without any problem. Try to access to the dns provided and check if the sites are running properly.
  3. Create new Application Gateway
    • Fill all required fields (name, tier, whatever...). Use Tier Standard V2.
    • Public frontend, create new IP address if needed.
    • Add two bakend pools, use IP or Hostname and provide the dns created in step 2 for each ACI
    • Add a route: Listener Type: Basic. In Backend targets fill with target type = backend pool, select one of your backend pools and create a new http setting. Literraly fill it with whatever values you want, I coulnd't get this to work in the first page, ever, so I always edit it later.
    • Add yout tags
    • Hit create
    • When it finishes go to your newly created appGateway and search for HTTP Settings.
    • These are the connection parameters that the appGW uses to connect to your backend, if your backends listens in the same port, the same path and so on you can reuse the HTTP Setting, if it doesn't create 2.
    • Go to rules and create a path-based rule.
    • Check your only listener, the default backend and the setting associated with it.
    • Add a path to your second backend name=endpoint2;paths=_/endpoint2/*_BackendPool=backend2;HTTPSetting=backend2HTTPSetting

And that's it!

Upvotes: 1

Related Questions