EC2 태그를 Teleport 노드 레이블로 사용
AWS EC2 인스턴스에서 실행할 때 Teleport는 EC2 태그를 자동으로 감지하고 SSH 노드, 애플리케이션, 데이터베이스, Kubernetes 클러스터의 Teleport 레이블로 가져옵니다. TeleportHostname 태그가 있는 경우 해당 값(소문자여야 함)이 노드의 호스트명을 재정의합니다.
AWS EC2 인스턴스에서 실행할 때 Teleport는 EC2 태그를 자동으로 감지하고 SSH 노드, 애플리케이션, 데이터베이스, Kubernetes 클러스터의 Teleport 레이블로 가져옵니다. 이 방식으로 생성된 레이블에는 aws/ 접두사가 붙습니다. Teleport 프로세스가 시작할 때 인스턴스 메타데이터 서비스에서 모든 태그를 가져와 레이블로 추가합니다. 프로세스는 매 시간 태그를 업데이트하므로 새로 생성되거나 삭제된 태그가 레이블에 반영됩니다.
TeleportHostname 태그가 있는 경우 해당 값(소문자여야 함)이 노드의 호스트명을 재정의합니다.
$ tsh ls
Node Name Address Labels
-------------------- -------------- -----------------------------------------------------------------------------------------------------------------------
fakehost.example.com 127.0.0.1:3022 env=example,hostname=ip-172-31-53-70,aws/Name=atburke-dev,aws/TagKey=TagValue,aws/TeleportHostname=fakehost.example.com
여러 리소스를 관리하는 서비스(예: Database Service)의 경우 각 리소스는 EC2에서 동일한 레이블을 받습니다.
사전 요구 사항#
-
A running Teleport cluster. If you want to get started with Teleport, sign up for a free trial or set up a demo environment.
-
The
tctlandtshclients.Installing `tctl` and `tsh` clients
-
Determine the version of your Teleport cluster. The
tctlandtshclients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at/v1/webapi/findand use a JSON query tool to obtain your cluster version. Replace with the web address of your Teleport Proxy Service:$ TELEPORT_DOMAIN= $ TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')" -
Follow the instructions for your platform to install
tctlandtshclients:
-
- Amazon EC2 인스턴스에서 실행 중인 Teleport 에이전트 하나. Teleport 에이전트 설정 방법은 가이드를 참조하십시오.
인스턴스 메타데이터에서 태그 활성화#
Teleport가 EC2 태그를 가져올 수 있도록 하려면 인스턴스 메타데이터에서 태그를 활성화해야 합니다. AWS 콘솔이나 AWS CLI를 통해 활성화할 수 있습니다. 자세한 내용은 AWS 문서를 참조하십시오.
AWS EC2 콘솔#
인스턴스 메타데이터 태그가 활성화된 새 인스턴스를 시작하려면:
- 페이지 하단의
고급 옵션을 여십시오. 메타데이터 액세스 가능이 비활성화되지 않았는지 확인하십시오.메타데이터에서 태그 허용을 활성화하십시오.

인스턴스 메타데이터 태그를 활성화하도록 기존 인스턴스를 수정하려면:
- 인스턴스 요약에서
작업 > 인스턴스 설정 > 인스턴스 메타데이터에서 태그 허용으로 이동하십시오.

허용을 활성화하십시오.

AWS CLI#
시작 시 인스턴스를 수정하려면:
$ aws ec2 run-instances \
--image-id <image-id> \
--instance-type <instance-type> \
--metadata-options "InstanceMetadataTags=enabled"
...
실행 중인 인스턴스를 수정하려면:
$ aws ec2 modify-instance-metadata-options \
--instance-id i-123456789example \
--instance-metadata-tags enabled
