Attaching a static ip address to Azure Container Instance
Asked Answered
S

3

3

Is there any way we can attach an fixed ip address to Azure Container Instance(ACI).

In AWS we can attach an elastic ip to ec2 instances, but in Azure we have not used any VM , we took Azure Container Instance as a service.

The ip address of Azure container instance will change if we stop and start the Azure Container Instance, but how to create a fixed ip address in Azure ( like Elastic Ip in AWS) and attach to Azure Container Instance.

Thanks in Advance :)

Stercoricolous answered 3/12, 2019 at 6:28 Comment(1)
Do you solve the problem with my answer? If yes, please accept it. Or give the updates for more help!Westerman
H
2

Solution for me

My solution to this problem was to deploy an IP based SSL certificate on the app service plan. Has the effect of fixing the IP address on the service but you can only bind to 443 and 80.

  • Deploy "Service" type of App Service using a Container Instance.
  • Static address and IP based SSL cert deployed to "Service" App Service.
  • Costs about £65 a month to host approx.

enter image description here

May not be suitable for your service but was the most cost effective way for me.

Research

Other options tested trying to find a resolution were:

  1. Deployed Azure Application Gateway with a static public IP address. The App Gateway allows backend pool to be directed to an IP or FQDN endpoint. This appears to be operational although the options from the backend pool appear to allow HTTP and HTTPS only , not custom ports. Maybe this can be manipulated if the TCP service can listen on 80 and web API on 443. App gateway is Layer 7 resource for HTTP and HTTPS traffic only.

  2. Azure Load Balancer. Could only be directed at the VM, Availability Set or VM Scale Set.

  3. Assign static address to the Resource. Not allowed for Container Instances.

  4. Traffic Manager. Doesn't appear to be the correct type of resource for this deployment.

  5. Azure VNET Firewall resource, but was £500 per month and far too expensive for my deployment.

Hanway answered 3/12, 2019 at 6:44 Comment(0)
W
2

For your requirements, firstly what I have to explain is that when you restart the Azure Container Instance, it maybe change the host machine, so it would change the public IP which you can access from the Internet.

To maintain the public IP that accesses from the Internet, you can create the Azure Container Instance in the Vnet, then add an Application Gateway, which has a static public IP, at the front of it. Add the private IP of the container instance into the backend pool of the application gateway. When you do so, you can access the container instance from the static public IP which does not change, even if you restart the container instance.

Westerman answered 4/12, 2019 at 2:23 Comment(8)
Hello @Charles Xu, Thanks for the answer, But one thing i want to clear again is i am not using vm to launch inside Azure VNET, we are using Azure Container Instance as a service, where i cannot find any network configuration to launch that ACI in vnet. Could u pls provide me a solution based on this scenario???Stercoricolous
@Balakrishna You can follow the steps in Deploy container instances into an Azure virtual network.Westerman
@Balakrishna Does it solve your problem? Or need more help?Westerman
@Balakrishna If my answer is helpful and solves your problem, please accept it!Westerman
I didn't get the answer clearly, I am using Azure Portal and created an ACI, providing the docker image source from Azure Container Registry. now through Azure portal please let me know how can i configure that ACI to have a fixed static ip address. (The ACI is not created under any vnet )Stercoricolous
@Balakrishna I'm afraid you cannot create ACI within vnet in the portal. Just follow the link which I provided you.Westerman
I've a container with SFTP protocol, so the Application Gateway doesn't work very well. Do you have any solutions to this?Eudoxia
@Eudoxia No, I just can say the container instance is not a good choice for you.Westerman
L
1

Private static IPs for ACI is (as of today) not supported. I don't think there is a real workaround here except for checking after a container has been (re-)started if the IP has been changed.

Lobectomy answered 17/10, 2022 at 12:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.