Search code examples
c#amazon-web-servicesamazon-ec2webclient

How to expose endpoint on AWS EC2


I'm running an EC2 Windows server on AWS. There, I have my C# backend application running endpoint http://0.0.0.0:5000/do-something that I would like to expose to the public.

From within the instance, I can reach the endpoint (via http://127.0.0.1:5000/do-something), however, not from the outside. I tried to change the inbound rules for the security group of my instance (launch-wizard-1). enter image description here

Then, I tried to access it from the outside by inserting it into the browser as follows: http://public-ip-of-my-instance:5000/do-something. Unfortunately, I could not reach the endpoint. What could be the problem?


Solution

  • A port 5000 must be allowed in the Windows firewall to make it work.

    Go to Windows Security -> Firewall & Protection -> Advanced Settings -> Inbound Rules -> New Rule. There, allow TCP port 5000 and leave all other settings default.