For this project, we will be setting up a minecraft server using an EC2 instance that we set up with Terraform.
The user will need to configure an EC2 instance using Terraform. Then, after they connect to the EC2 instance, they will need to configure the minecraft server itself, as well as a minecraft.service file that will automatically start and stop the server when the EC2 instance is booted up.
On the user's local machine, they will install terraform. On the EC2 instance, they will install jdk and jre 17, and the latest minecraft.jar
The user needs to have an academy account with AWS, and they will need to set up the following CLI's using the instructions at the given links. Terraform CLI AWS CLI
The user needs to create a file, ~/.aws/credentials
Within this file, they need to copy-paste their AWS credentials. They can find this on their learner lab on canvas
- Configure Terraform EC2 Instance
- SSH into the EC2 instance
- Configure all Minecraft Server files
./configure_tf.sh
This command will set up all terraform-related files
terraform init
terraform apply
These commands set up the EC2 instance using terraform
ssh -i "../../../tf-key-pair" admin@ec2-<IP ADDRESS>.compute-1.amazonaws.com
This command will ssh the user into their EC2 instance. This is an example of the command with the IP address filled in:
ssh -i "../../../tf-key-pair" admin@ec2-3-226-247-127.compute-1.amazonaws.com
./configure_mc.sh
This command will set up the minecraft server and service and all related files
To connect to the Minecraft server, the user can open their Minecraft app, go to Multiplayer->Direct Connection and then copy-paste their EC2 Instance's Public IP address. This address can be found by typing 'terraform output' on their local machine in the folder they set up terraform in