Installing Agones on AWS Elastic Kubernetes Service using Terraform

You can use Terraform to provision an EKS cluster and install Agones on it.


You can use Terraform to provision your Amazon EKS (Elastic Kubernetes Service) cluster and install Agones on it using the Helm Terraform provider.

An example of the EKS submodule config file can be found here: Terraform configuration with Agones submodule

Copy this file into a separate folder.

Configure your AWS CLI tool CLI configure:

aws configure

Initialise your terraform:

terraform init

Creating Cluster

By editing you can change the parameters that you need to. For instance, the - machine_type variable.

Configurable parameters:

  • cluster_name - the name of the GKE cluster (default is “agones-terraform-example”)
  • agones_version - the version of agones to install (default is the latest version from the Helm repository)
  • machine_type - EC2 instance type for hosting game servers (default is “t2.large”)
  • node_count - count of game server nodes for the default node pool (default is “4”)

Now you can create an EKS cluster and deploy Agones on EKS:

terraform apply [-var agones_version="1.2.0"]

After deploying the cluster with Agones, you can get or update your kubeconfig by using:

aws eks --region us-west-2 update-kubeconfig --name agones-cluster

With the following output:

Added new context arn:aws:eks:us-west-2:601646756426:cluster/agones-cluster to /Users/user/.kube/config

Switch kubectl context to the recently created one:

kubectl config use-context arn:aws:eks:us-west-2:601646756426:cluster/agones-cluster

Check that you are authenticated against the recently created Kubernetes cluster:

kubectl get nodes

Uninstall the Agones and delete EKS cluster

Run the following commands to delete all Terraform provisioned resources if you choose helm:

helm delete --purge agones
terraform destroy

Last modified January 11, 2020: Create AWS EKS Terraform Module (#986) (d3b9984d)