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

The SDK includes 2 Terraform configurations you can use to create cloud infrastructures for testing the Twitch Extension Sample. Both configurations create all the components required for your infrastructure to work.

  • 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).

The basic_cluster_alb_ssl configuration creates a new Virtual Private Cloud (VPC) and public/private subnets configuration.

The minimal_cluster_alb_ssl configuration lets you join an existing VPC by providing its VPC_ID.

Note

Depending on your AWS account type, deploying this infrastructure might incur costs. Always verify with AWS if any fees might be encountered before deploying a Genvid MILE SDK infrastructure.

Before You Begin

Before using this configuration, you need:

  1. An Amazon AWS Account.

  2. You need to create a DNS zone in Route 53 that will then be configured as a subzone. Then you need to create NS records to point a subdomain at that subzone (for example: twitch.yourdomain.com).

    This simplifies the creation and validation of SSL Certificates. See the Amazon Route 53 Developer Guide for more information.

    Note

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

Set Up the Cluster

  1. Set up a local cluster.

    This installs 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. Follow the initial steps to create a new cluster.

  3. Import the Terraform module SDK-{version}/basic/basic_cluster_alb_ssl.

    version will match the version of the Genvid MILE SDK you’re using. (Currently 1.36.2.)

  4. Fill out the remaining settings and follow the remaining steps on the page.

    This will deploy a new cluster in the AWS cloud with the required infrastructure to run the Twitch Sample.

  5. Refer to the Twitch Sample DirectX documentation to deploy the game, the web server backend, and the configuration in order to stream.

Important Information about this Terraform Configuration

  • Currently, cluster name must be maximum 5 alphanumerics characters.
  • This is not production ready: There is no backup or remote backend strategy included in this configuration.
  • The web port must be static and your Nomad job must match your Terraform settings for the web port (usually 30001).
  • The leaf port must be static and your Nomad job must match your Terraform settings for the leaf port (usually 30002).
  • For simplicity, we push the web and leaf endpoint to Consul. Those values are read from the Terraform output in the Python script.