0

Trying to run Spring Petclinic application on an EC2 instance:

sudo yum install -y git
git clone https://github.com/spring-projects/spring-petclinic.git
cd spring-petclinic
./mvnw package
java -jar target/*.jar -Dserver.address=0.0.0.0

The application comes up fine and accessible at http://localhost:8080. But trying to access using the public IP address times out.

Already seen the recommendation at How to configure embedded Tomcat integrated with Spring to listen requests to IP address, besides localhost? and tried specifying server.address in application.properties, rebuilt and redeployed the application. How to setup spring-boot to allow access to the webserver from outside IP addresses is suggesting similar as well.

Not a recommended practice but EC2 instance security group is open for all inbound TCP traffic for all ports.

What else can be wrong?

Arun Gupta
  • 3,965
  • 5
  • 31
  • 39
  • Are you able to ping your EC2 server's public address? – Vasif Oct 30 '18 at 23:11
  • 2
    Are you sure you have the security group set such that you see under "view inbound rules" in the ec2 console something like "ports: All (or 8080), protocol: All (or tcp), source: 0.0.0.0/0 (or your ip)" because that's the #1 source of timeouts. Other good candidates: wrong region, wrong instance or wrong ip. You could also check whether you can reach the webserver from another instance in the same VPC to exclude misconfiguration on the instance itself. – zapl Oct 30 '18 at 23:28
  • Yep, ping works: 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 62.638/62.698/62.752/0.037 ms – Arun Gupta Oct 30 '18 at 23:58
  • Inbound security rules are: All, All, 0.0.0.0/0, ::/0. This is only single instance in one region. Installed HTTPD server and could access that :80 – Arun Gupta Oct 30 '18 at 23:59

0 Answers0