InfoGrab Docs

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
Note

여러 리소스를 관리하는 서비스(예: 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 tctl and tsh clients.

    Installing `tctl` and `tsh` clients
    1. Determine the version of your Teleport cluster. The tctl and tsh clients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at /v1/webapi/find and 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')"
      
    2. Follow the instructions for your platform to install tctl and tsh clients:

  • Amazon EC2 인스턴스에서 실행 중인 Teleport 에이전트 하나. Teleport 에이전트 설정 방법은 가이드를 참조하십시오.

인스턴스 메타데이터에서 태그 활성화#

Teleport가 EC2 태그를 가져올 수 있도록 하려면 인스턴스 메타데이터에서 태그를 활성화해야 합니다. AWS 콘솔이나 AWS CLI를 통해 활성화할 수 있습니다. 자세한 내용은 AWS 문서를 참조하십시오.

참고

Nitro 시스템에서 실행 중인 인스턴스만 실행 중에 태그를 업데이트합니다. 다른 모든 인스턴스 유형은 태그를 업데이트하려면 재시작해야 합니다.

AWS EC2 콘솔#

인스턴스 메타데이터 태그가 활성화된 새 인스턴스를 시작하려면:

  1. 페이지 하단의 고급 옵션을 여십시오.
  2. 메타데이터 액세스 가능이 비활성화되지 않았는지 확인하십시오.
  3. 메타데이터에서 태그 허용을 활성화하십시오.

고급 옵션

인스턴스 메타데이터 태그를 활성화하도록 기존 인스턴스를 수정하려면:

  1. 인스턴스 요약에서 작업 > 인스턴스 설정 > 인스턴스 메타데이터에서 태그 허용으로 이동하십시오.

인스턴스 설정

  1. 허용을 활성화하십시오.

태그 허용

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

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
Note

여러 리소스를 관리하는 서비스(예: 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 tctl and tsh clients.

    Installing `tctl` and `tsh` clients
    1. Determine the version of your Teleport cluster. The tctl and tsh clients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at /v1/webapi/find and 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')"
      
    2. Follow the instructions for your platform to install tctl and tsh clients:

  • Amazon EC2 인스턴스에서 실행 중인 Teleport 에이전트 하나. Teleport 에이전트 설정 방법은 가이드를 참조하십시오.

인스턴스 메타데이터에서 태그 활성화#

Teleport가 EC2 태그를 가져올 수 있도록 하려면 인스턴스 메타데이터에서 태그를 활성화해야 합니다. AWS 콘솔이나 AWS CLI를 통해 활성화할 수 있습니다. 자세한 내용은 AWS 문서를 참조하십시오.

참고

Nitro 시스템에서 실행 중인 인스턴스만 실행 중에 태그를 업데이트합니다. 다른 모든 인스턴스 유형은 태그를 업데이트하려면 재시작해야 합니다.

AWS EC2 콘솔#

인스턴스 메타데이터 태그가 활성화된 새 인스턴스를 시작하려면:

  1. 페이지 하단의 고급 옵션을 여십시오.
  2. 메타데이터 액세스 가능이 비활성화되지 않았는지 확인하십시오.
  3. 메타데이터에서 태그 허용을 활성화하십시오.

고급 옵션

인스턴스 메타데이터 태그를 활성화하도록 기존 인스턴스를 수정하려면:

  1. 인스턴스 요약에서 작업 > 인스턴스 설정 > 인스턴스 메타데이터에서 태그 허용으로 이동하십시오.

인스턴스 설정

  1. 허용을 활성화하십시오.

태그 허용

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