Running Teleport on AWS
We've created this guide to give customers a high level overview of how to use Teleport
on Amazon Web Services (AWS). This guide provides a high level introduction leading to
a deep dive into how to setup and run Teleport in production.
We have split this guide into:
- Teleport on AWS FAQ
- Setting up Teleport OSS on AWS
- Setting up Teleport Enterprise on AWS
- Teleport AWS Tips & Tricks
Teleport on AWS FAQ
Why would you want to use Teleport with AWS?
At some point you'll want to log into the system using SSH to help test, debug and troubleshoot a problem box. For EC2, AWS recommends creating 'Key Pairs' and has a range of other tips for securing EC2 instances.
This approach has a number of limitations:
- As your organization grows, keeping track of end users' public/private keys becomes an administrative nightmare.
- Using SSH public/private keys has a number of limitations. Read why SSH Certificates are better.
- Once a machine has been bootstrapped with SSH Keys, there isn't an easy way to add new keys and delegate access.
Which Services can I use Teleport with?
You can use Teleport for all the services that you would SSH into. This guide is focused on EC2. We have a short blog post on using Teleport with EKS. We plan to expand the guide based on feedback but will plan to add instructions for the below.
- Detailed EKS
- AWS ECS
This guide will cover how to setup, configure and run Teleport on AWS.
AWS Services required to run Teleport in HA
We recommend setting up Teleport in high availability mode (HA). In HA mode DynamoDB stores the state of the system and S3 will store audit logs.
EC2 / Autoscale
To run Teleport in a HA configuration we recommend using m4.large instances. It's best practice to separate the proxy and authentication server, using autoscaling groups for both machines. We have pre-built AMIs for both Teleport OSS and Enterprise editions. Instructions on using these AMIs are below.
DynamoDB is a key-value and document database that delivers single-digit millisecond performance at any scale. For large clusters you can provision usage but for smaller deployments you can leverage DynamoDB's autoscaling.
Teleport 4.0 leverages DynamoDB's streaming feature. When turning this on, you'll need
New Image from the streaming options. DynamoDB back-end supports two
types of Teleport data:
- Cluster state
- Audit log events
Setting Stream to
For maintainability and ease of use, we recommend following our Terraform example but below are high level definitions for the tables required to run Teleport.
|Primary partition key||HashKey (String)|
|Primary sort key||FullPath (String)|
|Primary partition key||SessionID (String)|
|Primary sort key||EventIndex (Number)|
Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance. In this Teleport setup, S3 will provide storage for recorded sessions.
We recommend using Amazon S3 Standard.
S3 provides Amazon S3 Object Lock, which is useful for customers deploying Teleport in regulated environments.
Route53 is a highly available Domain Name System (DNS) provided by AWS. It'll be needed to setup a URL for the proxy - we recommend using a subdomain.
NLB: Network Load Balancer
AWS provides many different load balancers. To setup Teleport, we recommend using a Network Load Balancer. Network Load Balancers provides TLS for the Teleport proxy and provides the TCP connections needed for Teleport proxy SSH connections.
IAM is the recommended tool for creating service access. This guide will follow the best practice of principle of least privilege (PoLP).
With AWS Certificate Manager, you can quickly request SSL/TLS certificates.
- TLS Cert: Used to provide SSL for the proxy.
- SSH Certs (not in ACM): Created and self signed by the
authentication serverand are used to delegate access to Teleport nodes.
AWS Systems Manager Parameter Store
To add new nodes to a Teleport Cluster, we recommend using a strong static token. SSM can be also used to store the enterprise licence.
Setting up a HA Teleport Cluster
Teleport's config based setup offers a wide range of customization for customers. This guide offers a range of setup options for AWS. If you have a very large account, multiple accounts, or over 10k users we would recommend getting in touch. We are more than happy to help you architect, setup and deploy Teleport into your environment.
We have these options for you.
- Using AWS Marketplace (Manual Setup)
- Deploying with CloudFormation
- Deploying with Terraform HA + Monitoring
Single OSS Teleport AMIs (Manual / GUI Setup)
This guide provides instructions on deploying Teleport using AMIs, the below instructions are designed for using the AMI and GUI. It doesn't setup Teleport in HA, so we recommend this as a starting point, but then look at the more advanced sections.
- Obtain a SSL/TLS Certificate using ACM.
- Generate and issue a certificate in ACM
teleport.acmeinc.com, use email or DNS validation as appropriate and make sure it’s approved successfully.
Step 1: Subscribe to Teleport Community Edition
Subscribe to the Teleport Community Edition on the AWS Marketplace.
- Select 'Continue to Subscribe'
- Review the Terms and Conditions, and click `Continue to Configuration'
- Configure this software. Keep options as set, you might want to change region to be in the same place as the rest of your infrastructure. Click Continue to Launch
- Launch this software Under Choose Action, select Launch through EC2.
- Launch through EC2. At this point AWS will take you from the marketplace and drop you into the EC2 panel. Link: Shortcut to EC2 Wizard
Step 2: Build instance
We recommend using an
m4.large, but a
t2.medium should be good for POC testing.
- Make sure to write appropriate values to
/etc/teleport.d/confvia user-data (using something like this):
#!/bin/bash cat >/etc/teleport.d/conf <<EOF USE_ACM="true" TELEPORT_DOMAIN_NAME="teleport.acmeinc.com" TELEPORT_EXTERNAL_HOSTNAME="teleport.acmeinc.com" TELEPORT_EXTERNAL_PORT="443" TELEPORT_PROXY_SERVER_LB="test-nlb.acmeinc.com:3025" EOF
Screenshot of where to put it in via AWS console.
TELEPORT_EXTERNAL_HOSTNAME are more or less the
same thing but we keep them separate just in case you want to use a load balancer
on a different hostname.
The CA certificates for the server will be generated to have
TELEPORT_EXTERNAL_HOSTNAME as a CN,
assuming it's set when the server starts.
Step 3: Create the Load Balancers
- When using ACM you must use an application load balancer (ALB) as this will terminate SSL.
- Add the ACM certificate that you approved for
- Add a listener on the ALB for HTTPS on
- Target group will point to your instance - point to HTTP on
- Create a http health check, point to
- Create a DNS record for
- Point this to the public A record of the ALB as provided by Amazon.
- Add the ACM certificate that you approved for
- You also need to set up a network load balancer (NLB) for the auth traffic:
- Set up a listener on
- Target group will point to your instance - point to
- Create a DNS record for
- Point this to the public A record of the NLB as provided by Amazon
- Make sure that your DNS record is also reflected in
TELEPORT_PROXY_SERVER_LBin the user data
- Launch the instance (you can also use an already-running instance if you follow the instructions at the bottom of this section)
- Set up a listener on
Step 4: Create Teleport user
- We are going to use
tctlcommand to create a user for Teleport. The first step is to SSH into the newly created OSS Teleport box.
ssh -i id_rsa [email protected]
^ Replace with IP given available from the EC2 instance list.
➜ ~ ssh -i id_rsa [email protected] Warning: Identity file id_rsa not accessible: No such file or directory. The authenticity of host '220.127.116.11 (18.104.22.168)' can't be established. ECDSA key fingerprint is SHA256:YnTAP29shPpaAbLasfwazkIx7qFsKVWP3Pw40ehiHKg. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '22.214.171.124' (ECDSA) to the list of known hosts. Enter passphrase for key '/Users/benarent/.ssh/id_rsa': Last login: Tue Jun 18 00:07:25 2019 from 126.96.36.199 __| __|_ ) _| ( / Amazon Linux 2 AMI ___|\___|___| https://aws.amazon.com/amazon-linux-2/ No packages needed for security; 7 packages available Run "sudo yum update" to apply all updates. [[email protected] ~]$
- Apply Updates
sudo yum update
- Create a new admin user
sudo tctl users add teleport-admin ec2-user
[[email protected] ~]$ sudo tctl users add teleport-admin ec2-user Signup token has been created and is valid for 1 hours. Share this URL with the user: https://teleport.acme.com:443/web/newuser/cea9871a42e780dff86528fa1b53f382 NOTE: Make sure teleport.acme.com:443 points at a Teleport proxy which users can access.
Step 5: Finish You've now successfully setup a simple Teleport AMI, that uses local storage and has itself as a node. Next we'll look at using HA services to create a more scalable Teleport install.
Reconfiguring/using a pre-existing instance
To reconfigure any of this, or to do it on a running instance:
Make the appropriate changes to /etc/teleport.d/conf
rm -f /etc/teleport.yaml
systemctl restart teleport-generate-config.service
systemctl restart teleport-acm.service
If you have changed the external hostname, you may need to delete
/var/lib/teleport and start again.
Deploying with CloudFormation
We are currently working on an updated CloudFormation guide but you can start with our AWS Marketplace example. It requires a VPC, but we expect customers to deploy within an already existing VPC.
Deploying with Terraform
To deploy Teleport in AWS using Terraform look at our AWS Guide.
Installing Teleport to EC2 Server
Customers run many workloads within EC2 and depending on how you work there are many ways to integrate Teleport onto your servers. We recommend looking at our Admin manual.
In short, to add new nodes / EC2 servers that you can "SSH into" you'll need to 1. Install the Teleport Binary on the Server - Run Teleport, we recommend using SystemD - Set the correct settings in /etc/teleport.yaml - Add EC2 nodes to the Teleport cluster
Using Teleport with EKS
We are working on a step by step guide for working with EKS. This blog post is a good place to start.
To upgrade to a newer version of Teleport:
- Back up
/etc/teleport.d/and the contents of
- Launch a new instance with the correct AMI for a newer version of Teleport
/var/lib/teleportto the new instance, overwriting anything that already exists
- Copy and its contents should also be backed up and copied over to the new instance.
- Either restart the instance, or log in via SSH and run
sudo systemctl restart teleport.service
Running Teleport Enterprise on AWS
Most of this guide has been designed for OSS Teleport. Most of this guide also applies to Teleport Enterprise with a few extra notes around adding a license and getting the correct binary. If you would like help setting up Teleport Enterprise on AWS, please mail us at [email protected]
Teleport AWS Tips & Tricks
Generating labels from AWS tags
Labels can be a useful addition to the Teleport UI. Simply add some or all of the
below to Teleport Nodes in
etc/teleport.yaml to have helpful labels in the Teleport UI.
commands: - name: arch command: [uname, -p] period: 1h0m0s - name: kernel command: [uname, -r] period: 1h0m0s - name: uptime command: [uptime, -p] period: 1h0m0s - name: internal command: [curl, "http://169.254.169.254/latest/meta-data/local-ipv4"] period: 1h0m0s - name: external command: [curl, "http://169.254.169.254/latest/meta-data/public-ipv4"] period: 1h0m0s
Create labels based on EC2 Tags.