All Projects → kalrish → aws-csgo

kalrish / aws-csgo

Licence: other
Infrastructure code for AWS-based Counter Strike: Global Offensive server

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to aws-csgo

Game Server Configs
A repo of game server configuration files used by LinuxGSM
Stars: ✭ 157 (+423.33%)
Mutual labels:  game-server
Stendhal
Stendhal is a fun friendly and free multiplayer online adventure game with an old school feel.
Stars: ✭ 194 (+546.67%)
Mutual labels:  game-server
l2jserver2
l2j game server rewrite - interlude support added
Stars: ✭ 27 (-10%)
Mutual labels:  game-server
Developer
Gameserver, Voiceserver, Rootserver Webinterface
Stars: ✭ 161 (+436.67%)
Mutual labels:  game-server
Otxserver
OTX Server from:
Stars: ✭ 187 (+523.33%)
Mutual labels:  game-server
Tdengine
game server for Rust + Lua
Stars: ✭ 203 (+576.67%)
Mutual labels:  game-server
Goworld
Scalable Distributed Game Server Engine with Hot Swapping in Golang
Stars: ✭ 2,007 (+6590%)
Mutual labels:  game-server
unity-sampleproject
A sample game called Pirate Panic for Unity engine built with Nakama server.
Stars: ✭ 115 (+283.33%)
Mutual labels:  game-server
Segs
💪 SEGS - Super Entity Game Server
Stars: ✭ 190 (+533.33%)
Mutual labels:  game-server
CounterStrike-GlobalOffensive-LiveStat-for-OBS-Studio
Showing you LIVEstats of CS:GO in your Stream like OBS-Studio while playing/streaming.
Stars: ✭ 24 (-20%)
Mutual labels:  counter-strike-global-offensive
Rhubarb
A WebSocket library optimized for multiplayer JS games, works on WebWorkers with binary data.
Stars: ✭ 167 (+456.67%)
Mutual labels:  game-server
Dst Dedicated Server
Don't Starve Together dedicated server guide for all platforms (Linux, Mac, Windows) with Docker. Extensive documentation covering mods installation, server config and performance, world generation and setting up admins.
Stars: ✭ 187 (+523.33%)
Mutual labels:  game-server
Panel
Pterodactyl is an open-source game server management panel built with PHP 7, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
Stars: ✭ 2,988 (+9860%)
Mutual labels:  game-server
Zero
A Lightweight Socket Service with heartbeat, Can be easily used in TCP server development.
Stars: ✭ 161 (+436.67%)
Mutual labels:  game-server
csgo-vscripts
Various vscripts for CS:GO I have written
Stars: ✭ 25 (-16.67%)
Mutual labels:  counter-strike-global-offensive
Carmelo
Carmelo is a fast, scalable Java server framework designed for online games. It uses Netty and Fastjson for highly efficient network transmission and supports both TCP/HTTP protocols.
Stars: ✭ 148 (+393.33%)
Mutual labels:  game-server
Netcode.io.net
A pure managed C# implementation of the Netcode.IO spec
Stars: ✭ 201 (+570%)
Mutual labels:  game-server
colyseus-kotlin
⚔ Implementation of Colyseus client using Kotlin
Stars: ✭ 26 (-13.33%)
Mutual labels:  game-server
csgo-hud
Custom CS:GO Spectator HUD
Stars: ✭ 40 (+33.33%)
Mutual labels:  counter-strike-global-offensive
Pss
This is a based plug-in framework that provides cross-platform IO and logically separated plug-in services.
Stars: ✭ 219 (+630%)
Mutual labels:  game-server

AWS-based Counter Strike: Global Offensive server

This repository contains code to deploy, provision and manage a Counter Strike: Global Offensive server based on the Amazon Web Services cloud platform.

Counter Strike 1.6 logo AWS logo

Deployment

