View a markdown version of this page

도메인 태그 지정(AWS SDKs) - Amazon OpenSearch Service

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

도메인 태그 지정(AWS SDKs)

AWS SDKs(Android 및 iOS SDKs 제외)는 , AddTags ListTags및 작업을 포함하여 Amazon OpenSearch Service API 참조에 정의된 모든 RemoveTags 작업을 지원합니다. AWS SDKs 설치 및 사용에 대한 자세한 내용은 AWS 소프트웨어 개발 키트를 참조하세요.

Python

이 예제에서는 AWS SDK for Python(Boto)의 OpenSearchService 하위 수준 Python 클라이언트를 사용하여 도메인에 태그를 추가하고, 도메인에 연결된 태그를 나열하고, 도메인에서 태그를 제거합니다. DOMAIN_ARN, TAG_KEYTAG_VALUE의 값을 입력해야 합니다.

import boto3 from botocore.config import Config # import configuration DOMAIN_ARN = '' # ARN for the domain. i.e "arn:aws:es:us-east-1:123456789012:domain/my-domain TAG_KEY = '' # The name of the tag key. i.e 'Smileyface' TAG_VALUE = '' # The value assigned to the tag. i.e 'Practicetag' # defines the configurations parameters such as region my_config = Config(region_name='us-east-1') client = boto3.client('opensearch', config=my_config) # defines the client variable def addTags(): """Adds tags to the domain""" response = client.add_tags(ARN=DOMAIN_ARN, TagList=[{'Key': TAG_KEY, 'Value': TAG_VALUE}]) print(response) def listTags(): """List tags that have been added to the domain""" response = client.list_tags(ARN=DOMAIN_ARN) print(response) def removeTags(): """Remove tags that have been added to the domain""" response = client.remove_tags(ARN=DOMAIN_ARN, TagKeys=[TAG_KEY]) print('Tag removed') return response