쿠키 기본 설정 선택

당사는 사이트와 서비스를 제공하는 데 필요한 필수 쿠키 및 유사한 도구를 사용합니다. 고객이 사이트를 어떻게 사용하는지 파악하고 개선할 수 있도록 성능 쿠키를 사용해 익명의 통계를 수집합니다. 필수 쿠키는 비활성화할 수 없지만 '사용자 지정' 또는 ‘거부’를 클릭하여 성능 쿠키를 거부할 수 있습니다.

사용자가 동의하는 경우 AWS와 승인된 제3자도 쿠키를 사용하여 유용한 사이트 기능을 제공하고, 사용자의 기본 설정을 기억하고, 관련 광고를 비롯한 관련 콘텐츠를 표시합니다. 필수가 아닌 모든 쿠키를 수락하거나 거부하려면 ‘수락’ 또는 ‘거부’를 클릭하세요. 더 자세한 내용을 선택하려면 ‘사용자 정의’를 클릭하세요.

API 및 AWS CLI 태그 작업 사용

포커스 모드
API 및 AWS CLI 태그 작업 사용 - Amazon Athena

다음 태그 작업을 사용하여 리소스에서 태그를 추가, 제거 또는 나열할 수 있습니다.

API CLI 작업 설명
TagResource tag-resource 지정된 ARN이 있는 리소스에 태그를 한 개 이상 추가하거나 덮어씁니다.
UntagResource untag-resource 지정된 ARN이 있는 리소스에서 태그를 한 개 이상 삭제합니다.
ListTagsForResource list‑tags‑for‑resource 지정된 ARN이 있는 리소스의 태그를 한 개 이상 나열합니다.
리소스를 생성할 때 태그 추가

작업 그룹 또는 데이터 카탈로그를 생성할 때 태그를 추가하려면 CreateWorkGroup 또는 CreateDataCatalog API 작업이나 AWS CLI create-work-group 또는 create-data-catalog 명령과 함께 tags 파라미터를 사용합니다.

API 작업을 사용하여 태그 관리

이 섹션의 예제에서는 태그 API 작업을 사용하여 작업 그룹 및 데이터 카탈로그의 태그를 관리하는 방법을 보여줍니다. 예제는 Java 프로그래밍 언어로 작성되어 있습니다.

다음 예제에서는 작업 그룹 workgroupA에 두 개의 태그를 추가합니다.

List<Tag> tags = new ArrayList<>(); tags.add(new Tag().withKey("tagKey1").withValue("tagValue1")); tags.add(new Tag().withKey("tagKey2").withValue("tagValue2")); TagResourceRequest request = new TagResourceRequest() .withResourceARN("arn:aws:athena:us-east-1:123456789012:workgroup/workgroupA") .withTags(tags); client.tagResource(request);

다음 예제에서는 데이터 카탈로그 datacatalogA에 두 개의 태그를 추가합니다.

List<Tag> tags = new ArrayList<>(); tags.add(new Tag().withKey("tagKey1").withValue("tagValue1")); tags.add(new Tag().withKey("tagKey2").withValue("tagValue2")); TagResourceRequest request = new TagResourceRequest() .withResourceARN("arn:aws:athena:us-east-1:123456789012:datacatalog/datacatalogA") .withTags(tags); client.tagResource(request);
참고

중복된 태그 키를 동일한 리소스에 추가하지 마세요. 이렇게 할 경우 Athena에서 오류 메시지가 표시됩니다. 개별 TagResource 작업의 기존 태그 키를 사용하여 리소스에 태그를 지정할 경우 새 태그 값이 기존 값을 덮어씁니다.

다음 예제에서는 작업 그룹 workgroupA에 두 개의 태그를 추가합니다.

List<Tag> tags = new ArrayList<>(); tags.add(new Tag().withKey("tagKey1").withValue("tagValue1")); tags.add(new Tag().withKey("tagKey2").withValue("tagValue2")); TagResourceRequest request = new TagResourceRequest() .withResourceARN("arn:aws:athena:us-east-1:123456789012:workgroup/workgroupA") .withTags(tags); client.tagResource(request);

다음 예제에서는 데이터 카탈로그 datacatalogA에 두 개의 태그를 추가합니다.

List<Tag> tags = new ArrayList<>(); tags.add(new Tag().withKey("tagKey1").withValue("tagValue1")); tags.add(new Tag().withKey("tagKey2").withValue("tagValue2")); TagResourceRequest request = new TagResourceRequest() .withResourceARN("arn:aws:athena:us-east-1:123456789012:datacatalog/datacatalogA") .withTags(tags); client.tagResource(request);
참고

