It looks like you're new here. If you want to get involved, click one of these buttons!Sign In Register
It looks like you're new here. If you want to get involved, click one of these buttons!
If you have ever hosted a microservices based application on EC2, you often find you have to serve different content on different ports. The problem though is that amazon ec2 does not allow incoming traffic to ports other than port 80 and 22 by default. This short post, is a reminder to myself and anyone else whom might encounter this scenario, on how to quickly get past this issue.
Step 1 : on your ec2 instances console, select the instance in question
Step 2: on the right hand side, navigate to networking -> securty groups.
Step 3: create a new security group.
Step 4 Select your new security group, then create a new rule. Name it whatever you like, but set incoming address to 0.0.0.0/0. Fill in the desired port in the port column
Step 2: Go back to instance console, then right click on your instance, then -> network settings -> apply security groups and choose your newly created security gruop.
Step 5: your application should be available publicly now via the opened port, but if its not, make sure your app serving is serving with 0.0.0.0:PORT. and not localhost:PORT. This mistake is easy to make if you are using laravel, and using the command php -S localhost:port -t public to serve your app.