

# 대시보드에 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();
        }
    }
}
```