#1. "ip-172-31-3-228" is probably the wrong host. It looks like it's the *internal* DNS hostname, but what you want to use is the *external* DNS hostname or the elastic IP of machine (if one is assigned).
You can get the external DNS name from AWS management console, and it'll look typically like "ec2-xx-xx-xx-xx.compute-x.amazonaws.com".
#2. Check if you have enabled firewall access to port 1002 from the AWS management console's "Security Groups" page. Unless you have enabled inbound traffic to that port, AWS will block it.
#3. If it still doesn't work after these 2 changes, it may be the client side firewall blocking access, especially if you're behind a corporate firewall. To check whether that's the case, try your applet over your home network or a mobile data network.
Joined: Nov 03, 2013
Thanks for the reply. I tried the first two options but still I am not successful in getting the connection. The third option does not apply to my case because in my laptop there is no firewall setting. If it is the security that is blocking the connection then I changed my java.policy file also still I am unsuccessful.
What OS is on your EC2 server? The OS may have its own firewall activated (typically Windows firewall if it's Windows OS, and iptables rules if it's Linux). Check if these are activated.
What is the inbound rule you added to EC2 security groups?
On client side, if you are accessing all this from your company network, then the entire company's network will have a corporate firewall that usually blocks such arbitrary socket connections from/to all machines in your network.
It need not necessarily be installed on your laptop and java.policy will have no effect, since the blockage is happening external to your device.
Glad to know your problem is solved!
Perhaps you can briefly describe what exactly was the problem and what you did to solve it, so that it'll help anybody else who has the same problem in future and comes across this thread.
Joined: Nov 03, 2013
Yesterday I changed the security group by adding a new rule, but forgot to apply the security rule changes. That is why it was not working yesterday.
I too noticed the weird positioning of that Save button yesterday - it's easy to miss unless one scrolls down. Hopefully they'll improve the usability of their redesigned console. Anyway, thanks for explaining the problem!