How to Deploy a Connector on AWS | Twingate

How to Deploy a Connector on AWS

Overview

There are several options available for deploying Connectors on AWS depending on your particular environment and needs. In most cases, you can use the Connector deployment page in the Admin Console to configure and deploy your Connector.

Check your subnet configuration

The subnet in which you deploy a Connector requires outbound Internet access, both to download the Connector container image and to connect to Twingate. Check our Best Practices for Connectors guide for more information.

Peer-to-peer connections help you to provide a better experience for your users and to stay within the Fair Use Policy for bandwidth consumption. Learn how to support peer-to-peer connections.

CloudFormation

The easiest way to deploy a connector on AWS is to use our CloudFormation template. Follow the steps below to deploy a connector through CloudFormation:

EC2 Deployment

If you are deploying on an EC2 instance, you can follow the general Linux Connector deployment instructions for full details.

In summary:

Please see our Connector Best Practices overview for general recommendations as well as hardware recommendations for EC2 instances.

AMI Deployment

We offer an AWS AMI that has the Connector systemd service pre-installed on a base Linux Ubuntu x86 image. Use the steps below to create and configure an EC2 instance with this AMI.

Security Best Practice: Use AWS Secrets Manager for Production

The generated deployment script embeds TWINGATE_ACCESS_TOKEN and TWINGATE_REFRESH_TOKEN directly in the EC2 instance’s user-data. Any AWS user with EC2 viewer permissions can retrieve the instance user-data and read those credentials in plain text.

For production deployments, we strongly recommend storing Connector tokens in AWS Secrets Manager and retrieving them at runtime, rather than embedding them in user-data.

Remote shell for AMI image

Twingate AMIs come pre-installed with Amazon AWS SSM Agent, allowing you to remotely manage and access the Connector host instance. For more information on how to setup AWS Systems Manager, including assigning IAM roles, please refer to the System Manager user guide.

ECS Fargate Deployment

We offer an ECS Fargate container that has the Connector service pre-installed. Use the steps below to create and configure an ECS container.

ECS Fargate Task Definition

If you need to be able to ping Resources within this Remote Network, you will need to add a systemControls section to the containerDefinitions section of the task definition. This will allow the Connector to set the net.ipv4.ping_group_range sysctl value. It will look like this:

"systemControls": [
        {
           "namespace": "net.ipv4.ping_group_range",
           "value": "0 2147483647"
        }

For more information, see the AWS documentation.

Amazon Elastic Kubernetes Service (EKS) Deployment

Connectors can also be deployed on an EKS cluster using the official Twingate Helm chart. If you intend to use Twingate for K8s, you may also want to look at our Kubernetes Best Practices Guide.

Infrastructure as Code Deployment

Deployment automation is available using Terraform, Pulumi, or the Twingate API.

Don't re-use Connector tokens

Because tokens are specific to each running Connector, we recommend creating separate task definitions for each Connector instance you plan to run.

Updating the Connector

Updating Connectors running as a systemd service in either an EC2 instance or using the Twingate AMI can be done manually by using the Linux package manager, or automatically by setting up a scheduled task to check for updates. We recommend staggering updates across multiple Connectors to avoid downtime. For more details check our Systemd Connector Update Guide.

Connectors that are running in an ECS Fargate container can be upgraded through the AWS management console or CLI. For more details check our ECS Connector Update Guide.