Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 11, 2022 03:29 am GMT

Host my Own Minecraft Server on AWS EC2 using Docker

Hello, everyone! How are you today? I'm going to explain about setup Minecraft Server on AWS EC2. We will use Docker to run the Minecraft Server to minimize the setup of our AWS EC2. Let's go!

Prepare SSH Client

  • For Windows, you may use putty or another SSH client.
  • For Ubuntu, you can check this article on how to install it

Prepare AWS EC2

  1. Visit EC2 page. Make sure you are visiting the correct region.

    EC2 Search

  2. Click on Instances. After that, click Launch Instances.

    Launch Instances

  3. Fill in the EC2 name. After that, please make sure the number of instances is 1. Finally, choose Ubuntu as the OS. Note: You may choose another OS. But, you will need to find how to set up Docker for your selected OS.

    Fill Details

  4. Select instance type. I'm using t3.small since I will not have many users on my own server. Feel free to choose another instance type. But, I will recommend using t3.small as a minimum specification.

    Choose Instance Type

  5. Choose your key pair. If you don't have it yet, you may create new key pair using Create new key pair link. You will need this to SSH into your server.

  6. Now, we will set up the network. Please click Edit on the Network Setting section. After that, choose the subnet as you wish. I select ap-southeast-3c. I disable Auto-assign public IP since I will use Elastic IP.

    Subnet and auto-assign public IP

  7. We will create a new security group. Make sure you've selected Create security group. Update the Security group name with an appropriate name, for example, minecraft-server-security-group, etc. Click Add security group rule, and fill in the Port range for Security group rule 2 with 25565. Port 25565 will be used to host the Minecraft server. Click on the source, and make sure you choose 0.0.0.0/0.

    Security Group

  8. Please fill in your desired volume size in Configure volume section. I use 25 GiB.

    Volume

  9. Click Launch instance in the summary section.

    Launch

Setup the Elastic IP

  1. Go to the VPC page, and select Elastic IPs. After that click the Allocate Elastic IP address button.

    Allocate

  2. I use default options, and click Allocate.

    Allocate fields

  3. You will get the notification message, and click the Associate this Elastic IP address button.

    Notification

  4. Select the instance you've created before. After that, click Associate button.

    Assign

SSH to our EC2 using Public IP

  1. Make sure you can SSH to our previous EC2.

    SSH

  2. Update our package reference using sudo apt update.

    apt update

  3. Install docker. You might want to read this article on how to install the docker. Note: Since I want to use docker without sudo for my ubuntu user, you might want to read this. Make sure you are re-login after setup that.

  4. Check your docker installation. I use docker ps.

    ps

Run Minecraft Server

  1. We will use this docker image.

  2. We will use docker compose too. So, prepare the docker-compose.yml and host the yml on minecraft directory. I use this configuration. Note: If you want to know more the environment values to customize your server, please visit this.

    version: "3"services:  mc:    image: itzg/minecraft-server:java17-alpine    ports:      - 25565:25565    environment:      EULA: "TRUE"    tty: true    stdin_open: true    restart: unless-stopped    volumes:     # attach a directory relative to the directory containing this compose file      - ./minecraft-data:/data
  3. Start our server! docker compose up -d.

  4. To monitor the process, you may use docker compose logs -f. To quit the logs monitor, use CTRL+C.

    logs

Let's Play!

  1. Please use your Minecraft Client application.

  2. Input your EC2 IP address and port into your Minecraft Client application. Enjoy your server!

    server

Additional

  • If you need to auto-start and auto-stop your EC2 instance. Please check this article.
  • If you want to explore another alternative. I think you may try another Amazon Machine Image (AMI).

AMI

Thank you

Thanks for reading! If you have feedback, feel free to comment on this post.

Thanks


Original Link: https://dev.to/aws-builders/host-my-own-minecraft-server-on-aws-ec2-using-docker-325o

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To