

# S3 Access Grants의 태그 관리
<a name="access-grants-tagging"></a>

Amazon S3 Access Grants의 태그는 Amazon S3의 [객체 태그](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html)와 유사한 특성을 가지고 있습니다. 각 태그는 키-값 페어입니다. 태그를 지정할 수 있는 S3 Access Grants의 리소스는 S3 Access Grants [인스턴스](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-grants-instance.html), [위치](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-grants-location.html) 및 [권한 부여](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-grants-grant.html)입니다.

**참고**  
S3 Access Grants에서는 태그 지정에 객체 태그 지정과는 다른 API 작업을 사용합니다. S3 Access Grants는 [https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_TagResource.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_TagResource.html), [https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_UntagResource.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_UntagResource.html) 및 [https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListTagsForResource.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListTagsForResource.html) API 작업을 사용하며, 리소스는 S3 Access Grants 인스턴스, 등록된 위치 또는 액세스 권한 부여일 수 있습니다.

[객체 태그](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html)와 마찬가지로 다음과 같은 제한이 적용됩니다.
+ S3 Access Grants 리소스를 만들 때 새로운 리소스에 태그를 추가하거나 기존 리소스에 태그를 추가할 수 있습니다.
+ 한 리소스에 태그를 최대 10개까지 연결할 수 있습니다. 여러 태그가 동일한 리소스에 연결된 경우 고유한 태그 키가 있어야 합니다.
+ 태그 키의 최대 길이는 128개 유니코드 문자이며, 태그 값의 최대 길이는 256개 유니코드 문자입니다. 태그는 내부적으로 UTF-16 형식으로 표시됩니다. UTF-16에서 문자는 1 또는 2자 위치를 차지합니다.
+ 키와 값은 대/소문자를 구분합니다.

태그 제한에 대한 자세한 내용은 *AWS Billing 사용 설명서*의 [사용자 정의 태그 제한](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html)을 참조하세요.

AWS Command Line Interface(AWS CLI), Amazon S3 REST API 또는 AWS SDK를 사용하여 S3 Access Grants의 리소스에 태그를 지정할 수 있습니다.

## AWS CLI 사용
<a name="access-grants-tagging-cli"></a>

AWS CLI를 설치하려면 *AWS Command Line Interface 사용 설명서*의 [AWS CLI 설치](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)를 참조하세요.

S3 Access Grants 리소스를 생성할 때 또는 생성한 후에 리소스에 태그를 지정할 수 있습니다. 다음 예시는 S3 Access Grants 인스턴스에 태그를 지정하거나 태그를 해제하는 방법을 보여줍니다. 등록된 위치 및 액세스 권한 부여에도 유사한 작업을 수행할 수 있습니다.

다음 예시 명령을 사용하려면 `{{user input placeholders}}`를 실제 정보로 대체하세요.

**Example - 태그를 지정하여 S3 Access Grants 인스턴스 생성**  

```
aws s3control create-access-grants-instance \
 --account-id {{111122223333}} \
 --profile {{access-grants-profile}} \
 --region {{us-east-2}} \
 --tags Key={{tagKey1}},Value={{tagValue1}}
```
응답:  

```
 {
    "CreatedAt": "{{2023-10-25T01:09:46.719000+00:00}}",
    "AccessGrantsInstanceId": "default",
    "AccessGrantsInstanceArn": "arn:aws:s3:{{us-east-2}}:{{111122223333}}:access-grants/default"
}
```

**Example - 이미 생성된 S3 Access Grants 인스턴스에 태그 지정**  

```
aws s3control tag-resource \
--account-id {{111122223333}} \
--resource-arn "arn:aws:s3:{{us-east-2}}:{{111122223333}}:access-grants/default" \
--profile {{access-grants-profile}} \
--region {{us-east-2}} \
--tags Key={{tagKey2}},Value={{tagValue2}}
```

**Example - S3 Access Grants 인스턴스의 태그 나열**  

```
aws s3control list-tags-for-resource \
--account-id {{111122223333}} \
--resource-arn "arn:aws:s3:{{us-east-2}}:{{111122223333}}:access-grants/default" \
--profile {{access-grants-profile}} \
--region {{us-east-2}}
```
응답:  

```
{
    "Tags": [
        {
            "Key": "{{tagKey1}}",
            "Value": "{{tagValue1}}"
        },
        {
            "Key": "{{tagKey2}}",
            "Value": "{{tagValue2}}"
        }
    ]
}
```

**Example - S3 Access Grants 인스턴스의 태그 해제**  

```
aws s3control untag-resource \
 --account-id {{111122223333}} \
 --resource-arn "arn:aws:s3:{{us-east-2}}:{{111122223333}}:access-grants/default" \
 --profile {{access-grants-profile}} \
 --region {{us-east-2}} \
 --tag-keys "{{tagKey2}}"
```

## REST API 사용
<a name="access-grants-tagging-rest-api"></a>

Amazon S3 API를 사용하여 S3 Access Grants 인스턴스, 등록된 위치 또는 액세스 권한 부여에 태그를 지정하거나 해제하거나 나열할 수 있습니다. S3 Access Grants 태그 관리를 위한 REST API 지원에 대한 자세한 내용은 **Amazon Simple Storage Service API 참조의 다음 섹션을 참조하세요.
+  [https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_TagResource.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_TagResource.html) 
+  [https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_UntagResource.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_UntagResource.html) 
+  [https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListTagsForResource.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListTagsForResource.html)