I have a trivial service that's running on localhost:8080
on an ec2 instance and was wondering how I would go about hitting a /views
endpoint for that service. I wasn't able to find much in the way of documentation around this except for this: https://docs.aws.amazon.com/general/latest/gr/rande.html , which seems to suggest that I would be able to hit the endpoint by issuing a get request to ec2.us-east-2.amazonaws.com:8080/views
. At this point, I would like to make it a public API without the need for a key for simplification.

- 455
- 1
- 4
- 18
-
1The URL would be `IP-ADDRESS:8080/view` (eg `1.2.3.4:8080/view`), or you can use the DNS name that is associated with that IP address (eg `ec2-1-2-3-4.ap-southeast-2.compute.amazonaws.com:8080/view`). Of course, it is best to map a DNS Name to the IP address (eg `company.com:8080/view`) in case the IP address needs to change. – John Rotenstein Feb 23 '20 at 02:39
2 Answers
You need to be sure your EC2 instanced has a public IP address and that the security group allows traffic from port 8080. What you really should do it put it behind a load balancer.

- 8,059
- 19
- 32
-
thanks. it does have a public ip address and I believe dns, which is what I'm using to ssh into my instance. The security group by default seems to allow for everything https://imgur.com/jYBYt8K , but I'm still having issues with hitting the endpoint – Quilty Kim Feb 23 '20 at 01:49
There seemed to be two security groups seemingly associated with this one instance as shown here:
I was adding new incoming rules for default VPC security group
only assuming that the launch-wizard-1
security group only applied to the ec2's relationship with the launch wizard. Apparently, it waslaunch-wizard-1
that needed its rules changed and so I added a custom TCP incoming rule with it Anywhere
as the source value. The only port that was open before this was 22 for ssh-ing into the instance.
I wasn't able to find any threads regarding opening aws ec2 until I strangely got way more specific about the port I wanted to open: 8080, which yielded this thread: EC2: How to add port 8080 in security group?

- 455
- 1
- 4
- 18