중복된 태그 키를 동일한 리소스에 추가하지 마세요. 이렇게 할 경우 Athena에서 오류 메시지가 표시됩니다. 개별 TagResource 작업의 기존 태그 키를 사용하여 리소스에 태그를 지정할 경우 새 태그 값이 기존 값을 덮어씁니다.

다음 예제에서는 작업 그룹 workgroupA에서 tagKey2를 제거합니다.

List<String> tagKeys = new ArrayList<>(); tagKeys.add("tagKey2"); UntagResourceRequest request = new UntagResourceRequest() .withResourceARN("arn:aws:athena:us-east-1:123456789012:workgroup/workgroupA") .withTagKeys(tagKeys); client.untagResource(request);

다음 예제에서는 데이터 카탈로그 datacatalogA에서 tagKey2를 제거합니다.

List<String> tagKeys = new ArrayList<>(); tagKeys.add("tagKey2"); UntagResourceRequest request = new UntagResourceRequest() .withResourceARN("arn:aws:athena:us-east-1:123456789012:datacatalog/datacatalogA") .withTagKeys(tagKeys); client.untagResource(request);

다음 예제에서는 작업 그룹 workgroupA에서 tagKey2를 제거합니다.

List<String> tagKeys = new ArrayList<>(); tagKeys.add("tagKey2"); UntagResourceRequest request = new UntagResourceRequest() .withResourceARN("arn:aws:athena:us-east-1:123456789012:workgroup/workgroupA") .withTagKeys(tagKeys); client.untagResource(request);

다음 예제에서는 데이터 카탈로그 datacatalogA에서 tagKey2를 제거합니다.

List<String> tagKeys = new ArrayList<>(); tagKeys.add("tagKey2"); UntagResourceRequest request = new UntagResourceRequest() .withResourceARN("arn:aws:athena:us-east-1:123456789012:datacatalog/datacatalogA") .withTagKeys(tagKeys); client.untagResource(request);

다음 예제에서는 작업 그룹 workgroupA에 대한 태그를 나열합니다.

ListTagsForResourceRequest request = new ListTagsForResourceRequest() .withResourceARN("arn:aws:athena:us-east-1:123456789012:workgroup/workgroupA"); ListTagsForResourceResult result = client.listTagsForResource(request); List<Tag> resultTags = result.getTags();

다음 예제에서는 데이터 카탈로그 datacatalogA에 대한 태그를 나열합니다.

ListTagsForResourceRequest request = new ListTagsForResourceRequest() .withResourceARN("arn:aws:athena:us-east-1:123456789012:datacatalog/datacatalogA"); ListTagsForResourceResult result = client.listTagsForResource(request); List<Tag> resultTags = result.getTags();

다음 예제에서는 작업 그룹 workgroupA에 대한 태그를 나열합니다.

ListTagsForResourceRequest request = new ListTagsForResourceRequest() .withResourceARN("arn:aws:athena:us-east-1:123456789012:workgroup/workgroupA"); ListTagsForResourceResult result = client.listTagsForResource(request); List<Tag> resultTags = result.getTags();

다음 예제에서는 데이터 카탈로그 datacatalogA에 대한 태그를 나열합니다.

ListTagsForResourceRequest request = new ListTagsForResourceRequest() .withResourceARN("arn:aws:athena:us-east-1:123456789012:datacatalog/datacatalogA"); ListTagsForResourceResult result = client.listTagsForResource(request); List<Tag> resultTags = result.getTags();

AWS CLI를 사용하여 태그 관리

다음 예제는 AWS CLI를 사용하여 데이터 카탈로그에서 태그를 생성하고 관리하는 방법을 보여줍니다.

tag-resource 명령은 지정된 리소스에 태그를 한 개 이상 추가합니다.

구문

aws athena tag-resource --resource-arn arn:aws:athena:region:account_id:datacatalog/catalog_name --tags Key=string,Value=string Key=string,Value=string

--resource-arn 파라미터는 태그가 추가되는 리소스를 지정합니다. --tags 파라미터는 리소스에 태그로 추가할 공백으로 구분된 키-값 페어의 목록을 지정합니다.

다음 예제에서는 데이터 카탈로그 mydatacatalog에 태그를 추가합니다.

aws athena tag-resource --resource-arn arn:aws:athena:us-east-1:111122223333:datacatalog/mydatacatalog --tags Key=Color,Value=Orange Key=Time,Value=Now

