Terraform code for Counter Strike dedicated server on AWS
- Create a Game Server Login Token.
Open https://steamcommunity.com/dev/managegameservers in your browser and login with your steam account.
Create a new Login Token with the APP ID of730
(Counter String GO Game) and add a Memo so you can remember where you are using this game token.
Save the token, you'll need it later to setup the instance.
- Create an user on AWS and configure these environment variables accordingly:
AWS_SECRET_ACCESS_KEY
AWS_ACCESS_KEY_ID
terraform init
terraform plan --var-file=custom_vars.tfvars
- Configure the token in custom_vars.tfvars file,
token
key. terraform apply --var-file=custom_vars.tfvars
- If you want to pass or change any other variable in
vars.tf
use--var "KEY=VALUE"
. See vars.tf for theKEY
. This will overrwide theKEY
in custom_vars.tfvars file.
- If you want to pass or change any other variable in
Server will start downloading CS:GO. It might take up to 30 minutes for you to be able to connect to the game server.
Terraform will create the id_rsa
and id_rsa.pub
ssh keys to be used to access the instance.
The instance will be created with a public IP assocciated and will output it in the end. To access the instance
you should execute ssh ubuntu@PUBLIC_IP -i id_rsa
changing PUBLIC_IP accordingly from the output.\
if you lost the output from terraform you can run terraform output
and you'll find all information you need.
Open your terminal and type connect PUBLIC_IP
changing PUBLIC_IP accordingly.
Game Modes | Game Type | Game Mode | Map Group |
---|---|---|---|
Arms Race | 1 | 0 | mg_armsrace |
Classic Casual | 0 | 0 | mg_casualsigma, mg_casualdelta |
Classic Competitive | 0 | 1 | mg_active, mg_reserves, mg_hostage, mg_de_dust2 |
Custom | 3 | 0 | |
Deathmatch | 1 | 2 | mg_deathmatch |
Demolition | 1 | 1 | mg_demolition |
Wingman | 0 | 2 | |
Danger Zone | 6 | 0 | mg_dz_blacksite (map: dz_blacksite), mg_dz_sirocco (map: dz_irocco) |
if you want to change the game type you can change them accordingly in custom_vars.tfvars
Variable | Description | Default | Mandatory |
---|---|---|---|
token | Steam Token | - | yes |
region | AWS Region | "eu-west-2" |
yes |
security_group_name | Security Group Name Prefix | "main" |
yes |
ebs_disk_size | Size for attached AWS EBS disk | "40" |
no |
instance_type | AWS Instance Type | "m5.large" |
yes |
password | CSGO Server Password (RCON and Private) | - | no |
tags | CSGO Server Tags For Information | - | no |
logging | CSGO Server Logging | "off" |
no |
game_type | CSGO Game Type | 0 |
yes |
game_mode | CSGO Server Game Mode | 1 |
yes |
map_group | CSGO Server Map Group | "mg_active, mg_reserves, mg_hostage, mg_de_dust2" |
yes |
default_map | CSGO Server Initial Map | "de_mirage" |
yes |
max_players | CSGO Server Max Players | "10" |
yes |
Variable | Description |
---|---|
instance_public_ip | AWS Instance Public IP for RCON And Game Connection |
password | CSGO Server Password (RCON and Private) |
public_ssh_key | AWS Instance Public SSH Key |
random_pet_name | CSGO Server Hostname Random String |
To connect to the remote console use this cli rcon-cli.
- Implement Telegram or Discord notifications, see Alerts
- Remove Bots from the server on startup
- Any other ideas are welcome