DEV Community

Erika Jolin
Erika Jolin

Posted on

Host Your Own Minecraft Java Server on AWS in MINUTES!

Ready to take your Minecraft Java experience to the next level? This step-by-step guide will equip you with everything you need to launch your own powerful server on AWS EC2.

Through clear instructions and helpful screenshots, we'll navigate the process from creating your instance to optimizing settings and inviting your friends.

Whether you're a seasoned server admin or a curious newcomer, this guide will empower you to build the ultimate Minecraft world your way.

After researching on google, I discovered that there are, in fact, two distinct versions of Minecraft. Minecraft is available in two main editions.

Bedrock

The Bedrock Edition is the newer, 'unified' version that supports cross-platform play on all platforms except for Mac and Linux, using the Bedrock Client.

Java

In contrast, the Java Edition is the original version of the game, which continues to receive updates. This edition allows for cross-play between Windows, Mac, and Linux users, as long as they are using the Java Edition Client."

After exploring various online resources, including YouTube videos, for setting up a Minecraft server, I faced challenges due to the quickly changing nature of Amazon EC2 Instances.

Despite technical efforts and discussions with knowledgeable friends, initial attempts were unsuccessful. However, I eventually succeeded in setting up a Minecraft Java Edition Server for my kids using an Amazon Linux 2 AMI EC2 Instance.

Step 1: Setting up the instance

To set up a Minecraft server using Amazon Web Services (AWS), start by logging into your AWS account, which can be created for free at https://aws.amazon.com/free/.

aws minecraft server

Once logged in, navigate to your console. Then, click the prominent orange 'Launch Instances' button located in the top right corner. This action initiates a wizard that guides you through the process of creating an instance.

minecraft server aws

During this process, select a 64-bit (x86) Amazon Linux 2 AMI from the Machine Image library.

minecraft aws

When setting up a Minecraft Java Edition server on AWS, you have several choices regarding the instance type. While a t2.micro instance might suffice for the Bedrock Edition, the Java Edition requires more resources.

Depending on the number of expected connections, a t2.small or t2.medium instance is necessary. For a server intended for 2 to 3 kids, a t2.small will suffice. After selecting the appropriate instance type, proceed by clicking 'Configure Instance Details.'

You can retain the default settings on both the Instance Details and Storage screens, and then move on to the Tags screen.

Minecraft Server Java

In the Tags section of the AWS setup for your Minecraft Java Edition server, you can assign a Name tag and a corresponding value. This step is particularly useful for easy identification of your server, especially if you're managing multiple instances.

Additionally, this section allows for cost center tagging, which is beneficial if you organize or manage your billing using tags. After completing this step, the next phase involves configuring settings on the Security Group screen.

Setup Minecraft Server AWS

In the Security Group section, which is crucial for controlling access to the server, a new security group can be created. For instance, naming it 'MineCraft-Server' with an appropriate description helps in easy identification later.

To facilitate communication, add a rule for Custom TCP, as Minecraft Java Edition uses TCP over port 25565. Set the source to 'Custom' and enter '0.0.0.0/0' to permit access from any location. Remember to include a description for clarity.

Proceed to 'Review and Launch' to initialize your instance. This step prompts a window for creating a security key pair. For those experienced with SSH and remote server connections, it is advisable to use this method.

However, if you prefer to avoid the complexities of SSH, select 'Proceed without a key pair.' Be aware that choosing this option means you will not be able to SSH into the instance.

Minecraft AWS Server 6

Instead of traditional SSH, we'll utilize Amazon's built-in browser-based ** SSH-like** console for server connection and management. After making your selections, click 'Launch Instances.'

AWS will then proceed to construct and launch your server according to the specified configurations.

Step 2: Getting Java Installed On The Server

Amazon's Amazon Linux EC2 machines no longer come with Java pre-installed, necessitating a manual installation of the Java environment.

In the process of setting up a Minecraft Java Server, various attempts were made to install Java 1.8.0 and OpenJDK Java 11, ensuring they were up-to-date.

However, these efforts were met with compatibility issues, as the Minecraft Java Server edition required a newer version of Java. To resolve this, Amazon Corretto must be used to install Java 16, which is compatible with running Minecraft.

Minecraft Server AWS 8

Once your AWS instance is operational, select it by ticking the box beside its name. Following this, click the 'Connect' button located at the top of the interface to establish a connection with the instance.

Minecraft Server Setup

To interact with the AWS instance, we will utilize the EC2 Instance Connect feature. This tool opens a new browser window that provides an SSH-like terminal for managing the instance.

Before proceeding, it's important to note the instance's Public IP Address, as this will be necessary for later connecting to Minecraft. After verifying the details, click 'Connect' to initiate the session.

minecraft server aws online

At this stage, you will be presented with a command prompt. To proceed, you should type in, or copy and paste, the specified command into this prompt and then press 'Enter' to execute it.

sudo rpm --import https://yum.corretto.aws/corretto.key 

Enter fullscreen mode Exit fullscreen mode

Followed by:

sudo curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo
Enter fullscreen mode Exit fullscreen mode

minecraft server aws online

After entering the previous command, you will observe the system updating its repository. Once this update is complete, you are then ready to run the command to install Amazon Corretto 16.

