Terraform Sample for Twitch Extensions

This section walks you through setting up a cloud infrastructure using a sample Terraform configuration designed for the Twitch Extension Sample. This sample uses Amazon Web Services (AWS) as the cloud service-provider.

Overview

You will find in the sdk 2 Terraform configuration to help you starting an infrastructure in order to test the Twitch Extension Sample. We will use Amazon AWS Provider in our example. Here is a summary of what will be deployed:

alb_ssl_cluster_vpc

This Terraform will create all components required for your infra to work:

  • New VPC and Public / private subnets configuration
  • Security Groups
  • Application load balancer with:
    • Https listeners on port 443.
    • Rule to redirect requests to leaf
    • Rule to redirect traffic to your web backend (socket).
  • DNS record to point to your load balancer.
  • SSL Certificate issued by Amazon ACM to make your endpoint secure and requested when deploying a Twitch Extension.
  • Genvid cluster to deploy your project configuration (EC2 Instances).

alb_ssl_cluster

This Terraform will create all components like the previous Terraform module except that you must provide and existing VPC_ID. This is useful if you want your cluster to join an existing VPC (like the default VPC in a region).

In both case, Some fees might be encountered by running the infrastructure.

Requirements

Prior to use this configuration, you need:

  1. An Amazon AWS Account.
  2. We need to create a DNS zone, in Route 53 that will then be configure as a subzone. Then we will create NS records to point a subdomain to that subzone (i.e twitch.yourdomain.com). This will simplify the creation and validation of SSL Certificates. You can find more information by going to that Page.

NOTE: Domain propragation can take up to 24 hours depending of your domain registrar. You can use a tool like dig (bash) or Resolve-DnsName (PowerShell) to validate that your DNS has been propagated.

Steps

  1. Familiarize yourself with the Preparation for Integration Steps.. This will install a bastion server and a local cluster on your computer. From that local bastion, you will then be able to deploy a cluster in the cloud on AWS.
  2. Create a new cluster (Terraforms, add new cluster).
  3. Import the terraform module name SDK-{version}/basic/alb_ssl_cluster.
  4. Fill out the Settings and follow the steps as described on Using Cluster. This will deploy a new cluster, in AWS (Cloud), with the required infrastructure to run the Twitch Sample.
  5. Refer to the Twitch Sample Tutorial documentation <insert link here> to deploy the game, the web server backend and the configuration in order to stream.

Important information about this Terraform configuration

  • This is not production ready; no backup or remote backend strategy will be deployed.
  • Web port must be static and your Nomad job must match what you have inserted in your terraform settings about the web port (i.e. 30001).
  • Leaf port is static and your Nomad job must match what you have inserted in your terraform settings about the leaf port (i.e. 30002).
  • For simplicity, we push the web and leaf endpoint to Consul. Those values are read from the terraform output in the python’s script.