Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFD: Import EC2 Instance Tags #12049

Merged
merged 8 commits into from
Apr 28, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions rfd/00xx-ec2-tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
authors: Andrew Burke ([email protected])
state: draft
---

# RFD X - Import EC2 Instance Tags

## What

Teleport nodes running on EC2 instances automatically add instance tags as labels.

### Related issues

- [#11627](https://github.com/gravitational/teleport/issues/11627)

## Why

The current recommended method of [using EC2 tags as Teleport labels](https://goteleport.com/docs/setup/guides/ec2-tags/) requires
- Creating a custom script to fetch the tags
- Individually adding each tag as a dynamic label
- Using the AWS API gateway, where the cost scales with the number of nodes using it

As of January 2022, [instance tags are available via the instance metadata service](https://aws.amazon.com/about-aws/whats-new/2022/01/instance-tags-amazon-ec2-instance-metadata-service/). This will allow Teleport nodes to discover their own instance tags. Unlike the AWS API gateway, instance metadata requests are free and per-instance.

## Details
atburke marked this conversation as resolved.
Show resolved Hide resolved

EC2 tags will be supported everywhere that dynamic labels are currently supported (i.e. SSH, Kube, Apps, and Databases).
atburke marked this conversation as resolved.
Show resolved Hide resolved

When a node is created, check if it is running in an EC2 instance. If it is, start a service that periodically (every hour) queries the instance metadata service and updates the tags. Tags created this way will use the `aws` prefix.
atburke marked this conversation as resolved.
Show resolved Hide resolved
atburke marked this conversation as resolved.
Show resolved Hide resolved

In order to use this feature, instance tags in metadata must be enabled for the instance.
atburke marked this conversation as resolved.
Show resolved Hide resolved

### Special Tags

If the instance has the tag `Hostname` with a nonempty value, use that value as the node's hostname.
atburke marked this conversation as resolved.
Show resolved Hide resolved