Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Repository files navigation

Factorio CDK stack

This is an AWS CDK stack for deploying a Factorio game server. It is by no means complete, but is currently in an acceptable state.

This stack has been deployed and worked beutifully multiple times, sometimes adapted for different games, serving up to 6 people for hundreds of hours without issue.

AI Usage Statement

As of Sept. 26th 2025, AI was NOT used at any point during this project, in any capacity.

I am not against the reasonable and responsible use of AI as a tool for software development, but I am against the lazy, naive, and irresponsible copy-paste of whatever an AI or AI based tool spits out without engineer supervision and validation.

If I continue to work on this project, I will likely use AI at some point as a tool. At which point I will update the first sentence of this disclosure to reflect its use.

SetUp

This SetUp is likely incomplete. I don't play videogames anymore, so this hasn't been used in production for a while.

  • In the web console, create an EC2 keypair called factorio-server (or call it whatever you want, and change the keypair name in lib/factorio_cdk_stack-stack.ts )
  • Change the allowed IP for SSH connections from REDACTED to your IP. Or open it to any IP, but that caries more risk.
  • Deploy as normal using cdk deploy
  • SSH into the running server using the keypair, and from there install SteamCMD and the factorio server, or whatever else you want to run.
  • In the web console, fetch the HTTP endpoints for start, stop, and getStatus from API Gateway or Lambda.
  • If you ever want to delete everthing and start from scratch, keep in mind you'll need to manually disable deletion protection and delete or rename the EBS volume for the EC2 instance.

Current TODOs

  • Streamline setting home IP for SSH/RDP access. Currently IP is hardcoded (redacted in this repo) and in the future should be set dynamically via environment variable, or alternative methods of access should be explored, such as EC2 Instance Connect Endpoint.
  • Support multiple game servers, such that the status endpoint gets the status of all configured servers, and the start/stop endpoints take a path or parameter specifying the server to start/stop.
  • Automate individual server setup. This is tricky because every game server handles things very differently and requires different setup, and sometimes different OSs (not to mention game updates often break configs and scripts). It would be nice to fetch at least some config from somewhere for each type of server, in a consistent and predictable way.

CDK readme

The cdk.json file tells the CDK Toolkit how to execute your app.

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • npx cdk deploy deploy this stack to your default AWS account/region
  • npx cdk diff compare deployed stack with current state
  • npx cdk synth emits the synthesized CloudFormation template

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages