Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
198 views
in Technique[技术] by (71.8m points)

amazon web services - How to set up a java server on AWS EC2

I have made a 2 player game in java for my class but I am looking to make it online. Currently it is set up and running on my localhost socket = new Socket("localhost", 30000);. However I have been reading into how to set up a server. I have set up an AWS account and have an instance if EC2 up and running with java installed on it. I am hoping someone can tell me how do I set up the server or are there any good tutorials on setting up the server on EC2. Also when it is set up what do I replace localhost with?

Thank you so much!

question from:https://stackoverflow.com/questions/65875251/how-to-set-up-a-java-server-on-aws-ec2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I am hoping someone can tell me how do I set up the server

Same way you run it on your local computer. Just... run it. ssh into your EC2 server as normal and run java -jar yourapp.jar. There's nothing magical going on.

Also when it is set up what do I replace localhost with?

The IP address of your server, which is listed in the AWS console.

Note that you'll need to configure the security group that your AWS instance is in, and open up port 30000.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...