Storage Lens 그룹 태그 값 업데이트하기
Storage Lens 그룹 태그 값 업데이트하기
다음 예시는 Amazon S3 콘솔, AWS Command Line Interface(AWS CLI), AWS SDK for Java를 사용해 Storage Lens 그룹 태그 값을 업데이트하는 방법을 보여줘요.
Storage Lens 그룹의 AWS 리소스 태그를 업데이트하려면
- AWS Management Console에 로그인하고 https://console.aws.amazon.com/s3/ 에서 Amazon S3 콘솔을 엽니다.
- 왼쪽 탐색 창에서 Storage Lens groups를 선택합니다.
- Storage Lens groups 아래에서 업데이트하려는 Storage Lens 그룹을 선택합니다.
- AWS resource tags 아래에서 업데이트하려는 태그를 선택합니다.
- 업데이트하려는 키-값 쌍의 같은 키로 새 태그 값을 추가합니다. 태그 값을 업데이트하려면 체크마크 아이콘을 선택합니다.
참고: 기존 태그와 같은 키를 가진 새 태그를 추가하면 이전 태그 값을 덮어씁니다.
- (선택 사항) 새 태그를 추가하려면 Add tag를 선택해 새 항목을 추가합니다. Add tags 페이지가 표시됩니다. Storage Lens 그룹에 최대 50개의 AWS 리소스 태그를 추가할 수 있습니다. 새 태그 추가를 마쳤으면 Save changes를 선택합니다.
- (선택 사항) 새로 추가한 항목을 제거하려면 제거하려는 태그 옆의 Remove를 선택합니다. 태그 제거를 마쳤으면 Save changes를 선택합니다.
다음 예시 AWS CLI 명령은 marketing-department라는 Storage Lens 그룹의 태그 값 두 개를 업데이트해요. 이 예시 명령을 사용하려면 입력 자리 표시자(user input placeholders)를 자신의 정보로 바꿔주세요.
aws s3control tag-resource --account-id 111122223333 \
--resource-arn arn:aws:s3:us-east-1:111122223333:storage-lens-group/marketing-department \
--region us-east-1 --tags Key=k1,Value=v3 Key=k2,Value=v4
다음 AWS SDK for Java 예시는 Storage Lens 그룹 태그 값 두 개를 업데이트해요. 이 예시를 사용하려면 입력 자리 표시자(user input placeholders)를 자신의 정보로 바꿔주세요.
package aws.example.s3control;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3control.S3ControlClient;
import software.amazon.awssdk.services.s3control.model.Tag;
import software.amazon.awssdk.services.s3control.model.TagResourceRequest;
public class UpdateTagsForResource {
public static void main(String[] args) {
String resourceARN = "Resource_ARN";
String accountId = "111122223333";
try {
Tag updatedResourceTag1 = Tag.builder()
.key("resource-tag-key-1")
.value("resource-tag-updated-value-1")
.build();
Tag updatedResourceTag2 = Tag.builder()
.key("resource-tag-key-2")
.value("resource-tag-updated-value-2")
.build();
TagResourceRequest tagResourceRequest = TagResourceRequest.builder()
.resourceArn(resourceARN)
.tags(updatedResourceTag1, updatedResourceTag2)
.accountId(accountId)
.build();
S3ControlClient s3ControlClient = S3ControlClient.builder()
.region(Region.US_WEST_2)
.credentialsProvider(ProfileCredentialsProvider.create())
.build();
s3ControlClient.tagResource(tagResourceRequest);
} catch (AmazonServiceException e) {
// The call was transmitted successfully, but Amazon S3 couldn't process
// it and returned an error response.
e.printStackTrace();
} catch (SdkClientException e) {
// Amazon S3 couldn't be contacted for a response, or the client
// couldn't parse the response from Amazon S3.
e.printStackTrace();
}
}
}
더 알아보기
- Storage Lens 그룹 태그 나열하기
- Storage Lens 그룹에서 AWS 리소스 태그 삭제하기