sudo yum install -y java-16-amazon-corretto-devel
Enter fullscreen mode Exit fullscreen mode

If the execution of the command is successful, you will then see the following output.

minecraft server aws online

Now, you can verify the installed Java version. To do this, enter the command java -version in the terminal. Upon successful execution, you should see an output displaying the installed Java version details.

minecraft server aws online

Your machine should now be fully prepared and equipped to host a Minecraft Server.

Step 3: Installing Minecraft

Next, we'll set up a dedicated user account for running the server. To do this, enter the following command:

sudo adduser minecraft
Enter fullscreen mode Exit fullscreen mode

The next step involves organizing our files by creating a structured directory. We will establish a 'minecraft' folder and within it, a 'server' folder.

sudo su
mkdir /opt/minecraft/
mkdir /opt/minecraft/server/
cd /opt/minecraft/server
Enter fullscreen mode Exit fullscreen mode

At this point in the process, your SSH client screen should display the following appearance.

minecraft server aws online

Now, the next step is to download Minecraft, which can be obtained from the official Minecraft website.

Since we are operating within a simulated SSH client environment, direct file upload from our local computer is not feasible. Instead, we will use the wget command to download the necessary files directly from the Minecraft server.

wget https://launcher.mojang.com/v1/objects/c8f83c5655308435b3dcf03c06d9fe8740a77469/server.jar
Enter fullscreen mode Exit fullscreen mode

minecraft server aws online

This command will initiate the download of the file to the current directory. Once the download is complete, you can verify the presence of the file by typing ls and pressing 'Enter'. This action should result in a display like this:

minecraft server aws online

Let's set the user for the folder by entering:

sudo chown -R minecraft:minecraft /opt/minecraft/
Enter fullscreen mode Exit fullscreen mode

We are now at the stage where we are ready to launch our server, which is a significant milestone in the setup process.

Step 4: Running The Minecraft Server

Begin the server launch by executing the following command, which will initiate the startup of your Minecraft server:

java -Xmx1024M -Xms1024M -jar server.jar nogui
Enter fullscreen mode Exit fullscreen mode

However, anticipate an initial failure during this process. The first attempt to run the server triggers a check for an accepted End User License Agreement (EULA). Since the EULA file doesn't exist initially, the system will create one for you. At this point, your SSH window should display the following.

minecraft server aws online

To rectify this, we will utilize the vi text editor to modify the file:

vi eula.txt
Enter fullscreen mode Exit fullscreen mode

Opening the file in the vi editor allows for editing. Navigate within the file using the arrow keys to locate the line containing 'eula=false.' To begin editing, press the 'i' key on your keyboard.

This action will switch the editor to insert mode, indicated by '-- INSERT --' appearing at the bottom of the screen. In this mode, change 'false' to 'true'.

minecraft server aws online

After completing the edits, press the 'Esc' key to exit insert mode. Then, type ':wq' (where 'w' stands for write and 'q' for quit) and press 'Enter.' This sequence saves your changes and exits the editor.

minecraft server aws

Now that the necessary edits are complete, we are ready to start our server. However, it's important to note that if we run the Java command as is, the server will stop running once the SSH window is closed.

To keep the server running independently of the SSH session, we will utilize the 'screen' utility."

yum install screen
Enter fullscreen mode Exit fullscreen mode

minecraft server aws lambda

Next, we will create and enter a screen session named 'mcserver' by executing the following command:

screen -S mcserver
Enter fullscreen mode Exit fullscreen mode

Enter the command and press 'Enter.' This action will result in a new prompt appearing at the top of the screen. In this new session, you can execute the Java command for your server.

With this setup, closing the window will not stop the server; it will continue to run independently. With these steps completed, we are now finally ready to launch our Minecraft Server.

java -Xmx1024M -Xms1024M -jar server.jar nogui
Enter fullscreen mode Exit fullscreen mode

The server will take a brief moment to initialize, during which your Minecraft world will begin to come to life.

aws minecraft server setup

After the server setup is complete, you can connect to it using the Public IP address you noted earlier.

This connection can be made through the Minecraft Multiplayer screen within the Minecraft Java Client on Mac, Windows, or Linux platforms.

aws minecraft server price

aws minecraft server java

aws minecraft server free

Step 5: Changes And Reconnecting To Your Server

To fully prepare your server, you'll likely want to customize its settings. This can be done by editing the 'server.properties' file using the vi editor, where various adjustments can be made to tailor your server to your preferences.

If you have closed your SSH window and need to return to your server, simply reopen the EC2 Instance Connect as described earlier. Once connected, you can access your server again by typing the following command in the prompt:

sudo su
cd /opt/minecraft/server
screen -S mcserver
Enter fullscreen mode Exit fullscreen mode

Minecraft AWS Server 11

Conclusion

This guide aims to assist users in setting up a Minecraft server, though it's important to note that the rapidly changing nature of AWS and software development may lead to some information becoming outdated.

The provided instructions have enabled the creation of a server for my children and their friends, customized to their requirements.

As an important update, we recently encountered a security issue where unauthorized users gained access to the server. To address this, we implemented a whitelist.

Creating a whitelist is straightforward: it involves making a .json file containing the UUIDs and names of authorized users. Then, in the server properties, set 'white_list' to true to restrict server access to only those on the whitelist.

Top comments (0)