결과를 표시하려면 list-tags-for-resource 명령을 사용합니다.

create-data-catalog 명령 사용 시 태그 추가에 대한 자세한 내용은 카탈로그 등록: Create-data-catalog 단원을 참조하세요.

tag-resource 명령은 지정된 리소스에 태그를 한 개 이상 추가합니다.

구문

aws athena tag-resource --resource-arn arn:aws:athena:region:account_id:datacatalog/catalog_name --tags Key=string,Value=string Key=string,Value=string

--resource-arn 파라미터는 태그가 추가되는 리소스를 지정합니다. --tags 파라미터는 리소스에 태그로 추가할 공백으로 구분된 키-값 페어의 목록을 지정합니다.

다음 예제에서는 데이터 카탈로그 mydatacatalog에 태그를 추가합니다.

aws athena tag-resource --resource-arn arn:aws:athena:us-east-1:111122223333:datacatalog/mydatacatalog --tags Key=Color,Value=Orange Key=Time,Value=Now

결과를 표시하려면 list-tags-for-resource 명령을 사용합니다.

create-data-catalog 명령 사용 시 태그 추가에 대한 자세한 내용은 카탈로그 등록: Create-data-catalog 단원을 참조하세요.

list-tags-for-resource 명령은 지정된 리소스에 대한 태그를 나열합니다.

구문

aws athena list-tags-for-resource --resource-arn arn:aws:athena:region:account_id:datacatalog/catalog_name

--resource-arn 파라미터는 태그를 나열하기 위한 리소스를 지정합니다.

다음 예제에서는 데이터 카탈로그 mydatacatalog에 대한 태그를 나열합니다.

aws athena list-tags-for-resource --resource-arn arn:aws:athena:us-east-1:111122223333:datacatalog/mydatacatalog

다음 샘플 결과는 JSON 형식입니다.

{ "Tags": [ { "Key": "Time", "Value": "Now" }, { "Key": "Color", "Value": "Orange" } ] }

list-tags-for-resource 명령은 지정된 리소스에 대한 태그를 나열합니다.

구문

aws athena list-tags-for-resource --resource-arn arn:aws:athena:region:account_id:datacatalog/catalog_name

--resource-arn 파라미터는 태그를 나열하기 위한 리소스를 지정합니다.

다음 예제에서는 데이터 카탈로그 mydatacatalog에 대한 태그를 나열합니다.

aws athena list-tags-for-resource --resource-arn arn:aws:athena:us-east-1:111122223333:datacatalog/mydatacatalog

다음 샘플 결과는 JSON 형식입니다.

{ "Tags": [ { "Key": "Time", "Value": "Now" }, { "Key": "Color", "Value": "Orange" } ] }

untag-resource 명령은 지정된 리소스에서 지정된 태그 키 및 관련된 값을 제거합니다.

구문

aws athena untag-resource --resource-arn arn:aws:athena:region:account_id:datacatalog/catalog_name --tag-keys key_name [key_name ...]

--resource-arn 파라미터는 태그를 제거하기 위한 리소스를 지정합니다. --tag-keys 파라미터는 공백으로 구분된 키 이름 목록을 사용합니다. untag-resource 명령은 지정된 각 키 이름에서 키 및 해당 값을 모두 제거합니다.

다음 예제에서는 ColorTime 키와 해당 값을 mydatacatalog 카탈로그 리소스에서 제거합니다.

aws athena untag-resource --resource-arn arn:aws:athena:us-east-1:111122223333:datacatalog/mydatacatalog --tag-keys Color Time

untag-resource 명령은 지정된 리소스에서 지정된 태그 키 및 관련된 값을 제거합니다.

구문

aws athena untag-resource --resource-arn arn:aws:athena:region:account_id:datacatalog/catalog_name --tag-keys key_name [key_name ...]

--resource-arn 파라미터는 태그를 제거하기 위한 리소스를 지정합니다. --tag-keys 파라미터는 공백으로 구분된 키 이름 목록을 사용합니다. untag-resource 명령은 지정된 각 키 이름에서 키 및 해당 값을 모두 제거합니다.

다음 예제에서는 ColorTime 키와 해당 값을 mydatacatalog 카탈로그 리소스에서 제거합니다.

aws athena untag-resource --resource-arn arn:aws:athena:us-east-1:111122223333:datacatalog/mydatacatalog --tag-keys Color Time

이 페이지에서

프라이버시사이트 이용 약관쿠키 기본 설정
© 2025, Amazon Web Services, Inc. 또는 계열사. All rights reserved.