How to set up a simple cheap container that is publicly accessible (non-HTTP)

Mease, Darren Thomas 86 Reputation points
2023-06-20T18:37:58.3133333+00:00

Hi,

Although I can appreciate the groans when seeing the title, I can confirm I have been looking at this for quite a while now, and if I have missed something simple, apologies!

I have set up a container instance previously, behind a WAF/Application Gateway, and accessed the container via the public IP of the gateway - this I have working just fine. As a basic user, however - the app gateway can be quite expensive overall.

If I set a public IP directly on a container instance, I cannot seem to figure out how to restrict traffic to it. I cannot seem to add an NSG, and I am unable to do anything from inside the container (such as iptables) as the access is managed at the kernel level, and trying to use iptables would be rejected.

I have looked at NAT gateway, but it looks like that is for outbound traffic only.

Ultimately - if I want to access a container using a public IP, is it possible to restrict access without using an application gateway. Another constraint is the access is not web traffic - it is SSH. Also looked at Bastion hosts, but again this can get quite expensive over time.

Hope this makes sense - I usually provide references of everything I have looked at, however it is a looooong list.

Any thoughts appreciated,

Cheers,

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
757 questions
{count} votes

Accepted answer
  1. AirGordon 7,150 Reputation points
    2023-06-22T13:19:41.9+00:00

    I think the simple answer that will work for you is just using a Public Load Balancer in front of a Private Azure Container Instance.

    I've just tried it, and it works well for your scenario.

    These are the resource you will need;

    enter image description here

    The Public IP address is used by the load balancer, which is configured with a backend pool that is your ACI private IP address. The NSG is applied to your ACI subnet, and restricts inbound traffic to specific IP & ports.

    I hope this is useful to you, please upvote and mark as answered if so 🤓


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.