How do I host a Java application in aws?
I know its a pretty stupid question, but I can't seem to do it.
I have a simple chat service. 2 java programs. One is client.java and the other is server.java. It is designed using sockets. Now I have tested it. It works fine on localhost.
I created an EC2 instance for Windows Server 2012 on AWS and ran the server.java command via the command line in the server window. But when I try to connect to it from my machine via client.java, I cannot connect to it.
What could be the reason?
source to share
AWS Instances are usually not available externally. They are protected by an internal firewall and have private IP addresses. There is a "public" interface, but this will not open any other port other than ssh or windows 53 remote access.
In short: go to the management console:
- Go to Elastic IP, get Elastic IP and assign it to your instance. This is the IP address with which you can instance.
- Go to the "Security Groups" section. Add a new group or choose the default. Add a rule to open a port of your Java application to the public. Remember to assign this group to your instance once you've created a new group.
This should do the trick ...
source to share