Skip to main content

Game Server Maker - Launch game servers on AWS EC2 with Docker

Project description

                            _____ _____ __  __  _____
                           / ____|/ ____|  \/  |/ ____|
                          | |  __| (___ | \  / | |
                          | | |_ |\___ \| |\/| | |
                          | |__| |____) | |  | | |____
                           \_____|_____/|_|  |_|\_____|

Game Server Maker

Launch game servers on AWS in one command. No console clicking. No YAML files. No Terraform.

Python 3.12+ License: MIT Games: 130+

gsmc demo


⚡ Features

  • One-command launchgsmc launch factorio -n my-server provisions EC2, installs Docker, opens ports, and starts your server
  • 130+ games — Built-in Docker games + 130+ via LinuxGSM integration
  • Pause & resume — stop paying while you're not playing, pick up where you left off
  • Snapshots & cloning — back up your world or clone a server from a snapshot
  • Elastic IPs — pin a static address that survives pause/resume cycles
  • Full CLI + REST API — manage from the terminal or run the optional FastAPI server

🚀 Quick Start

Setting up a game server sucks. You need an EC2 instance, Docker, security groups, port mappings, SSH keys, config files... or you could just:

1. Install

pipx install gsmc        # recommended
uv tool install gsmc     # if you use uv
pip install gsmc         # in a virtual environment

2. Configure AWS — set up credentials (docs) and apply the minimum IAM policy.

3. Launch

gsmc launch factorio -n my-server

4. Play — then manage the lifecycle:

gsmc list                      # see your servers
gsmc logs my-server            # check the output
gsmc rcon my-server /save      # send an RCON command

gsmc pause my-server           # stop paying, keep data
gsmc resume my-server          # pick up where you left off

gsmc pin my-server             # static IP across restarts
gsmc snapshot my-server        # back up the world
gsmc destroy my-server         # tear it down

🎮 Supported Games

LinuxGSM games (130+)

gsmc integrates with LinuxGSM to support 130+ game servers. LinuxGSM games use a config-driven format — gsmc generates game definitions from upstream LinuxGSM data, each represented as a Python dataclass with ports, default settings, and instance sizing.

Game CLI name
Garry's Mod lgsm-gmod
ARK: Survival Evolved lgsm-arkse
Counter-Strike 2 lgsm-cs2
Team Fortress 2 lgsm-tf2
Rust lgsm-rust
7 Days to Die lgsm-7dtd
DayZ lgsm-dayz
Project Zomboid lgsm-pz
Palworld lgsm-pw

Run gsmc games to see the full list, or gsmc sync --list to browse all available LinuxGSM servers.

Docker games (built-in)

These are hand-written game definitions that use community Docker images directly:

Game CLI name Default instance Approx. cost/hr
Factorio factorio t3.medium ~$0.04

Adding your own game

Both LinuxGSM and Docker games are Python dataclasses in src/gsm/games/. To add a new Docker game, create a new file with a GameDefinition and call register_game(). To add a LinuxGSM game, use gsmc sync --add <server_code>. See CONTRIBUTING.md for details.


📖 Usage Examples

# Factorio with default settings
gsmc launch factorio -n my-factory

# Docker game with a config file
gsmc config factorio --init -o factorio.cfg
# edit factorio.cfg...
gsmc launch factorio --config-file factorio.cfg

# LinuxGSM game with a config file
gsmc config lgsm-rust --init -o rust.cfg
# edit rust.cfg...
gsmc launch lgsm-rust --config-file rust.cfg

# Inline config (any game)
gsmc launch lgsm-gmod -c maxplayers=32 -c servername="My Server"
gsmc launch factorio -c GENERATE_NEW_SAVE=false

# Launch with a static IP that survives pause/resume
gsmc launch factorio --pin-ip -n persistent-server

# Clone a server from a snapshot
gsmc snapshot my-server
gsmc launch factorio --from-snapshot snap-abc123 -n my-server-clone

# Upload a file before launch
gsmc launch factorio -u ./saves/my-save.zip:/factorio/saves/my-save.zip

⚙️ Configuration Guide

Every game server has settings you'll want to tweak — player count, server name, passwords, world options, etc. gsmc gives you gsmc config to discover what's available, and flags on gsmc launch to set them.

All games are configured with -c KEY=VALUE on launch. Use gsmc config <game> to see what options are available.

# See what a game supports
gsmc config factorio
gsmc config lgsm-rust

# Override settings at launch (any game)
gsmc launch factorio -c GENERATE_NEW_SAVE=false -c SAVE_NAME=myworld
gsmc launch lgsm-gmod -c maxplayers=32 -c servername="My Server"

