Skip to content

Latest commit

 

History

History
123 lines (79 loc) · 2.78 KB

readme.rst

File metadata and controls

123 lines (79 loc) · 2.78 KB

Minecraft Server Host

This repository contains the blueprint for creating an automated and configurable minecraft server on-demand.

The project provides a webapp that can be used to start an ec2 instance which has been configured to run a minecraft server. The instance will autmatically shutdown after five minutes if no players are online to help to reduce costs.

Setup

  1. Install terraform

  2. Install AWS CLI

  3. Configure AWS CLI:

    $ aws configure
    AWS Access Key ID [None]: accesskey
    AWS Secret Access Key [None]: secretkey
    Default region name [None]: us-west-2
    Default output format [None]:
    
  4. Initialize terraform:

    terraform init
    
  5. Create a terraform.tfvars file:

    tee terraform.tfvars << EOF
    dns_name        = "minecraft.example.com"
    webapp_dns_name = "www.minecraft.example.com"
    region          = "us-west-1"
    EOF
    
  6. Edit the newly created tfvars file to provide your region preference and domain names.

  7. Run apply to provision the infrastructure:

    terraform apply
    
  8. Once the apply is complete your server should be running and the UI and lambda should be created to control the server.

Tearing down the server

The resources can be removed by running:

terraform destroy

Terraform state backup

Terraform has the ability to store it's state in a remote store. For more information, see the documentation for more information.

Example (i.e. backend.tf):

terraform {
    backend "remote" {
        hostname     = "app.terraform.io"
        organization = "example"

        workspaces {
            name = "minecraft-server"
        }
    }
}

Example costs (from 2020)

Since May, I've been running the server as a t3.medium instance to server about 4 active players at a time. Below I've included a chart with a couple sample months representing different levels of activity.

Use Hours Monthly Cost
Low 6 $2.71
Medium 140 $10.59
Heavy 275 $21.89

asdf - extendable version manager

The asdf tool can be used to manage your local terraform installation.

Install plugin:

asdf plugin-add terraform https://github.com/Banno/asdf-hashicorp.git

Install the tools:

asdf install

aws cli

Install:

pip install --user awscli

Configure:

aws configure