

# Storage Lens 그룹 사용
<a name="storage-lens-group-tasks"></a>

Amazon S3 Storage Lens는 객체 메타데이터를 기반으로 사용자 지정 필터를 사용하여 지표를 집계합니다. 접두사, 접미사, 객체 태그, 객체 크기 또는 객체 수명을 사용하여 S3 Storage Lens 지표를 분석하고 필터링할 수 있습니다. Amazon S3 Storage Lens 3 버킷에서 사용량을 분류할 수도 있습니다. 따라서 S3 스토리지를 더 잘 이해하고 최적화할 수 있습니다.

Storage Lens 그룹의 데이터 시각화를 시작하려면 먼저 [Storage Lens 그룹을 S3 Storage Lens 대시보드에 연결](https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-lens-groups-dashboard-console.html#storage-lens-groups-attach-dashboard-console)해야 합니다. 대시보드에서 Storage Lens 그룹을 관리해야 하는 경우 대시보드 구성을 편집할 수 있습니다. 계정에 속한 Storage Lens 그룹을 확인하려면 해당 그룹을 나열할 수 있습니다. 대시보드에 연결된 Storage Lens 그룹을 확인하려면 대시보드의 **Storage Lens 그룹** 탭을 언제든지 확인할 수 있습니다. 기존 Storage Lens 그룹의 범위를 검토하거나 업데이트하려면 해당 세부 정보를 볼 수 있습니다. Storage Lens 그룹을 영구적으로 삭제할 수도 있습니다.

권한을 관리하기 위해 사용자 정의 AWS 리소스 태그를 만들어 Storage Lens 그룹에 추가할 수 있습니다. AWS 리소스 태그를 사용하여 부서, 사업부 또는 프로젝트에 따라 리소스를 분류할 수 있습니다. 이는 동일한 유형의 리소스가 많을 때 유용합니다. 태그를 적용하면 지정한 태그를 기반으로 특정 스토리지 렌즈 그룹을 빠르게 식별할 수 있습니다.

또한 스토리지 렌즈 그룹에 AWS 리소스 태그를 추가하면 [속성 기반 액세스 제어(ABAC)](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction_attribute-based-access-control.html)가 활성화됩니다. ABAC는 속성(이 경우 태그)을 기반으로 권한을 정의하는 권한 부여 전략입니다. 또한 IAM 정책의 리소스 태그를 지정하는 조건을 사용하여 해당 리소스의 태그를 기반으로 [AWS 리소스에 대한 액세스를 제어](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html#access_tags_control-resources)할 수 있습니다.

**Topics**
+ [Storage Lens 그룹 만들기](storage-lens-groups-create.md)
+ [대시보드에 S3 Storage Lens 그룹 연결 또는 제거](storage-lens-groups-dashboard-console.md)
+ [Storage Lens 그룹 데이터 시각화하기](storage-lens-groups-visualize.md)
+ [Storage Lens 그룹 업데이트](storage-lens-groups-update.md)
+ [Storage Lens 그룹을 통한 AWS 리소스 태그 관리](storage-lens-groups-manage-tags.md)
+ [모든 Storage Lens 그룹 목록](storage-lens-groups-list.md)
+ [Storage Lens 그룹 세부 정보 보기](storage-lens-groups-view.md)
+ [Storage Lens 그룹 삭제](storage-lens-groups-delete.md)

# Storage Lens 그룹 만들기
<a name="storage-lens-groups-create"></a>

다음 예제는 Amazon S3 콘솔, AWS Command Line Interface(AWS CLI) 및 AWS SDK for Java를 사용하여 Amazon S3 Storage Lens 그룹을 만드는 방법을 보여줍니다.

## S3 콘솔 사용
<a name="create-storage-lens-group-console"></a>

**Storage Lens 그룹을 만들려면**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)에서 S3 콘솔을 엽니다.

1. 페이지 상단의 탐색 모음에서 현재 표시된 AWS 리전의 이름을 선택합니다. 그런 다음 전환하려는 리전을 선택합니다.

1. 왼쪽 탐색 창에서 **스토리지 렌즈 그룹**을 선택합니다.

1. **Storage Lens 그룹 생성**을 선택합니다.

1. **일반**에서 **홈 리전**을 확인하고 **Storage Lens 그룹 이름**을 입력합니다.

1. **범위**에서 Storage Lens 그룹에 적용하려는 필터를 선택합니다. 여러 필터를 적용하려면 필터를 선택한 다음 **AND** 또는 **OR** 논리 연산자를 선택합니다.
   + **접두사** 필터의 경우 **접두사**를 선택하고 접두사 문자열을 입력합니다. 여러 접두사를 추가하려면 **접두사 추가**를 선택합니다. 접두사를 제거하려면 제거할 접두사 옆에 있는 **제거**를 선택합니다.
   + **객체 태그** 필터의 경우 **객체 태그**를 선택하고 객체의 키-값 쌍을 입력합니다. 그런 다음 **태그 추가**를 선택합니다. 태그를 제거하려면 제거하려는 태그 옆에 있는 **제거**를 선택합니다.
   + **접미사** 필터의 경우 **접미사**를 선택하고 접미사 문자열을 입력합니다. 접미사를 여러 개 추가하려면 **접미사 추가**를 선택합니다. 접미사를 제거하려면 제거할 지문 옆에 있는 **제거**를 선택합니다.
   + **연령** 필터의 경우 객체 연령 범위를 일 단위로 지정합니다. **최소 객체 연령 지정**을 선택하고 최소 객체 연령을 입력합니다. 그런 다음 **최대 객체 연령 지정**을 선택하고 최대 객체 수명을 입력합니다.
   + **크기** 필터의 경우 객체 크기 범위와 측정 단위를 지정합니다. **최소 객체 크기 지정**을 선택하고 최소 객체 크기를 입력합니다. **최대 객체 크기 지정**을 선택하고 최대 객체 크기를 입력합니다.

1. (선택 사항) AWS 리소스 태그의 경우 키-값 쌍을 추가한 다음 **태그 추가**를 선택합니다.

1. **Storage Lens 그룹 생성**을 선택합니다.

## AWS CLI 사용
<a name="create-storage-lens-group-cli"></a>

다음 예시 AWS CLI 명령은 스토리지 렌즈 그룹을 생성합니다. 이 예시 명령을 사용하려면 `user input placeholders`를 실제 정보로 대체하십시오.

```
aws s3control create-storage-lens-group --account-id 111122223333 \ 
--region us-east-1 --storage-lens-group=file://./marketing-department.json
```

다음 예시 AWS CLI 명령은 두 개의 AWS 리소스 태그가 있는 Storage Lens 그룹을 만듭니다. 이 예 명령을 사용하려면 `user input placeholders`를 실제 정보로 대체하세요.

```
aws s3control create-storage-lens-group --account-id 111122223333 \ 
--region us-east-1 --storage-lens-group=file://./marketing-department.json \
--tags Key=k1,Value=v1 Key=k2,Value=v2
```

JSON 구성에 대한 예제는 [Storage Lens 그룹 구성](storage-lens-groups.md#storage-lens-groups-configuration) 섹션을 참조하십시오.

## Java용 AWS SDK 사용
<a name="create-storage-lens-group-sdk-java"></a>

다음 AWS SDK for Java 예제에서는 Storage Lens 그룹을 생성합니다. 이 예제를 사용하려면 `user input placeholders`를 사용자의 정보로 대체합니다.

**Example - 단일 필터를 사용하여 Storage Lens 그룹 만들기**  
다음 예제에서는 `Marketing-Department`라는 이름의 스토리지 렌즈 그룹을 만듭니다. 이 그룹에는 연령 범위를 `30`\$1`90`로 지정하는 객체 연령 필터가 있습니다. 이 예제를 사용하려면 `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.CreateStorageLensGroupRequest;
import software.amazon.awssdk.services.s3control.model.MatchObjectAge;
import software.amazon.awssdk.services.s3control.model.StorageLensGroup;
import software.amazon.awssdk.services.s3control.model.StorageLensGroupFilter;
 
public class CreateStorageLensGroupWithObjectAge {
    public static void main(String[] args) {
        String storageLensGroupName = "Marketing-Department";
        String accountId = "111122223333";
        
        try {
            StorageLensGroupFilter objectAgeFilter = StorageLensGroupFilter.builder()
                    .matchObjectAge(MatchObjectAge.builder()
                            .daysGreaterThan(30)
                            .daysLessThan(90)
                            .build())
                    .build();

            StorageLensGroup storageLensGroup = StorageLensGroup.builder()
                    .name(storageLensGroupName)
                    .filter(objectAgeFilter)
                    .build();

            CreateStorageLensGroupRequest createStorageLensGroupRequest = CreateStorageLensGroupRequest.builder()
                    .storageLensGroup(storageLensGroup)
                    .accountId(accountId).build();

            S3ControlClient s3ControlClient = S3ControlClient.builder()
                    .region(Region.US_WEST_2)
                    .credentialsProvider(ProfileCredentialsProvider.create())
                    .build();
            s3ControlClient.createStorageLensGroup(createStorageLensGroupRequest);
        } 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();
        }
    }
}
```

**Example - 여러 필터를 포함하는 `AND` 연산자를 사용하여 Storage Lens 그룹을 만듭니다.**  
다음 예제에서는 `Marketing-Department`라는 이름의 스토리지 렌즈 그룹을 만듭니다. 이 그룹은 `AND` 연산자를 사용하여 객체가 **모든** 필터 조건과 일치해야 함을 나타냅니다. 이 예제를 사용하려면 `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.CreateStorageLensGroupRequest;
import software.amazon.awssdk.services.s3control.model.MatchObjectAge;
import software.amazon.awssdk.services.s3control.model.MatchObjectSize;
import software.amazon.awssdk.services.s3control.model.S3Tag;
import software.amazon.awssdk.services.s3control.model.StorageLensGroup;
import software.amazon.awssdk.services.s3control.model.StorageLensGroupAndOperator;
import software.amazon.awssdk.services.s3control.model.StorageLensGroupFilter;


public class CreateStorageLensGroupWithAndFilter {
    public static void main(String[] args) {
        String storageLensGroupName = "Marketing-Department";
        String accountId = "111122223333";

        try {
            // Create object tags.
            S3Tag tag1 = S3Tag.builder()
                    .key("object-tag-key-1")
                    .value("object-tag-value-1")
                    .build();
            S3Tag tag2 = S3Tag.builder()
                    .key("object-tag-key-2")
                    .value("object-tag-value-2")
                    .build();

            StorageLensGroupAndOperator andOperator = StorageLensGroupAndOperator.builder()
                    .matchAnyPrefix("prefix-1", "prefix-2", "prefix-3/sub-prefix-1")
                    .matchAnySuffix(".png", ".gif", ".jpg")
                    .matchAnyTag(tag1, tag2)
                    .matchObjectAge(MatchObjectAge.builder()
                            .daysGreaterThan(30)
                            .daysLessThan(90).build())
                    .matchObjectSize(MatchObjectSize.builder()
                            .bytesGreaterThan(1000L)
                            .bytesLessThan(6000L).build())
                    .build();

            StorageLensGroupFilter andFilter = StorageLensGroupFilter.builder()
                    .and(andOperator)
                    .build();

            StorageLensGroup storageLensGroup = StorageLensGroup.builder()
                    .name(storageLensGroupName)
                    .filter(andFilter)
                    .build();

            CreateStorageLensGroupRequest createStorageLensGroupRequest = CreateStorageLensGroupRequest.builder()
                    .storageLensGroup(storageLensGroup)
                    .accountId(accountId).build();

            S3ControlClient s3ControlClient = S3ControlClient.builder()
                    .region(Region.US_WEST_2)
                    .credentialsProvider(ProfileCredentialsProvider.create())
                    .build();
            s3ControlClient.createStorageLensGroup(createStorageLensGroupRequest);
        } 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();
        }
    }
}
```

**Example - 여러 필터를 포함하는 `OR` 연산자를 사용하여 Storage Lens 그룹을 만듭니다.**  
다음 예제에서는 `Marketing-Department`라는 이름의 스토리지 렌즈 그룹을 만듭니다. 이 그룹은 `OR` 연산자를 사용하여 접두사 필터(`prefix-1`,`prefix-2`,`prefix3/sub-prefix-1`) 또는 크기 범위가 `1000`바이트에서 `6000`바이트 사이인 객체 크기 필터를 적용합니다. 이 예제를 사용하려면 `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.CreateStorageLensGroupRequest;
import software.amazon.awssdk.services.s3control.model.MatchObjectSize;
import software.amazon.awssdk.services.s3control.model.StorageLensGroup;
import software.amazon.awssdk.services.s3control.model.StorageLensGroupFilter;
import software.amazon.awssdk.services.s3control.model.StorageLensGroupOrOperator;

public class CreateStorageLensGroupWithOrFilter {
    public static void main(String[] args) {
        String storageLensGroupName = "Marketing-Department";
        String accountId = "111122223333";

        try {
            StorageLensGroupOrOperator orOperator = StorageLensGroupOrOperator.builder()
                    .matchAnyPrefix("prefix-1", "prefix-2", "prefix-3/sub-prefix-1")
                    .matchObjectSize(MatchObjectSize.builder()
                            .bytesGreaterThan(1000L)
                            .bytesLessThan(6000L)
                            .build())
                    .build();

            StorageLensGroupFilter orFilter = StorageLensGroupFilter.builder()
                    .or(orOperator)
                    .build();

            StorageLensGroup storageLensGroup = StorageLensGroup.builder()
                    .name(storageLensGroupName)
                    .filter(orFilter)
                    .build();

            CreateStorageLensGroupRequest createStorageLensGroupRequest = CreateStorageLensGroupRequest.builder()
                    .storageLensGroup(storageLensGroup)
                    .accountId(accountId).build();

            S3ControlClient s3ControlClient = S3ControlClient.builder()
                    .region(Region.US_WEST_2)
                    .credentialsProvider(ProfileCredentialsProvider.create())
                    .build();
            s3ControlClient.createStorageLensGroup(createStorageLensGroupRequest);
        } 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();
        }
    }
}
```

**Example - 단일 필터와 두 개의 AWS 리소스 태그를 사용하여 Storage Lens 그룹을 만듭니다.**  
다음 예제에서는 접미사 필터가 있는 `Marketing-Department`라는 이름의 Storage Lens 그룹을 만듭니다. 또한 이 예제는 Storage Lens 그룹에 두 개의 AWS 리소스 태그를 추가합니다. 이 예제를 사용하려면 `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.CreateStorageLensGroupRequest;
import software.amazon.awssdk.services.s3control.model.StorageLensGroup;
import software.amazon.awssdk.services.s3control.model.StorageLensGroupFilter;
import software.amazon.awssdk.services.s3control.model.Tag;

public class CreateStorageLensGroupWithResourceTags {
    public static void main(String[] args) {
        String storageLensGroupName = "Marketing-Department";
        String accountId = "111122223333";

        try {
            // Create AWS resource tags.
            Tag resourceTag1 = Tag.builder()
                    .key("resource-tag-key-1")
                    .value("resource-tag-value-1")
                    .build();
            Tag resourceTag2 = Tag.builder()
                    .key("resource-tag-key-2")
                    .value("resource-tag-value-2")
                    .build();

            StorageLensGroupFilter suffixFilter = StorageLensGroupFilter.builder()
                    .matchAnySuffix(".png", ".gif", ".jpg")
                    .build();

            StorageLensGroup storageLensGroup = StorageLensGroup.builder()
                    .name(storageLensGroupName)
                    .filter(suffixFilter)
                    .build();

            CreateStorageLensGroupRequest createStorageLensGroupRequest = CreateStorageLensGroupRequest.builder()
                    .storageLensGroup(storageLensGroup)
                    .tags(resourceTag1, resourceTag2)
                    .accountId(accountId).build();

            S3ControlClient s3ControlClient = S3ControlClient.builder()
                    .region(Region.US_WEST_2)
                    .credentialsProvider(ProfileCredentialsProvider.create())
                    .build();
            s3ControlClient.createStorageLensGroup(createStorageLensGroupRequest);
        } 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();
        }
    }
}
```

JSON 구성에 대한 예제는 [Storage Lens 그룹 구성](storage-lens-groups.md#storage-lens-groups-configuration) 섹션을 참조하십시오.

# 대시보드에 S3 Storage Lens 그룹 연결 또는 제거
<a name="storage-lens-groups-dashboard-console"></a>

Amazon S3 Storage Lens의 고급 티어로 업그레이드한 후 [Storage Lens 그룹](https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-lens-groups-overview.html)을 대시보드에 연결할 수 있습니다. Storage Lens 그룹이 여러 개인 경우 원하는 그룹을 포함하거나 제외할 수 있습니다.

Storage Lens 그룹은 대시보드 계정의 지정된 홈 리전 내에 있어야 합니다. Storage Lens 그룹을 대시보드에 연결하면 48시간 이내에 지표 내보내기에서 추가 Storage Lens 그룹 집계 데이터를 받게 됩니다.

**참고**  
Storage Lens 그룹의 집계된 지표를 보려면 Storage Lens 대시보드에 연결해야 합니다. Storage Lens 그룹 JSON 구성 파일의 예는 [JSON의 Storage Lens 그룹을 사용한 S3 Storage Lens 예제 구성](S3LensHelperFilesCLI.md#StorageLensGroupsHelperFilesCLI)를 참조하십시오.

## S3 콘솔 사용
<a name="storage-lens-groups-attach-dashboard-console"></a>

**Storage Lens 그룹을 Storage Lens 대시보드에 연결하는 방법**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)에서 S3 콘솔을 엽니다.

1. 왼쪽 탐색 창의 **스토리지 렌즈**에서 **대시보드**를 선택합니다.

1. Storage Lens 그룹을 연결하려는 Storage Lens 대시보드의 옵션 버튼을 선택합니다.

1. **편집**을 선택합니다.

1. **지표 선택(Metrics selection)**에서 **고급 지표 및 권장 사항(Advanced metrics and recommendations)**을 선택합니다.

1. **Storage Lens 그룹 집계**를 선택합니다.
**참고**  
기본적으로 **고급 지표**도 선택됩니다. 하지만 Storage Lens 그룹 데이터를 집계하는 데 필요하지 않으므로 이 설정을 선택 취소할 수도 있습니다.

1. **Storage Lens 그룹 집계**까지 아래로 스크롤하여 데이터 집계에 포함하거나 제외하려는 Storage Lens 그룹 또는 그룹을 지정합니다. 다음 필터링 옵션을 사용할 수 있습니다.
   + 특정 Storage Lens 그룹을 포함하려면 **Storage Lens 그룹 포함**을 선택합니다. **포함할 Storage Lens 그룹**에서 Storage Lens 그룹을 선택합니다.
   + 모든 Storage Lens 그룹을 포함하려면 **이 계정에서 홈 리전의 모든 Storage Lens 그룹 포함**을 선택합니다.
   + 특정 Storage Lens 그룹을 제외하려면 **Storage Lens 그룹 제외**를 선택합니다. **제외할 Storage Lens 그룹**에서 제외하려는 Storage Lens 그룹을 선택합니다.

1. **변경 사항 저장**을 선택합니다. Storage Lens 그룹을 올바르게 구성한 경우 48시간 내에 대시보드에 추가 Storage Lens 그룹 집계 데이터가 표시됩니다.

**S3 Storage Lens 대시보드에서 Storage Lens 그룹을 제거하려면**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)에서 S3 콘솔을 엽니다.

1. 왼쪽 탐색 창의 **스토리지 렌즈**에서 **대시보드**를 선택합니다.

1. Storage Lens 그룹을 제거하려는 Storage Lens 대시보드의 옵션 버튼을 선택합니다.

1. **대시보드 구성 보기**를 선택합니다.

1. **편집**을 선택합니다.

1. 아래로 스크롤하여 **지표 선택** 섹션을 찾습니다.

1. **Storage Lens 그룹 집계**에서 제거하려는 Storage Lens 그룹 옆의 **X**를 선택합니다. 그러면 Storage Lens 그룹이 제거됩니다.

   대시보드에 모든 Storage Lens 그룹을 포함한 경우 **이 계정에 홈 리전의 모든 Storage Lens 그룹 포함** 옆의 확인란을 선택 취소하십시오.

1. **변경 사항 저장**을 선택합니다.
**참고**  
대시보드에 구성 업데이트가 반영되는 데 최장 48시간이 걸립니다.

## Java용 AWS SDK 사용
<a name="StorageLensGroupsConfigurationJava"></a>

**Example - 모든 Storage Lens 그룹을 대시보드에 연결**  
다음 Java용 SDK 예제는 계정 *111122223333*의 모든 Storage Lens 그룹을 *DashBoardConfigurationId* 대시보드에 연결합니다.  

```
package aws.example.s3control;


import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.s3control.AWSS3Control;
import com.amazonaws.services.s3control.AWSS3ControlClient;
import com.amazonaws.services.s3control.model.BucketLevel;
import com.amazonaws.services.s3control.model.PutStorageLensConfigurationRequest;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.services.s3control.model.AccountLevel;
import com.amazonaws.services.s3control.model.StorageLensConfiguration;
import com.amazonaws.services.s3control.model.StorageLensGroupLevel;

import static com.amazonaws.regions.Regions.US_WEST_2;

public class CreateDashboardWithStorageLensGroups {
    public static void main(String[] args) {
        String configurationId = "ExampleDashboardConfigurationId";
        String sourceAccountId = "111122223333";

        try {
            StorageLensGroupLevel storageLensGroupLevel = new StorageLensGroupLevel();

            AccountLevel accountLevel = new AccountLevel()
                    .withBucketLevel(new BucketLevel())
                    .withStorageLensGroupLevel(storageLensGroupLevel);

            StorageLensConfiguration configuration = new StorageLensConfiguration()
                    .withId(configurationId)
                    .withAccountLevel(accountLevel)
                    .withIsEnabled(true);

            AWSS3Control s3ControlClient = AWSS3ControlClient.builder()
                    .withCredentials(new ProfileCredentialsProvider())
                    .withRegion(US_WEST_2)
                    .build();

            s3ControlClient.putStorageLensConfiguration(new PutStorageLensConfigurationRequest()
                    .withAccountId(sourceAccountId)
                    .withConfigId(configurationId)
                    .withStorageLensConfiguration(configuration)
            );
        } 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();
        }
    }
}
```

**Example - 2개의 Storage Lens 그룹을 대시보드에 연결**  
다음 AWS SDK for Java 예제는 두 개의 Storage Lens 그룹(*StorageLensGroupName1* 및 *StorageLensGroupName2*)을 *ExampleDashboardConfigurationId* 대시보드에 연결합니다.  

```
package aws.example.s3control;

import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.services.s3control.AWSS3Control;
import com.amazonaws.services.s3control.AWSS3ControlClient;
import com.amazonaws.services.s3control.model.AccountLevel;
import com.amazonaws.services.s3control.model.BucketLevel;
import com.amazonaws.services.s3control.model.PutStorageLensConfigurationRequest;
import com.amazonaws.services.s3control.model.StorageLensConfiguration;
import com.amazonaws.services.s3control.model.StorageLensGroupLevel;
import com.amazonaws.services.s3control.model.StorageLensGroupLevelSelectionCriteria;

import static com.amazonaws.regions.Regions.US_WEST_2;

public class CreateDashboardWith2StorageLensGroups {
    public static void main(String[] args) {
        String configurationId = "ExampleDashboardConfigurationId";
        String storageLensGroupName1 = "StorageLensGroupName1";
        String storageLensGroupName2 = "StorageLensGroupName2";
        String sourceAccountId = "111122223333";

        try {
            StorageLensGroupLevelSelectionCriteria selectionCriteria = new StorageLensGroupLevelSelectionCriteria()
                    .withInclude(
                            "arn:aws:s3:" + US_WEST_2.getName() + ":" + sourceAccountId + ":storage-lens-group/" + storageLensGroupName1,
                            "arn:aws:s3:" + US_WEST_2.getName() + ":" + sourceAccountId + ":storage-lens-group/" + storageLensGroupName2);

            System.out.println(selectionCriteria);
            StorageLensGroupLevel storageLensGroupLevel = new StorageLensGroupLevel()
                    .withSelectionCriteria(selectionCriteria);

            AccountLevel accountLevel = new AccountLevel()
                    .withBucketLevel(new BucketLevel())
                    .withStorageLensGroupLevel(storageLensGroupLevel);

            StorageLensConfiguration configuration = new StorageLensConfiguration()
                    .withId(configurationId)
                    .withAccountLevel(accountLevel)
                    .withIsEnabled(true);

            AWSS3Control s3ControlClient = AWSS3ControlClient.builder()
                    .withCredentials(new ProfileCredentialsProvider())
                    .withRegion(US_WEST_2)
                    .build();

            s3ControlClient.putStorageLensConfiguration(new PutStorageLensConfigurationRequest()
                    .withAccountId(sourceAccountId)
                    .withConfigId(configurationId)
                    .withStorageLensConfiguration(configuration)
            );
        } 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();
        }
    }
}
```

**Example - 제외 항목 이외의 모든 Storage Lens 그룹 연결**  
다음 Java용 SDK 예제는 지정된 두 개의 그룹(*StorageLensGroupName1* and *StorageLensGroupName2*)을 제외한 모든 Storage Lens 그룹을 *ExampleDashboardConfigurationId* 대시보드에 연결합니다.  

```
package aws.example.s3control;


import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.services.s3control.AWSS3Control;
import com.amazonaws.services.s3control.AWSS3ControlClient;
import com.amazonaws.services.s3control.model.AccountLevel;
import com.amazonaws.services.s3control.model.BucketLevel;
import com.amazonaws.services.s3control.model.PutStorageLensConfigurationRequest;
import com.amazonaws.services.s3control.model.StorageLensConfiguration;
import com.amazonaws.services.s3control.model.StorageLensGroupLevel;
import com.amazonaws.services.s3control.model.StorageLensGroupLevelSelectionCriteria;

import static com.amazonaws.regions.Regions.US_WEST_2;

public class CreateDashboardWith2StorageLensGroupsExcluded {
    public static void main(String[] args) {
        String configurationId = "ExampleDashboardConfigurationId";
        String storageLensGroupName1 = "StorageLensGroupName1";
        String storageLensGroupName2 = "StorageLensGroupName2";
        String sourceAccountId = "111122223333";

        try {
            StorageLensGroupLevelSelectionCriteria selectionCriteria = new StorageLensGroupLevelSelectionCriteria()
                    .withInclude(
                            "arn:aws:s3:" + US_WEST_2.getName() + ":" + sourceAccountId + ":storage-lens-group/" + storageLensGroupName1,
                            "arn:aws:s3:" + US_WEST_2.getName() + ":" + sourceAccountId + ":storage-lens-group/" + storageLensGroupName2);

            System.out.println(selectionCriteria);
            StorageLensGroupLevel storageLensGroupLevel = new StorageLensGroupLevel()
                    .withSelectionCriteria(selectionCriteria);

            AccountLevel accountLevel = new AccountLevel()
                    .withBucketLevel(new BucketLevel())
                    .withStorageLensGroupLevel(storageLensGroupLevel);

            StorageLensConfiguration configuration = new StorageLensConfiguration()
                    .withId(configurationId)
                    .withAccountLevel(accountLevel)
                    .withIsEnabled(true);

            AWSS3Control s3ControlClient = AWSS3ControlClient.builder()
                    .withCredentials(new ProfileCredentialsProvider())
                    .withRegion(US_WEST_2)
                    .build();

            s3ControlClient.putStorageLensConfiguration(new PutStorageLensConfigurationRequest()
                    .withAccountId(sourceAccountId)
                    .withConfigId(configurationId)
                    .withStorageLensConfiguration(configuration)
            );
        } 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 그룹 데이터 시각화하기
<a name="storage-lens-groups-visualize"></a>

[Amazon S3 Storage Lens 대시보드에 그룹을 연결](https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-lens-groups-dashboard-console.html#storage-lens-groups-attach-dashboard-console)하여 Storage Lens 그룹 데이터를 시각화할 수 있습니다. 대시보드 구성의 Storage Lens 그룹 집계에 Storage Lens 그룹을 포함한 후 Storage Lens 그룹 데이터가 대시보드에 표시되는 데 최장 48시간이 걸릴 수 있습니다.

대시보드 구성이 업데이트되면 새로 연결된 모든 Storage Lens 그룹이 **Storage Lens 그룹** 탭 아래의 사용 가능한 리소스 목록에 나타납니다. **개요** 탭에서 데이터를 다른 차원으로 분할하여 스토리지 사용량을 더 자세히 분석할 수도 있습니다. 예를 들어 **상위 3개** 범주에 나열된 항목 중 하나를 선택하고 **분석 기준**을 선택하여 데이터를 다른 차원으로 분할할 수 있습니다. 필터 자체와 동일한 차원을 적용할 수는 없습니다.

**참고**  
Storage Lens 그룹 필터를 접두사 필터와 함께 적용하거나 그 반대로 적용할 수 없습니다. 또한 프리픽스 필터를 사용하여 Storage Lens 그룹을 더 자세히 분석할 수 없습니다.

Amazon S3 Storage Lens 대시보드의 **Storage Lens 그룹** 탭을 사용하여 대시보드에 연결된 Storage Lens 그룹의 데이터 시각화를 사용자 지정할 수 있습니다. 대시보드에 연결된 일부 Storage Lens 그룹 또는 모든 Storage Lens 그룹의 데이터를 시각화할 수 있습니다.

S3 Storage Lens 대시보드의 Storage Lens 그룹 데이터를 시각화할 때는 다음 사항에 유의하십시오.
+ S3 Storage Lens는 일치하는 모든 Storage Lens 그룹에 속한 객체의 사용량 지표를 집계합니다. 따라서 객체가 두 개 이상의 Storage Lens 그룹에 대한 필터 조건과 일치하면 스토리지 사용량 전체에서 동일한 객체에 대한 반복 횟수가 표시됩니다.
+ 객체는 Storage Lens 그룹에 포함된 필터와 일치해야 합니다. Storage Lens 그룹에 포함한 필터와 일치하는 객체가 없으면 지표가 생성되지 않습니다. 할당되지 않은 객체가 있는지 확인하려면 대시보드의 계정 수준 및 버킷 수준에서 총 객체 수를 확인하십시오.

# Storage Lens 그룹 업데이트
<a name="storage-lens-groups-update"></a>

다음 예제에서는 Amazon S3 스토리지 렌즈 그룹을 업데이트하는 방법을 보여줍니다. Amazon S3 콘솔, AWS Command Line Interface(AWS CLI) 및 AWS SDK for Java을 사용하여 Storage Lens 그룹을 업데이트할 수 있습니다.

## S3 콘솔 사용
<a name="update-storage-lens-group-console"></a>

**Storage Lens 그룹을 업데이트하려면**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)에서 S3 콘솔을 엽니다.

1. 왼쪽 탐색 창에서 **스토리지 렌즈 그룹**을 선택합니다.

1. **스토리지 렌즈 그룹**에서 업데이트하려는 스토리지 렌즈 그룹을 선택합니다.

1. **범위**에서 **편집**을 선택합니다.

1. **범위** 페이지에서 Storage Lens 그룹에 적용하려는 필터를 선택합니다. 여러 필터를 적용하려면 필터를 선택하고 **AND** 또는 **OR** 논리 연산자를 선택합니다.
   + **접두사** 필터의 경우 **접두사**를 선택하고 접두사 문자열을 입력합니다. 여러 접두사를 추가하려면 **접두사 추가**를 선택합니다. 접두사를 제거하려면 제거할 접두사 옆에 있는 **제거**를 선택합니다.
   + **객체 태그** 필터에 객체의 키-값 페어를 입력합니다. 그런 다음 **태그 추가**를 선택합니다. 태그를 제거하려면 제거하려는 태그 옆에 있는 **제거**를 선택합니다.
   + **접미사** 필터의 경우 **접미사**를 선택하고 접미사 문자열을 입력합니다. 접미사를 여러 개 추가하려면 **접미사 추가**를 선택합니다. 접미사를 제거하려면 제거할 지문 옆에 있는 **제거**를 선택합니다.
   + **연령** 필터의 경우 객체 연령 범위를 일 단위로 지정합니다. **최소 객체 연령 지정**을 선택하고 최소 객체 연령을 입력합니다. **최대 객체 연령 지정**에는 최대 객체 연령을 입력합니다.
   + **크기** 필터의 경우 객체 크기 범위와 측정 단위를 지정합니다. **최소 객체 크기 지정**을 선택하고 최소 객체 크기를 입력합니다. **최대 객체 크기 지정**에는 최대 객체 크기를 입력합니다.

1. **변경 사항 저장**을 선택합니다. Storage Lens 그룹에 대한 세부 정보 페이지가 나타납니다.

1. (선택 사항) 새 AWS 리소스 태그를 추가하려면 **AWS 리소스 태그** 섹션으로 스크롤한 다음 **태그 추가**를 선택합니다. **태그 추가** 페이지가 나타납니다.

   새 키-값 페어를 추가한 다음 **변경 내용 저장**을 선택합니다. Storage Lens 그룹에 대한 세부 정보 페이지가 나타납니다.

1. (선택 사항) 기존 AWS 리소스 태그를 제거하려면 **AWS 리소스 태그** 섹션으로 스크롤하여 리소스 태그를 선택합니다. 그런 다음 **삭제**를 선택합니다. **AWS 태그 삭제** 대화 상자가 나타납니다.

   AWS 리소스 태그를 영구 삭제하려면 **삭제**를 다시 선택합니다.
**참고**  
AWS 리소스 태그를 영구 삭제한 후에는 복원할 수 없습니다.

## AWS CLI 사용
<a name="update-storage-lens-group-cli"></a>

다음 AWS CLI 예제 명령은 `marketing-department`라는 Storage Lens 그룹의 구성 세부 정보를 반환합니다. 이 예 명령을 사용하려면 `user input placeholders`를 실제 정보로 대체하세요.



```
aws s3control get-storage-lens-group --account-id 111122223333 \ 
--region us-east-1 --name marketing-department
```

다음 AWS CLI 예제에서는 Storage Lens 그룹을 업데이트합니다. 이 예시 명령을 사용하려면 `user input placeholders`를 실제 정보로 대체하십시오.

```
aws s3control update-storage-lens-group --account-id 111122223333 \ 
--region us-east-1 --storage-lens-group=file://./marketing-department.json
```

JSON 구성에 대한 예제는 [Storage Lens 그룹 구성](storage-lens-groups.md#storage-lens-groups-configuration) 섹션을 참조하십시오.

## Java용 AWS SDK 사용
<a name="update-storage-lens-group-sdk-java"></a>

다음 AWS SDK for Java 예제에서는 계정 `111122223333` 내의 `Marketing-Department` 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.GetStorageLensGroupRequest;
import software.amazon.awssdk.services.s3control.model.GetStorageLensGroupResponse;

public class GetStorageLensGroup {
    public static void main(String[] args) {
        String storageLensGroupName = "Marketing-Department";
        String accountId = "111122223333";

        try {
            GetStorageLensGroupRequest getRequest = GetStorageLensGroupRequest.builder()
                    .name(storageLensGroupName)
                    .accountId(accountId).build();
            S3ControlClient s3ControlClient = S3ControlClient.builder()
                    .region(Region.US_WEST_2)
                    .credentialsProvider(ProfileCredentialsProvider.create())
                    .build();
            GetStorageLensGroupResponse response = s3ControlClient.getStorageLensGroup(getRequest);
            System.out.println(response);
        } 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();
        }
    }
}
```

다음 예제에서는 계정 `111122223333` 내의 `Marketing-Department`라는 이름의 Storage Lens 그룹을 업데이트합니다. 이 예제에서는`.png`, `.gif`, `.jpg` 또는 `.jpeg` 접미사와 일치하는 객체를 포함하도록 대시보드 범위를 업데이트합니다. 이 예제를 사용하려면 `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.StorageLensGroup;
import software.amazon.awssdk.services.s3control.model.StorageLensGroupFilter;
import software.amazon.awssdk.services.s3control.model.UpdateStorageLensGroupRequest;

public class UpdateStorageLensGroup {
    public static void main(String[] args) {
        String storageLensGroupName = "Marketing-Department";
        String accountId = "111122223333";

        try {
            // Create updated filter.
            StorageLensGroupFilter suffixFilter = StorageLensGroupFilter.builder()
                    .matchAnySuffix(".png", ".gif", ".jpg", ".jpeg")
                    .build();

            StorageLensGroup storageLensGroup = StorageLensGroup.builder()
                    .name(storageLensGroupName)
                    .filter(suffixFilter)
                    .build();

            UpdateStorageLensGroupRequest updateStorageLensGroupRequest = UpdateStorageLensGroupRequest.builder()
                    .name(storageLensGroupName)
                    .storageLensGroup(storageLensGroup)
                    .accountId(accountId)
                    .build();

            S3ControlClient s3ControlClient = S3ControlClient.builder()
                    .region(Region.US_WEST_2)
                    .credentialsProvider(ProfileCredentialsProvider.create())
                    .build();
            s3ControlClient.updateStorageLensGroup(updateStorageLensGroupRequest);
        } 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();
        }
    }
}
```

JSON 구성에 대한 예제는 [Storage Lens 그룹 구성](storage-lens-groups.md#storage-lens-groups-configuration) 섹션을 참조하십시오.

# Storage Lens 그룹을 통한 AWS 리소스 태그 관리
<a name="storage-lens-groups-manage-tags"></a>

각 Amazon S3 Storage Lens 그룹은 고유한 Amazon 리소스 이름(ARN)을 갖고 있는 AWS 리소스로 계산됩니다. 따라서 Storage Lens 그룹을 구성할 때 선택적으로 그룹에 AWS 리소스 태그를 추가할 수 있습니다. 각 Storage Lens 그룹에 최대 50개의 태그를 추가할 수 있습니다. 태그가 있는 Storage Lens 그룹을 만들려면 `s3:CreateStorageLensGroup` 및 `s3:TagResource` 권한이 있어야 합니다.

AWS 리소스 태그를 사용하여 부서, 사업부 또는 프로젝트에 따라 리소스를 분류할 수 있습니다. 이는 동일한 유형의 리소스가 많을 때 유용합니다. 태그를 적용하면 지정한 태그를 기반으로 특정 Storage Lens 그룹을 빠르게 식별할 수 있습니다. 또한 태그를 사용하여 비용을 추적 및 할당할 수 있습니다.

또한 Storage Lens 그룹에 AWS 리소스 태그를 추가하면 [속성 기반 액세스 제어(ABAC)](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction_attribute-based-access-control.html)가 활성화됩니다. ABAC는 속성(이 경우 태그)을 기반으로 권한을 정의하는 권한 부여 전략입니다. 또한 IAM 정책의 리소스 태그를 지정하는 조건을 사용하여 해당 리소스의 태그를 기반으로 [AWS 리소스에 대한 액세스를 제어](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html#access_tags_control-resources)할 수 있습니다.

태그 키와 값을 편집할 수 있으며 언제든지 리소스에서 태그를 제거할 수 있습니다. 또한 다음 제한 사항을 고려해야 합니다.
+ 태그 키와 태그 값은 대/소문자를 구분합니다.
+ 해당 리소스에 대해 키가 기존 태그와 동일한 태그를 추가하는 경우 새 값이 이전 값을 덮어씁니다.
+ 리소스를 삭제하면 리소스 태그도 삭제됩니다.
+ AWS 리소스 태그에 비공개 또는 민감한 데이터를 포함하지 마십시오.
+ 시스템 태그(`aws:`로 시작하는 태그 키 포함)는 지원되지 않습니다.
+ 각 태그 키의 길이는 128자를 초과할 수 없습니다. 각 태그 값의 길이는 256자를 초과할 수 없습니다.

다음 예제에서는 Storage Lens 그룹에서 AWS 리소스 태그를 사용하는 방법을 보여줍니다.

**Topics**
+ [Storage Lens 그룹에 AWS 리소스 태그 추가](storage-lens-groups-add-tags.md)
+ [Storage Lens 그룹 태그 값 업데이트](storage-lens-groups-update-tags.md)
+ [Storage Lens 그룹에서 AWS 리소스 태그 삭제](storage-lens-groups-delete-tags.md)
+ [Storage Lens 그룹 태그 목록](storage-lens-groups-list-tags.md)

# Storage Lens 그룹에 AWS 리소스 태그 추가
<a name="storage-lens-groups-add-tags"></a>

다음 예제에서는 Amazon S3 Storage Lens 그룹에 AWS 리소스 태그를 추가하는 방법을 보여줍니다. Amazon S3 콘솔, AWS Command Line Interface(AWS CLI) 및 AWS SDK for Java을 사용하여 리소스 태그를 추가할 수 있습니다.

## S3 콘솔 사용
<a name="storage-lens-groups-add-tags-console"></a>

**Storage Lens 그룹에 AWS 리소스 태그를 추가하려면**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)에서 S3 콘솔을 엽니다.

1. 왼쪽 탐색 창에서 **스토리지 렌즈 그룹**을 선택합니다.

1. **Storage Lens 그룹**에서 업데이트하려는 Storage Lens 그룹을 선택합니다.

1. **AWS 리소스 태그** 아래에서 **태그 추가**를 선택합니다.

1. **태그 추가** 페이지에서 새 키-값 쌍을 추가합니다.
**참고**  
기존 태그와 동일한 키가 있는 새 태그를 추가하면 이전 태그 값을 덮어씁니다.

1. (선택 사항) 새 태그를 두 개 이상 추가하려면 **태그 추가**를 다시 선택하여 새 항목을 계속 추가합니다. Storage Lens 그룹에 최대 50개의 AWS 리소스 태그를 추가할 수 있습니다.

1. (선택 사항) 새로 추가된 항목을 제거하려면 제거하려는 태그 옆의 **제거**를 선택합니다.

1. **변경 사항 저장**을 선택합니다.

## AWS CLI 사용
<a name="storage-lens-groups-add-tags-cli"></a>

다음 예제 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=v1 Key=k2,Value=v2
```

## Java용 AWS SDK 사용
<a name="storage-lens-groups-add-tags-sdk-java"></a>

다음 AWS SDK for Java 예제에서는 기존 Storage Lens 그룹에 두 개의 AWS 리소스 태그를 추가합니다. 이 예제를 사용하려면 `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 TagResource {
    public static void main(String[] args) {
        String resourceARN = "Resource_ARN";
        String accountId = "111122223333";

        try {
            Tag resourceTag1 = Tag.builder()
                .key("resource-tag-key-1")
                .value("resource-tag-value-1")
                .build();
            Tag resourceTag2 = Tag.builder()
                    .key("resource-tag-key-2")
                    .value("resource-tag-value-2")
                    .build();
            TagResourceRequest tagResourceRequest = TagResourceRequest.builder()
                    .resourceArn(resourceARN)
                    .tags(resourceTag1, resourceTag2)
                    .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 그룹 태그 값 업데이트
<a name="storage-lens-groups-update-tags"></a>

다음 예제는 Amazon S3 콘솔, AWS Command Line Interface(AWS CLI) 및 AWS SDK for Java을 사용하여 Storage Lens 그룹 태그 값을 업데이트하는 방법을 보여줍니다.

## S3 콘솔 사용
<a name="storage-lens-groups-update-tags-console"></a>

**Storage Lens 그룹의 AWS 리소스 태그를 업데이트하려면**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)에서 S3 콘솔을 엽니다.

1. 왼쪽 탐색 창에서 **스토리지 렌즈 그룹**을 선택합니다.

1. **Storage Lens 그룹**에서 업데이트하려는 Storage Lens 그룹을 선택합니다.

1. **AWS 리소스** 태그에서 업데이트하려는 태그를 선택합니다.

1. 업데이트하려는 키-값 페어와 동일한 키를 사용하여 새 태그 값을 추가합니다. 확인 표시 아이콘을 선택하여 태그 값을 업데이트합니다.
**참고**  
기존 태그와 동일한 키가 있는 새 태그를 추가하면 이전 태그 값을 덮어씁니다.

1. (선택 사항) 새 태그를 추가하려면 **태그 추가**를 선택하여 새 항목을 추가합니다. **태그 추가** 페이지가 나타납니다.

   Storage Lens 그룹에 최대 50개의 AWS 리소스 태그를 추가할 수 있습니다. 새 태그 추가가 완료되면 **변경 사항 저장**을 선택합니다.

1. (선택 사항) 새로 추가된 항목을 제거하려면 제거하려는 태그 옆의 **제거**를 선택합니다. 태그 제거를 마쳤으면 **변경 사항 저장**을 선택합니다.

## AWS CLI 사용
<a name="storage-lens-groups-update-tags-cli"></a>

다음 예제 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
```

## Java용 AWS SDK 사용
<a name="storage-lens-groups-update-tags-sdk-java"></a>

다음 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 그룹에서 AWS 리소스 태그 삭제
<a name="storage-lens-groups-delete-tags"></a>

다음 예제에서는 Storage Lens 그룹에서 AWS 리소스 태그를 삭제하는 방법을 보여줍니다. Amazon S3 콘솔, AWS Command Line Interface(AWS CLI) 및 AWS SDK for Java를 사용하여 태그를 삭제할 수 있습니다.

## S3 콘솔 사용
<a name="storage-lens-groups-delete-tags-console"></a>

**Storage Lens 그룹에서 AWS 리소스 태그를 삭제하려면**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)에서 S3 콘솔을 엽니다.

1. 왼쪽 탐색 창에서 **스토리지 렌즈 그룹**을 선택합니다.

1. **Storage Lens 그룹**에서 업데이트하려는 Storage Lens 그룹을 선택합니다.

1. **AWS 리소스 태그** 아래에서 삭제하려는 키-값 페어를 선택합니다.

1. **삭제**를 선택합니다. **AWS 리소스 태그 삭제** 대화 상자가 나타납니다.
**참고**  
태그를 사용하여 액세스를 제어하는 경우 이 작업을 진행하면 관련 리소스에 영향이 미칠 수 있습니다. 영구 삭제한 태그는 복원할 수 없습니다.

1. **삭제**를 선택하여 키-값 페어를 영구적으로 삭제합니다.

## AWS CLI 사용
<a name="storage-lens-groups-delete-tags-cli"></a>

다음 AWS CLI 명령은 기존 Storage Lens 그룹에서 두 개의 AWS 리소스 태그를 삭제합니다. 이 예제 명령을 사용하려면 자체 정보로 `user input placeholders`를 바꿉니다.

```
aws s3control untag-resource --account-id 111122223333 \
--resource-arn arn:aws:s3:us-east-1:111122223333:storage-lens-group/Marketing-Department \
--region us-east-1 --tag-keys k1 k2
```

## Java용 AWS SDK 사용
<a name="storage-lens-groups-delete-tags-sdk-java"></a>

다음 AWS SDK for Java 예제에서는 Storage Lens 그룹 Amazon 리소스 이름(ARN)에서 계정 `111122223333`에서 지정한 AWS 리소스 태그 두 개를 삭제합니다. 이 예제를 사용하려면 `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.UntagResourceRequest;

public class UntagResource {
    public static void main(String[] args) {
        String resourceARN = "Resource_ARN";
        String accountId = "111122223333";

        try {
            String tagKey1 = "resource-tag-key-1";
            String tagKey2 = "resource-tag-key-2";
            UntagResourceRequest untagResourceRequest = UntagResourceRequest.builder()
                    .resourceArn(resourceARN)
                    .tagKeys(tagKey1, tagKey2)
                    .accountId(accountId)
                    .build();
            S3ControlClient s3ControlClient = S3ControlClient.builder()
                    .region(Region.US_WEST_2)
                    .credentialsProvider(ProfileCredentialsProvider.create())
                    .build();
            s3ControlClient.untagResource(untagResourceRequest);
        } 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 그룹 태그 목록
<a name="storage-lens-groups-list-tags"></a>

다음 예는 Storage Lens 그룹과 관련된 AWS 리소스 태그를 나열하는 방법을 보여줍니다. Amazon S3 콘솔, AWS Command Line Interface(AWS CLI) 및 AWS SDK for Java을 사용하여 태그를 나열할 수 있습니다.

## S3 콘솔 사용
<a name="storage-lens-groups-list-tags-console"></a>

**Storage Lens 그룹의 태그 및 태그 값 목록을 검토하려면**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)에서 S3 콘솔을 엽니다.

1. 왼쪽 탐색 창에서 **스토리지 렌즈 그룹**을 선택합니다.

1. **Storage Lens 그룹**에서 관심 있는 Storage Lens 그룹을 선택합니다.

1. 아래로 스크롤하여 **AWS 리소스 태그** 섹션으로 이동합니다. Storage Lens 그룹에 추가된 모든 사용자 정의 AWS 리소스 태그가 해당 태그 값과 함께 나열됩니다.

## AWS CLI 사용
<a name="storage-lens-group-list-tags-cli"></a>

다음 AWS CLI 예제 명령은 `marketing-department`라는 이름의 Storage Lens 그룹의 모든 Storage Lens 그룹 태그 값을 나열합니다. 이 예시 명령을 사용하려면 `user input placeholders`를 실제 정보로 대체하세요.

```
aws s3control list-tags-for-resource --account-id 111122223333 \
--resource-arn arn:aws:s3:us-east-1:111122223333:storage-lens-group/marketing-department \
--region us-east-1
```

## Java용 AWS SDK 사용
<a name="storage-lens-group-list-tags-sdk-java"></a>

다음 AWS SDK for Java 예제는 지정한 Storage Lens 그룹 Amazon 리소스 이름(ARN)의 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.ListTagsForResourceRequest;
import software.amazon.awssdk.services.s3control.model.ListTagsForResourceResponse;

public class ListTagsForResource {
    public static void main(String[] args) {
        String resourceARN = "Resource_ARN";
        String accountId = "111122223333";

        try {
            ListTagsForResourceRequest listTagsForResourceRequest = ListTagsForResourceRequest.builder()
                    .resourceArn(resourceARN)
                    .accountId(accountId)
                    .build();
            S3ControlClient s3ControlClient = S3ControlClient.builder()
                    .region(Region.US_WEST_2)
                    .credentialsProvider(ProfileCredentialsProvider.create())
                    .build();
            ListTagsForResourceResponse response = s3ControlClient.listTagsForResource(listTagsForResourceRequest);
            System.out.println(response);
        } 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 그룹 목록
<a name="storage-lens-groups-list"></a>

다음 예제에서는 AWS 계정 및 홈 리전 내의 모든 Amazon S3 Storage Lens 그룹을 나열하는 방법을 보여줍니다. 이 예제는 Amazon S3 콘솔, AWS Command Line Interface(AWS CLI) 및 AWS SDK for Java를 사용하여 모든 Storage Lens 그룹을 나열하는 방법을 보여줍니다.

## S3 콘솔 사용
<a name="storage-lens-group-list-console"></a>

**계정 및 홈 리전의 모든 Storage Lens 그룹을 나열하려면**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)에서 S3 콘솔을 엽니다.

1. 왼쪽 탐색 창에서 **스토리지 렌즈 그룹**을 선택합니다.

1. **Storage Lens 그룹** 아래에 계정의 Storage Lens 그룹 목록이 표시됩니다.

## AWS CLI 사용
<a name="storage-lens-groups-list-cli"></a>

다음 AWS CLI 예제는 계정의 모든 Storage Lens 그룹을 나열합니다. 이 예시 명령을 사용하려면 `user input placeholders`를 실제 정보로 대체하십시오.

```
aws s3control list-storage-lens-groups --account-id 111122223333 \
--region us-east-1
```

## Java용 AWS SDK 사용
<a name="storage-lens-groups-list-sdk-java"></a>

다음 AWS SDK for Java 예제는 계정 `111122223333`의 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.ListStorageLensGroupsRequest;
import software.amazon.awssdk.services.s3control.model.ListStorageLensGroupsResponse;

public class ListStorageLensGroups {
    public static void main(String[] args) {
        String accountId = "111122223333";

        try {
            ListStorageLensGroupsRequest listStorageLensGroupsRequest = ListStorageLensGroupsRequest.builder()
                    .accountId(accountId)
                    .build();
            S3ControlClient s3ControlClient = S3ControlClient.builder()
                    .region(Region.US_WEST_2)
                    .credentialsProvider(ProfileCredentialsProvider.create())
                    .build();
            ListStorageLensGroupsResponse response = s3ControlClient.listStorageLensGroups(listStorageLensGroupsRequest);
            System.out.println(response);
        } 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 그룹 세부 정보 보기
<a name="storage-lens-groups-view"></a>

다음 예제는 Amazon S3 Storage Lens 그룹 구성 세부 정보를 보는 방법을 보여줍니다. Amazon S3 콘솔, AWS Command Line Interface(AWS CLI) 및 AWS SDK for Java를 사용하여 이러한 세부 정보를 볼 수 있습니다.

## S3 콘솔 사용
<a name="view-storage-lens-group-console"></a>



**Storage Lens 그룹 구성 세부 정보를 보려면**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)에서 S3 콘솔을 엽니다.

1. 왼쪽 탐색 창에서 **스토리지 렌즈 그룹**을 선택합니다.

1. **스토리지 렌즈 그룹**에서 관심 있는 스토리지 렌즈 그룹 옆의 옵션 버튼을 선택합니다.

1. **세부 정보 보기**를 선택합니다. 이제 Storage Lens 그룹의 세부 정보를 검토합니다.

## AWS CLI 사용
<a name="view-storage-lens-group-cli"></a>

다음 AWS CLI 예제는 Storage Lens 그룹의 구성 세부 정보를 반환합니다. 이 예시 명령을 사용하려면 `user input placeholders`를 실제 정보로 대체하십시오.

```
aws s3control get-storage-lens-group --account-id 111122223333 \ 
--region us-east-1 --name marketing-department
```

## Java용 AWS SDK 사용
<a name="view-storage-lens-group-sdk-java"></a>

다음 AWS SDK for Java 예제에서는 계정 `111122223333`에 `Marketing-Department`라는 이름의 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.GetStorageLensGroupRequest;
import software.amazon.awssdk.services.s3control.model.GetStorageLensGroupResponse;

public class GetStorageLensGroup {
    public static void main(String[] args) {
        String storageLensGroupName = "Marketing-Department";
        String accountId = "111122223333";

        try {
            GetStorageLensGroupRequest getRequest = GetStorageLensGroupRequest.builder()
                    .name(storageLensGroupName)
                    .accountId(accountId).build();
            S3ControlClient s3ControlClient = S3ControlClient.builder()
                    .region(Region.US_WEST_2)
                    .credentialsProvider(ProfileCredentialsProvider.create())
                    .build();
            GetStorageLensGroupResponse response = s3ControlClient.getStorageLensGroup(getRequest);
            System.out.println(response);
        } 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 그룹 삭제
<a name="storage-lens-groups-delete"></a>

다음 예제는 Amazon S3 콘솔, AWS Command Line Interface(AWS CLI) 및 AWS SDK for Java을 사용하여 Amazon S3 Storage Lens 그룹을 삭제하는 방법을 보여줍니다.

## S3 콘솔 사용
<a name="delete-storage-lens-group-console"></a>

**Storage Lens 그룹을 삭제하려면**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)에서 S3 콘솔을 엽니다.

1. 왼쪽 탐색 창에서 **스토리지 렌즈 그룹**을 선택합니다.

1. **Storage Lens 그룹**에서 삭제할 Storage Lens 그룹 옆에 있는 옵션 버튼을 선택합니다.

1. **삭제**를 선택합니다. **Storage Lens 그룹 삭제** 대화 상자가 표시됩니다.

1. Storage Lens 그룹을 영구 삭제하려면 **삭제**를 다시 선택합니다.
**참고**  
Storage Lens 그룹을 삭제한 후에는 복원할 수 없습니다.

## AWS CLI 사용
<a name="delete-storage-lens-group-cli"></a>

다음 AWS CLI 예제에서는 `marketing-department` 라는 이름의 Storage Lens 그룹을 삭제합니다. 이 예 명령을 사용하려면 `user input placeholders`를 실제 정보로 대체하세요.

```
aws s3control delete-storage-lens-group --account-id 111122223333 \ 
--region us-east-1 --name marketing-department
```

## Java용 AWS SDK 사용
<a name="delete-storage-lens-group-sdk-java"></a>

다음 AWS SDK for Java 예제에서는 계정 `111122223333`에 `Marketing-Department`라는 이름의 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.DeleteStorageLensGroupRequest;

public class DeleteStorageLensGroup {
    public static void main(String[] args) {
        String storageLensGroupName = "Marketing-Department";
        String accountId = "111122223333";

        try {
            DeleteStorageLensGroupRequest deleteStorageLensGroupRequest = DeleteStorageLensGroupRequest.builder()
                    .name(storageLensGroupName)
                    .accountId(accountId).build();
            S3ControlClient s3ControlClient = S3ControlClient.builder()
                    .region(Region.US_WEST_2)
                    .credentialsProvider(ProfileCredentialsProvider.create())
                    .build();
            s3ControlClient.deleteStorageLensGroup(deleteStorageLensGroupRequest);
        } 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();
        }
    }
}
```