DEV Community

Cover image for Host my Own Minecraft Server on AWS EC2 using Docker

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

    Security Group

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


  9. Click Launch instance in the summary section.


Setup the Elastic IP

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


  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.


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


SSH to our EC2 using Public IP

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


  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.


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"
        image: itzg/minecraft-server:java17-alpine
          - 25565:25565
          EULA: "TRUE"
        tty: true
        stdin_open: true
        restart: unless-stopped
         # 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.


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!



  • 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).


Thank you

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


Top comments (4)

codeadmirer profile image
dosanz pillay

Hey mate ,
I have never played Minecraft before ,
Is there a free version available that I can connect to my ec2 instance and test that the server is working fine .
Your article has was the only article simple and clear I faced some issues while downloading docker compose but troubleshooted it already.


berviantoleo profile image
Bervianto Leo Pratama

I think you want to find the Minecraft client, right? I will not share specific client apps because it might violate the legal. 😅 You can check here the alternative Minecraft client.

michvic profile image
Michel Victor

your tutorial can be done using aws free tier?

berviantoleo profile image
Bervianto Leo Pratama

I think it will have some issues, especially with the performance. You will need to set the memory limit to ensure no more than 2 GB. However, you may get "laggy" after some exploration/building.

As an alternative, you may need to get rid of the docker and run the server using Java directly.