This project automates the setup of a Minecraft server on AWS EC2. Terraform provisions the EC2 instance and security group, and Ansible configures the server by installing Java, downloading Minecraft, and setting up a systemd service so the server auto-starts on reboot.
- Terraform
- Ansible
- AWS CLI
- An AWS key pair
.pem - AWS credentials in
~/.aws/credentials - Your key pair name set in
terraform.tfvars:
key_name = "myKeyPair"Terraform --> EC2 Instance --> Ansible --> Minecraft Server Running (provision) (boots up) (configure) (port 25565, auto-start)
Initialize and apply everything with the setup script:
./setup.shThis runs Terraform to create the instance, waits for it to boot, then runs the Ansible playbook to install and configure the Minecraft server automatically.
Once the script finishes, verify the server is up:
nmap -sV -Pn -p T:25565 <public_ip>To connect with the Minecraft client, open Minecraft Java Edition, go to Multiplayer, click Add Server, and enter the public IP that the setup script outputs.