This process should be based on the AWS region closest to the players, which should offer them the lowest latency and therefore a better experience. Nevertheless, pricing differences amongst regions might be a concern, so be sure to check!

  1. Deploy the stack.

    Deploy a new CloudFormation stack based on the cfn.yaml template. None of the resources will incur in any costs at this point, except for the NAT instance, which is required by the CodeBuild project to reach the EC2 and SSM services and might be safely stopped when not needed.

  2. Create the key pair.

    1. Create the EC2 key pair, saving the private key.

      $  aws --query 'KeyMaterial' --output text ec2 create-key-pair --key-name csgo > ~/.ssh/csgo.pem
      
    2. Upload the private key to the SSM parameter store.

      $  aws ssm put-parameter --name /csgo/ssh-key --type SecureString --value "file://${HOME}/.ssh/csgo.pem"
      

      CodeBuild will retrieve it later to build the AMI. Since it will do so in a safe manner, a separate key pair is not required.

  3. Build the server image.

    The installation and configuration of the Counter Strike: Global Offensive server takes some time. To avoid having to repeat that effort needlessly, the process is performed once and saved as an EC2 machine image, which is then used to spawn instances from it.

    The build process of the AMI is handled by a CodeBuild project, such that you need only execute the following command:

    $  aws codebuild start-build --project-name csgo-ami
    

    Should there not be enough capacity for the default c5.large instance type used for the purpose, you may override it as follows:

    $  aws codebuild start-build --project-name csgo-ami --environment-variables-override name=INSTANCE_TYPE,type=PLAINTEXT,value=t2.micro
    

    While you wait for the process to complete, continue with the next steps. When it finishes, you can stop the NAT instance.

  4. Upload your secrets.

    A couple of keys are needed for the game server to function properly. In order to streamline their management and enable their replacement while keeping them safe, the parameter store is made use of.

    • GSLT

      Valve introduced so-called game server login tokens, a kind of hashes associated with an user's account which are used to identify and authenticate public game servers and enable keeping track of them despite IP address changes. You should obtain a new one at the game server account management page offered by Valve to that end.

      Then, upload it to the parameter store:

       $  aws ssm put-parameter --overwrite --name /csgo/gslt --type SecureString --value "${GSLT}"
      

      Since the login token is associated with your account, it may be used to impersonate you and thus get you in unexpected trouble. By storing it in an encrypted manner, that danger is reduced.

    • Web API key

      The web API key is required to download maps from the workshop. You can generate one for your account at the web API key generation page, also offered by Valve itself.

      Upload it to the parameter store following the same procedure:

       $  aws ssm put-parameter --overwrite --name /csgo/web-api-key --type SecureString --value "${WEB_API_KEY}"
      

      The key is also associated with your account, so it must be encrypted as well.

    You may update them at any time; server instances will pick up new values automatically when the game server service is restarted. To do so, log into the server instance via SSH and execute the following command:

    #  systemctl restart csgo-server.service
    

    Restarting the instance itself will do as well.

That's about it. Don't forget to stop the NAT instance when the AMI build finishes. Now on to the fun part!

Usage

Using the AWS server involves launching an instance, connecting to it and, finally, stopping or terminating it when you are done playing. This is made possible by the AMI, which lets us dispose of instances as we please and provides for a recovery strategy in case of failure. Thanks to Amazon's pay-as-you-go pricing model, this also helps keep costs down.

  1. Launch the instance.

    Launching the server is made straightforward thanks to the launch template, which CodeBuild updates with the ID of the newly-built AMI. Just execute:

    $  INSTANCE_ID=$(aws --query 'Instances[0].InstanceId' --output text ec2 run-instances --launch-template LaunchTemplateName=csgo-server)
    

    The default instance type is c5.large, but a mere t2.micro might do, depending on your server configuration and the number of players. It is also useful for testing due to the lower price. Nevertheless, for real use, an instance type with greater compute power, ampler network bandwidth and more reliable performance characteristics will be better suited and offer a better experience.

  2. Connect to the instance.

    In order to connect to the instance, either through SSH or with the game client, you will need its IP address. You can retrieve its public IPv4 address using the following command:

    $  INSTANCE_IP=$(aws --query 'Reservations[0].Instances[0].PublicIpAddress' --output text ec2 describe-instances --instance-ids ${INSTANCE_ID})
    

    Alternatively, you may use the DNS name, which is more catchy and will let you match it in your SSH configuration. Retrieve it as follows:

    $  INSTANCE_HOST=$(aws --query 'Reservations[0].Instances[0].PublicDnsName' --output text ec2 describe-instances --instance-ids ${INSTANCE_ID})
    

    To inspect the state of the server, upload your game configuration or perform any kind of maintenance, you can SSH into the instance as follows:

    $  ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=30 -i ~/.ssh/csgo.pem ubuntu@${INSTANCE_IP}
    

    Without the ServerAliveInterval option of the OpenSSH client, the connection would end up being dropped when idle, which can be a hassle.

  3. Stop or terminate the instance.

    After you are done playing, stop or terminate the server:

    $  # The instance and its data is preserved, but you will still be charged for the EBS volume usage
    $  aws ec2 stop-instances --instance-ids ${INSTANCE_ID}
    $  # The instance is completely terminated and its EBS volumes destroyed
    $  aws ec2 terminate-instances --instance-ids ${INSTANCE_ID}
    

Have fun!

Supported distributions

Currently supported distributions are listed below:

  • Ubuntu 18.04
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].