Config files

For heavier customization, generate a config file, edit it, and pass it at launch:

# Generate a config file with defaults
gsmc config factorio --init -o factorio.env
gsmc config lgsm-rust --init -o rust.cfg

# Edit the file, then launch with it
gsmc launch factorio --config-file factorio.env
gsmc launch lgsm-rust --config-file rust.cfg

Both generate .cfg files with the game's defaults. LinuxGSM configs include commented extras with descriptions.

Config precedence

Config values are merged in this order (last wins):

  1. Game defaults
  2. Config file values (--config-file)
  3. Inline overrides (-c key=value)

Required config

Some games require specific config keys to be set before they can launch (e.g. steamuser for games that need a Steam account to download). gsmc will tell you what's missing and how to provide it:

gsmc launch lgsm-dayz
# Error: Missing required config key 'steamuser'
#   Provide via: --config steamuser=VALUE

📋 CLI Reference

gsmc games

List all supported games with their CLI names, instance types, and ports.

Server Lifecycle

gsmc launch GAME

Launch a game server on EC2.

Flag Description
-n, --name TEXT Server name
-t, --instance-type TEXT EC2 instance type
-r, --region TEXT AWS region (default: us-east-1)
-u, --upload LOCAL:REMOTE Upload file before launch (repeatable)
--from-snapshot ID Launch from a snapshot
-c, --config KEY=VALUE Config option (repeatable)
--config-file PATH Config file
--pin-ip Pin a static Elastic IP to this server

gsmc list

List all servers.

gsmc info SERVER

Show detailed information for a server.

gsmc destroy SERVER

Terminate a server and clean up AWS resources.

Flag Description
--all Destroy all servers
-y, --yes Skip confirmation

Pause & Resume

gsmc pause SERVER

Stop the EC2 instance to save costs. Data persists on EBS.

gsmc resume SERVER

Restart a paused or stopped server.

Container Control

gsmc stop SERVER

Stop the container (instance stays running).

Elastic IPs

gsmc pin SERVER

Pin a static Elastic IP to a server. Free while running, ~$3.65/month while paused.

gsmc unpin SERVER

Release the pinned Elastic IP.

Flag Description
-y, --yes Skip confirmation

gsmc eips

List all GSM-managed Elastic IPs.

Flag Description
--cleanup Prompt to release orphaned EIPs

Snapshots

gsmc snapshot SERVER

Create an EBS snapshot for backups or cloning.

gsmc snapshots

List all snapshots.

gsmc snapshot-delete ID

Delete a snapshot.

Flag Description
-y, --yes Skip confirmation

Server Interaction

gsmc logs SERVER

View container logs.

Flag Description
-n, --tail LINES Number of lines to show
-f, --follow Follow log output

gsmc ssh SERVER

SSH into the EC2 instance.

gsmc exec SERVER COMMAND...

Run a command inside the server container.

gsmc rcon SERVER COMMAND...

Send an RCON command to the server.

gsmc upload SERVER LOCAL REMOTE

Upload a file to the server container.

gsmc download SERVER REMOTE LOCAL

Download a file from the server container.

Configuration

gsmc config GAME

Show or generate configuration for a game. Shows available config options with defaults.

Flag Description
--init Generate a local config file
-o, --output PATH Output path (default: <game>.cfg)

LinuxGSM Catalog

gsmc sync

Sync LinuxGSM game configs from upstream GitHub.

Flag Description
--list List all available LinuxGSM games
--add SERVER_CODE Add a game to the local catalog
--all Add all games and sync configs

Other

gsmc help [COMMAND]

Show help for a command.

gsmc completion SHELL

Generate shell completion script (bash/zsh/fish).

gsmc api

Start the local REST API server.

Flag Description
-p, --port PORT API port (default: 8080)
--host HOST API host (default: 127.0.0.1)

🔧 How It Works

  you                gsmc              AWS
   │                  │                 │
   │  gsmc launch ..  │                 │
   │─────────────────>│  create EC2     │
   │                  │────────────────>│
   │                  │  SSH + Docker   │
   │                  │────────────────>│
   │                  │  open ports     │
   │                  │────────────────>│
   │                  │  start server   │
   │                  │────────────────>│
   │  IP + port       │                 │
   │<─────────────────│                 │
  1. Provisions an EC2 instance running Amazon Linux 2023
  2. Installs Docker via SSH
  3. Pulls the game's Docker image
  4. Creates security group rules for the game's ports
  5. Launches the container with your config

State files

State is tracked locally in ~/.gsm/:

File Contents
servers.json Active server records
snapshots.json Snapshot records
keys/gsm-key.pem Auto-generated SSH key (shared across machines via SSM)
lgsm_catalog.json LinuxGSM game catalog
lgsm_data.json LinuxGSM config data

Reconciliation

gsmc list and gsmc info automatically reconcile local state with AWS before displaying results. If an instance was terminated externally (e.g. via the AWS console), gsmc detects this and removes the stale record. If an orphaned GSM-tagged instance is found running in AWS without a local record, gsmc adopts it back into state. This keeps your local view consistent with reality without requiring manual cleanup.


🐚 Shell Completion

Tab-complete server names, game names, snapshot IDs, and commands in your shell:

# bash
gsmc completion bash >> ~/.bashrc

# zsh
gsmc completion zsh >> ~/.zshrc

# fish
gsmc completion fish > ~/.config/fish/completions/gsmc.fish

🌐 REST API

Install with API support and start the server:

pipx install gsmc[api]          # recommended
uv tool install gsmc[api]       # if you use uv
pip install gsmc[api]           # in a virtual environment

gsmc api                         # default: 127.0.0.1:8080
gsmc api --port 9000 --host 0.0.0.0

Endpoints

Method Path Description
GET /servers List all servers
GET /servers/{id} Get server details
POST /servers Launch a server
DELETE /servers/{id} Destroy a server
POST /servers/{id}/pause Pause a server
POST /servers/{id}/stop Stop the container
POST /servers/{id}/resume Resume a server
POST /servers/{id}/pin Pin an Elastic IP
POST /servers/{id}/unpin Release the pinned IP
POST /servers/{id}/snapshot Create a snapshot
GET /snapshots List all snapshots
DELETE /snapshots/{id} Delete a snapshot

💰 AWS Setup & Costs

Prerequisites

  • AWS credentials configured via ~/.aws/credentials, environment variables, or an AWS profile
  • The minimum IAM policy applied to your user/role

Required permissions: EC2 instances, security groups, key pairs, EBS volumes/snapshots, Elastic IPs, SSM Parameter Store (for SSH key sharing across machines).

Cost estimates

Costs depend on the instance type and region (us-east-1 on-demand pricing shown). You only pay while the instance is running — gsmc pause stops the meter.

Instance type vCPU RAM ~Cost/hr Good for
t3.medium 2 4 GB $0.04 Factorio, most LinuxGSM games
t3.large 2 8 GB $0.08 Larger servers
t3.xlarge 4 16 GB $0.17 Rust, CS2, ARK
t3.2xlarge 8 32 GB $0.33 High-population servers

EBS storage (server data) costs ~$0.08/GB/month and persists while paused. Snapshots cost ~$0.05/GB/month. Elastic IPs are free while associated with a running instance, ~$3.65/month while the server is paused.

Disclaimer

gsmc is a convenience tool, not infrastructure-as-code. It manages AWS resources (EC2 instances, EBS volumes, security groups, Elastic IPs, snapshots) on your behalf. While gsmc reconciles state automatically and does its best to track everything, you should periodically check your AWS console to ensure no orphaned resources are left behind. gsmc provides no guarantees — you are responsible for your AWS bill.


🛠️ Development

git clone <repo>
cd game_server_maker
uv sync --all-extras
uv run pytest tests/ -v

Stack


🤝 Contributing

See CONTRIBUTING.md.

📄 License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gsmc-0.3.0.tar.gz (132.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gsmc-0.3.0-py3-none-any.whl (53.1 kB view details)

Uploaded Python 3

File details

Details for the file gsmc-0.3.0.tar.gz.

File metadata

  • Download URL: gsmc-0.3.0.tar.gz
  • Upload date:
  • Size: 132.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gsmc-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7f756ea84727ef0c431990a3fe1f356fd2b2cdda1ab1a339d5c6a53b92dbde68
MD5 c46438d140ba81493298567c1ee03536
BLAKE2b-256 68b46774f9ad86f5b0048c6db8b1ed98b28fd8774915c106d55f18dd6befc751

See more details on using hashes here.

Provenance

The following attestation bundles were made for gsmc-0.3.0.tar.gz:

Publisher: publish.yml on sabidib/gsmc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gsmc-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: gsmc-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 53.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gsmc-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 107a01c4fd47156782ff0ce57a94b98ebb9a46e77f9b90435864576fcb2c965a
MD5 49e136720cb2dac9a5e7c0c2f3ae00ab
BLAKE2b-256 b62e81a068b10124558a4d79d5f245085dc0462733d52ef22800ca2cbe2dd816

See more details on using hashes here.

Provenance

The following attestation bundles were made for gsmc-0.3.0-py3-none-any.whl:

Publisher: publish.yml on sabidib/gsmc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page