0

I use EC2. So far I have been using Elastic IP to get a static IP. And I was able to bind the Htttp server to an AWS prepared domain like ec2-xx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com and run it.

This time, I got a domain from an external site and set the direction of that domain to Elastic IP. And I was able to confirm that the IP was actually switched.

However, the HTTP server running on EC2 stopped starting. This server is made in Java, and it raises the exception java.net.BindException: Cannot assign requested address.

This Http server specifies the host and port to bind to when it starts, but this time I had made a change to make the host a new domain obtained from the dive site.

(from ec2-xx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com to xxxxxxx.com)

Why does this exception occur? (BTW, the Http server uses the NanoHTTPD library)

2
  • 1
    We need a bit more information. Your Java server shouldn't know anything about the actual IP. Nano doesn't look like it's alive anymore but you still shouldn't need to bind to the real IP. Commented Apr 27, 2022 at 14:20
  • Have you added the IP-address or the domain name onto the Java core of configurations? I ask this because instances themselves arent really aware of the Public IPs or Elastic IPs attached on them. From the OS pov, they are only aware of the private IP-addresses. Commented Apr 28, 2022 at 5:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.