Yatendrasinh Joddha
Yatendrasinh Joddha

Reputation: 222

Bind SSL to Azure Container Instance

I have created node js api and hosted it in Azure Container Instance using registry. I am using my API using FQDN. Now I want to bind SSL Certificate to this instance. Is there any way to do so? I searched for solution but didn't found any.

Upvotes: 0

Views: 1306

Answers (1)

Nancy Xiong
Nancy Xiong

Reputation: 28204

You can create a container group with an application container and a sidecar container running an SSL provider.

According to this document, you will do these:

  • Create a self-signed certificate. For production scenarios, you should obtain a certificate from a certificate authority.
  • Configure Nginx to use SSL. You create a configuration file for Nginx to use SSL. Base64-encode the Nginx configuration file, the SSL certificate, and the SSL key. Then, you enter the encoded contents in a YAML file used to deploy the container group.
  • Deploy container group by specifying the container configurations in a YAML file.

For example, you could edit the following YAML file to meet your requirements.

api-version: 2018-10-01
location: westus
name: app-with-ssl
properties:
  containers:
  - name: nginx-with-ssl
    properties:
      image: nginx
      ports:
      - port: 443
        protocol: TCP
      resources:
        requests:
          cpu: 1.0
          memoryInGB: 1.5
      volumeMounts:
      - name: nginx-config
        mountPath: /etc/nginx
  - name: my-app
    properties:
      image: mcr.microsoft.com/azuredocs/aci-helloworld
      ports:
      - port: 80
        protocol: TCP
      resources:
        requests:
          cpu: 1.0
          memoryInGB: 1.5
  volumes:
  - secret:
      ssl.crt: <Enter contents of base64-ssl.crt here>
      ssl.key: <Enter contents of base64-ssl.key here>
      nginx.conf: <Enter contents of base64-nginx.conf here>
    name: nginx-config
  ipAddress:
    ports:
    - port: 443
      protocol: TCP
    type: Public
  osType: Linux
tags: null
type: Microsoft.ContainerInstance/containerGroups

Upvotes: 1

Related Questions