I have successfully deployed a Springboot server to AWS Elastic Beanstalk, and I can access it via the browser's URL.
I would like to be able to send requests to it from Postman. I figured that I could use this code to print the URL that I will send requests to from Postman:
@Override
public void run(ApplicationArguments args) throws Exception {
try {
String s1 = InetAddress.getLoopbackAddress().getHostAddress();
String hostedAt = s1 + ":" + environment.getProperty("local.server.port");
logger.info("**The server is hosted at: {}", hostedAt);
} catch (Exception e) {
e.printStackTrace();
}
}
But, this prints **The server is hosted at 127.0.0.1:8080 even when deployed to AWS. So obviously, the localhost is not where I should be sending requests, so then where?
Using my browser, if I navigate to the URL of application, then I get the Whitelabel error page proving that it worked. This is the URL: http://spara.us-east-1.elasticbeanstalk.com/
I am new to this so its probably something dumb, but any guidance would help. Thanks!