

# AWS CLI를 사용한 Resource Explorer 예시
<a name="cli_resource-explorer-2_code_examples"></a>

다음 코드 예시에서는 에서 Resource Explorer에서 AWS Command Line Interface를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.

*작업*은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 개별 서비스 함수를 직접적으로 호출하는 방법을 보여주며 관련 시나리오의 컨텍스트에 맞는 작업을 볼 수 있습니다.

각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.

**Topics**
+ [작업](#actions)

## 작업
<a name="actions"></a>

### `associate-default-view`
<a name="resource-explorer-2_AssociateDefaultView_cli_topic"></a>

다음 코드 예시에서는 `associate-default-view` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**Resource Explorer 뷰를 해당 AWS 리전의 기본값으로 설정하는 방법**  
다음 `associate-default-view` 예시에서는 ARN으로 지정된 보기를 작업을 호출하는 AWS 리전의 기본 보기로 설정합니다.  

```
aws resource-explorer-2 associate-default-view \
    --view-arn arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-Main-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111
```
출력:  

```
{
    "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-Main-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111"
}
```
자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [Setting a default view in an AWS Region](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-set-default.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [AssociateDefaultView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/associate-default-view.html) 섹션을 참조하세요.

### `batch-get-view`
<a name="resource-explorer-2_BatchGetView_cli_topic"></a>

다음 코드 예시에서는 `batch-get-view` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**여러 Resource Explorer 뷰에 대한 세부 정보를 검색하는 방법**  
다음 `batch-get-view` 예시에서는 ARN으로 지정된 두 뷰에 대한 세부 정보를 표시합니다. view-arn 파라미터에서 공백을 사용하여 여러 ARN을 구분합니다.  

```
aws resource-explorer-2 batch-get-view \
    --view-arns arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-EC2-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222, \
                arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-Main-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111
```
출력:  

```
{
    "Views": [
        {
            "Filters": {
                "FilterString": "service:ec2"
            },
            "IncludedProperties": [
                {
                    "Name": "tags"
                }
            ],
            "LastUpdatedAt": "2022-07-13T21:33:45.249000+00:00",
            "Owner": "123456789012",
            "Scope": "arn:aws:iam::123456789012:root",
            "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-EC2-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222"
        },
        {
            "Filters": {
                "FilterString": ""
            },
            "IncludedProperties": [
                {
                    "Name": "tags"
                }
            ],
            "LastUpdatedAt": "2022-07-13T20:34:11.314000+00:00",
            "Owner": "123456789012",
            "Scope": "arn:aws:iam::123456789012:root",
            "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-Main-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111"
        }
    ]
    "Errors": []
}
```
보기에 대한 자세한 내용은 *AWS Resource Explorer 사용 설명서*에서 [Resource Explorer 보기에 대한 정보](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-about.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [BatchGetView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/batch-get-view.html) 섹션을 참조하세요.

### `create-index`
<a name="resource-explorer-2_CreateIndex_cli_topic"></a>

다음 코드 예시에서는 `create-index` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**색인을 생성하여 AWS 리전에서 Resource Explorer 켜기**  
다음 `create-index` 예시에서는 연산이 호출되는 AWS 리전에 로컬 인덱스를 생성합니다. 값을 지정하지 않으면 AWS CLI가 자동으로 임의의 `client-token` 파라미터 값을 생성하여 AWS 호출에 포함합니다.  

```
aws resource-explorer-2 create-index \
    --region us-east-1
```
출력:  

```
{
    "Arn": "arn:aws:resource-explorer-2:us-east-1:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222c",
    "CreatedAt": "2022-11-01T20:00:59.149Z",
    "State": "CREATING"
}
```
로컬 인덱스를 만든 후에는 [update-index-type](https://docs.aws.amazon.com/cli/latest/reference/resource-explorer-2/update-index-type.html) 명령을 실행하여 계정에 대한 집계 인덱스로 변환할 수 있습니다.  
자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [Turning on Resource Explorer in an AWS Region to index your resources](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-service-register.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [CreateIndex](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/create-index.html) 섹션을 참조하세요.

### `create-view`
<a name="resource-explorer-2_CreateView_cli_topic"></a>

다음 코드 예시에서는 `create-view` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**예시 1: AWS 리전의 인덱스에 대해 필터링되지 않은 뷰를 생성하는 방법**  
다음 `create-view` 예시에서는 지정된 AWS 리전에 필터링 없이 리전의 모든 결과를 반환하는 뷰를 만듭니다. 보기에는 반환된 결과에 대한 태그 필드(선택 사항)가 포함되어 있습니다. 이 보기는 집계 인덱스가 포함된 리전에서 만들어지므로 계정의 모든 리전(Resource Explorer 인덱스가 포함된 리전)의 결과를 포함할 수 있습니다.  

```
aws resource-explorer-2 create-view \
    --view-name My-Main-View \
    --included-properties Name=tags \
    --region us-east-1
```
출력:  

```
{
    "View": {
        "Filters": {
            "FilterString": ""
        },
        "IncludedProperties": [
            {
                "Name": "tags"
            }
        ],
        "LastUpdatedAt": "2022-07-13T20:34:11.314000+00:00",
        "Owner": "123456789012",
        "Scope": "arn:aws:iam::123456789012:root",
        "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-Main-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111"
    }
}
```
**예시 2: Amazon EC2와 연결된 리소스만 반환하는 보기를 생성하는 방법**  
다음 `create-view` 명령은 AWS 리전 `us-east-1`에서 리전 내 Amazon EC2 서비스와 연결된 리소스만 반환하는 보기를 만듭니다. 보기에는 반환된 결과에 대한 `Tags` 필드(선택 사항)가 포함되어 있습니다. 이 보기는 집계 인덱스가 포함된 리전에서 만들어지므로 계정의 모든 리전(Resource Explorer 인덱스가 포함된 리전)의 결과를 포함할 수 있습니다.  

```
aws resource-explorer-2 create-view \
    --view-name My-EC2-Only-View \
    --included-properties Name=tags \
    --filters FilterString="service:ec2" \
    --region us-east-1
```
출력:  

```
{
    "View": {
        "Filters": {
            "FilterString": "service:ec2"
        },
        "IncludedProperties": [
            {
                "Name":"tags"
            }
        ],
        "LastUpdatedAt": "2022-07-13T21:35:09.059Z",
        "Owner": "123456789012",
        "Scope": "arn:aws:iam::123456789012:root",
        "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-EC2-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222"
    }
}
```
자세한 내용은 ‭*AWS Resource Explorer 사용 설명서*의 ‭‬‭[Creating views for search](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-create.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [CreateView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/create-view.html) 섹션을 참조하세요.

### `delete-index`
<a name="resource-explorer-2_DeleteIndex_cli_topic"></a>

다음 코드 예시에서는 `delete-index` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**인덱스를 삭제하여 AWS 리전에서 Resource Explorer를 끄려면**  
다음 `delete-index` 예시에서는 요청을 수행하는 AWS 리전에서 지정된 Resource Explorer 인덱스를 삭제합니다.  

```
aws resource-explorer-2 delete-index \
    --arn arn:aws:resource-explorer-2:us-west-2:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222 \
    --region us-west-2
```
출력:  

```
{
    "Arn": "arn:aws:resource-explorer-2:us-west-2:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222",
    "State": "DELETING"
}
```
인덱스 삭제에 대한 자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [AWS 리전에서 AWS Resource Explorer 끄기](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-service-deregister.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DeleteIndex](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/delete-index.html) 섹션을 참조하세요.

### `delete-view`
<a name="resource-explorer-2_DeleteView_cli_topic"></a>

다음 코드 예시에서는 `delete-view` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**Resource Explorer 보기를 삭제하는 방법**  
다음 `delete-view` 예시에서는 ARN에서 지정한 보기를 삭제합니다.  

```
aws resource-explorer-2 delete-view \
    --view-arn arn:aws:resource-explorer-2:us-east-1:123456789012:view/EC2-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111
```
출력:  

```
{
    "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/EC2-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111"
}
```
자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [Deleting views](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-delete.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DeleteView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/delete-view.html) 섹션을 참조하세요.

### `disassociate-default-view`
<a name="resource-explorer-2_DisassociateDefaultView_cli_topic"></a>

다음 코드 예시에서는 `disassociate-default-view` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**AWS 리전에 대한 기본 Resource Explorer 보기를 제거하는 방법**  
다음 `disassociate-default-view` 명령은 작업을 호출하는 AWS 리전에 대한 기본 Resource Explorer 보기를 제거합니다. 이 작업을 수행한 후 리전 내 모든 검색 작업은 뷰를 명시적으로 지정해야 하며, 그렇지 않으면 작업이 실패합니다.  

```
aws resource-explorer-2 disassociate-default-view
```
이 명령은 출력을 생성하지 않습니다.  
자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [Setting a default view in an AWS Region](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-set-default.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DisassociateDefaultView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/disassociate-default-view.html) 섹션을 참조하세요.

### `get-default-view`
<a name="resource-explorer-2_GetDefaultView_cli_topic"></a>

다음 코드 예시에서는 `get-default-view` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**AWS 리전의 기본 뷰인 Resource Explorer 뷰를 검색하는 방법**  
다음 `get-default-view` 예시에서는 작업을 호출하는 AWS 리전의 기본값인 보기의 ARN을 검색합니다.  

```
aws resource-explorer-2 get-default-view
```
출력:  

```
{
    "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/default-view/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111"
}
```
자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [Setting a default view in an AWS Region](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-set-default.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [GetDefaultView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/get-default-view.html) 섹션을 참조하세요.

### `get-index`
<a name="resource-explorer-2_GetIndex_cli_topic"></a>

다음 코드 예시에서는 `get-index` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**예시 1: Resource Explorer 애그리게이터 인덱스의 세부 정보를 검색하는 방법**  
다음 `get-index` 예시에서는 지정된 AWS 리전 내 Resource Explorer 인덱스에 대한 세부 정보를 표시합니다. 지정된 리전에는 계정에 대한 집계 인덱스가 포함되어 있으므로 출력에는 이 리전의 인덱스에 데이터를 복제하는 리전이 나열됩니다.  

```
aws resource-explorer-2 get-index \
    --region us-east-1
```
출력:  

```
{
    "Arn": "arn:aws:resource-explorer-2:us-east-1:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111",
    "CreatedAt": "2022-07-12T18:59:10.503000+00:00",
    "LastUpdatedAt": "2022-07-13T18:41:58.799000+00:00",
    "ReplicatingFrom": [
        "ap-south-1",
        "us-west-2"
    ],
    "State": "ACTIVE",
    "Tags": {},
    "Type": "AGGREGATOR"
}
```
**예시 2: Resource Explorer 로컬 인덱스에 대한 세부 정보를 검색하는 방법**  
다음 `get-index` 예시에서는 지정된 AWS 리전 내 Resource Explorer 인덱스에 대한 세부 정보를 표시합니다. 지정한 리전에는 로컬 인덱스가 포함되어 있으므로 출력에는 이 리전의 인덱스에서 데이터를 복제하는 리전이 나열됩니다.  

```
aws resource-explorer-2 get-index \
    --region us-west-2
```
출력:  

```
{
    "Arn": "arn:aws:resource-explorer-2:us-west-2:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222",
    "CreatedAt": "2022-07-12T18:59:10.503000+00:00",
    "LastUpdatedAt": "2022-07-13T18:41:58.799000+00:00",
    "ReplicatingTo": [
        "us-west-2"
    ],
    "State": "ACTIVE",
    "Tags": {},
    "Type": "LOCAL"
}
```
인덱스에 대한 자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [Resource Explorer가 켜져 있는 AWS 리전 확인](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-service-check.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [GetIndex](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/get-index.html) 섹션을 참조하세요.

### `get-view`
<a name="resource-explorer-2_GetView_cli_topic"></a>

다음 코드 예시에서는 `get-view` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**Resource Explorer 보기에 대한 세부 정보를 검색하는 방법**  
다음 `get-view` 예시에서는 ARN으로 지정된 뷰에 대한 세부 정보를 표시합니다.  

```
aws resource-explorer-2 get-view \
    --view-arn arn:aws:resource-explorer-2:us-east-1:123456789012:view/EC2-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111
```
출력:  

```
{
  "Tags" : {},
  "View" : {
        "Filters" : {
            "FilterString" : "service:ec2"
        },
        "IncludedProperties" : [
            {
                "Name" : "tags"
            }
        ],
        "LastUpdatedAt" : "2022-07-13T21:33:45.249Z",
        "Owner" : "123456789012",
        "Scope" : "arn:aws:iam::123456789012:root",
        "ViewArn" : "arn:aws:resource-explorer-2:us-east-1:123456789012:view/EC2-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111"
  }
}
```
보기에 대한 자세한 내용은 *AWS Resource Explorer 사용 설명서*에서 [Resource Explorer 보기에 대한 정보](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-about.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [GetView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/get-view.html) 섹션을 참조하세요.

### `list-indexes`
<a name="resource-explorer-2_ListIndexes_cli_topic"></a>

다음 코드 예시에서는 `list-indexes` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**Resource Explorer에 인덱스가 있는 AWS 리전을 나열하는 방법**  
다음 `list-indexes` 예시에서는 Resource Explorer에 인덱스가 있는 모든 리전의 인덱스를 나열합니다. 응답은 각 인덱스의 유형, AWS 리전 및 해당 리전의 ARN을 지정합니다.  

```
aws resource-explorer-2 list-indexes
```
출력:  

```
{
    "Indexes": [
        {
            "Arn": "arn:aws:resource-explorer-2:us-west-2:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111",
            "Region": "us-west-2",
            "Type": "AGGREGATOR"
        },
        {
            "Arn": "arn:aws:resource-explorer-2:us-east-1:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222",
            "Region": "us-east-1",
            "Type": "LOCAL"
        },
        {
            "Arn": "arn:aws:resource-explorer-2:us-east-2:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE33333",
            "Region": "us-east-2",
            "Type": "LOCAL"
        },
        {
            "Arn": "arn:aws:resource-explorer-2:us-west-1:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE44444",
            "Region": "us-west-1",
            "Type": "LOCAL"
        }
    ]
}
```
인덱스에 대한 자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [Resource Explorer가 켜져 있는 AWS 리전 확인](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-service-check.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListIndexes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/list-indexes.html) 섹션을 참조하세요.

### `list-supported-resource-types`
<a name="resource-explorer-2_ListSupportedResourceTypes_cli_topic"></a>

다음 코드 예시에서는 `list-supported-resource-types` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**Resource Explorer에 인덱스가 있는 AWS 리전을 나열하는 방법**  
다음 `list-supported-resource-types` 예시에서는 &AREXlong; RAM에서 지원하는 모든 리소스 유형을 나열합니다. 예시 응답에는 추가 호출을 통해 검색할 수 있는 출력이 더 있음을 나타내는 `NextToken` 값이 포함되어 있습니다.  

```
aws resource-explorer-2 list-supported-resource-types \
    --max-items 10
```
출력:  

```
{
    "ResourceTypes": [
        {
            "ResourceType": "cloudfront:cache-policy",
            "Service": "cloudfront"
        },
        {
            "ResourceType": "cloudfront:distribution",
            "Service": "cloudfront"
        },
        {
            "ResourceType": "cloudfront:function",
            "Service": "cloudfront"
        },
        {
            "ResourceType": "cloudfront:origin-access-identity",
            "Service": "cloudfront"
        },
        {
            "ResourceType": "cloudfront:origin-request-policy",
            "Service": "cloudfront"
        },
        {
            "ResourceType": "cloudfront:realtime-log-config",
            "Service": "cloudfront"
        },
        {
            "ResourceType": "cloudfront:response-headers-policy",
            "Service": "cloudfront"
        },
        {
            "ResourceType": "cloudwatch:alarm",
            "Service": "cloudwatch"
        },
        {
            "ResourceType": "cloudwatch:dashboard",
            "Service": "cloudwatch"
        },
        {
            "ResourceType": "cloudwatch:insight-rule",
            "Service": "cloudwatch"
        }
    ],
    "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAxMH0="
}
```
출력의 다음 부분을 가져오려면 작업을 다시 호출하고 이전 호출의 `NextToken` 응답 값을 `--starting-token`의 값으로 전달합니다. `NextToken`이 응답이 없을 때까지 반복합니다.  

```
aws resource-explorer-2 list-supported-resource-types \
    --max-items 10  \
    --starting-token eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAxMH0=
```
출력:  

```
{
    "ResourceTypes": [
        {
            "ResourceType": "cloudwatch:metric-stream",
            "Service": "cloudwatch"
        },
        {
            "ResourceType": "dynamodb:table",
            "Service": "dynamodb"
        },
        {
            "ResourceType": "ec2:capacity-reservation",
            "Service": "ec2"
        },
        {
            "ResourceType": "ec2:capacity-reservation-fleet",
            "Service": "ec2"
        },
        {
            "ResourceType": "ec2:client-vpn-endpoint",
            "Service": "ec2"
        },
        {
            "ResourceType": "ec2:customer-gateway",
            "Service": "ec2"
        },
        {
            "ResourceType": "ec2:dedicated-host",
            "Service": "ec2"
        },
        {
            "ResourceType": "ec2:dhcp-options",
            "Service": "ec2"
        },
        {
            "ResourceType": "ec2:egress-only-internet-gateway",
            "Service": "ec2"
        },
        {
            "ResourceType": "ec2:elastic-gpu",
            "Service": "ec2"
        }
    ],
    "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAyMH0="
}
```
인덱스에 대한 자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [Resource Explorer가 켜져 있는 AWS 리전 확인](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-service-check.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListSupportedResourceTypes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/list-supported-resource-types.html) 섹션을 참조하세요.

### `list-tags-for-resource`
<a name="resource-explorer-2_ListTagsForResource_cli_topic"></a>

다음 코드 예시에서는 `list-tags-for-resource` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**Resource Explorer 뷰 또는 인덱스에 연결된 태그를 나열하는 방법**  
다음 `list-tags-for-resource` 예시에서는 지정된 ARN으로 보기에 연결된 태그 키 및 값 페어를 나열합니다. 리소스가 포함된 AWS 리전에서 작업을 호출해야 합니다.  

```
aws resource-explorer-2 list-tags-for-resource \
    --resource-arn arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111
```
출력:  

```
{
    "Tags": {
        "application": "MainCorpApp",
        "department": "1234"
    }
}
```
보기에 태그를 지정하는 방법에 대한 자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [액세스 제어를 위해 보기에 태그 지정](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-tag.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/list-tags-for-resource.html)를 참조하세요.

### `list-views`
<a name="resource-explorer-2_ListViews_cli_topic"></a>

다음 코드 예시에서는 `list-views` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**AWS 리전에서 사용할 수 있는 Resource Explorer 뷰를 나열하는 방법**  
다음 `list-views` 예시에서는 작업을 호출하는 리전에서 사용 가능한 모든 보기가 나열합니다.  

```
aws resource-explorer-2 list-views
```
출력:  

```
{
    "Views": [
        "arn:aws:resource-explorer-2:us-east-1:123456789012:view/EC2-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111",
        "arn:aws:resource-explorer-2:us-east-1:123456789012:view/Default-All-Resources-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222",
        "arn:aws:resource-explorer-2:us-east-1:123456789012:view/Production-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE33333"
    ]
}
```
보기에 대한 자세한 내용은 *AWS Resource Explorer 사용 설명서*에서 [Resource Explorer 보기에 대한 정보](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-about.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListViews](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/list-views.html) 섹션을 참조하세요.

### `search`
<a name="resource-explorer-2_Search_cli_topic"></a>

다음 코드 예시에서는 `search` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**예시 1: 기본 보기를 사용하여 검색하는 방법**  
다음 `search` 예시에서는 지정된 리소스 중 서비스와 관련된 모든 리소스를 표시합니다. 검색은 리전에 대한 기본 보기를 사용합니다. 예시 응답에는 추가 호출을 통해 검색할 수 있는 출력이 더 있음을 나타내는 `NextToken` 값이 포함되어 있습니다.  

```
aws resource-explorer-2 search \
    --query-string "service:iam"
```
출력:  

```
{
    "Count": {
        "Complete": true,
        "TotalResources": 55
    },
    "NextToken": "AG9VOEF1KLEXAMPLEOhJHVwo5chEXAMPLER5XiEpNrgsEXAMPLE...b0CmOFOryHEXAMPLE",
    "Resources": [{
        "Arn": "arn:aws:iam::123456789012:policy/service-role/Some-Policy-For-A-Service-Role",
        "LastReportedAt": "2022-07-21T12:34:42Z",
        "OwningAccountId": "123456789012",
        "Properties": [],
        "Region": "global",
        "ResourceType": "iam:policy",
        "Service": "iam"
    }, {
        "Arn": "arn:aws:iam::123456789012:policy/service-role/Another-Policy-For-A-Service-Role",
        "LastReportedAt": "2022-07-21T12:34:42Z",
        "OwningAccountId": "123456789012",
        "Properties": [],
        "Region": "global",
        "ResourceType": "iam:policy",
        "Service": "iam"
    }, {
       ... TRUNCATED FOR BREVITY ...
    }],
    "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/my-default-view/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111"
}
```
**예시 2: 지정된 보기를 사용하여 검색하는 방법**  
다음 `search` 예시 검색은 지정된 AWS 리전에서 지정된 보기를 통해 볼 수 있는 모든 리소스('\$1')를 표시합니다. 보기에 연결된 필터로 인해 결과에는 Amazon EC2와 관련된 리소스만 포함됩니다.  

```
aws resource-explorer-2 search \
    -- query-string "*" \
    -- view-arn arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-EC2-view/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222
```
출력:  

```
HTTP/1.1 200 OK
Date: Tue, 01 Nov 2022 20:00:59 GMT
Content-Type: application/json
Content-Length: <PayloadSizeBytes>

    {
        "Count": {
            "Complete": true,
            "TotalResources": 67
        },
        "Resources": [{
            "Arn": "arn:aws:ec2:us-east-1:123456789012:network-acl/acl-1a2b3c4d",
            "LastReportedAt": "2022-07-21T18:52:02Z",
            "OwningAccountId": "123456789012",
            "Properties": [{
                "Data": [{
                    "Key": "Department",
                    "Value": "AppDevelopment"
                }, {
                    "Key": "Environment",
                    "Value": "Production"
                }],
                "LastReportedAt": "2021-11-15T14:48:29Z",
                "Name": "tags"
            }],
            "Region": "us-east-1",
            "ResourceType": "ec2:network-acl",
            "Service": "ec2"
        }, {
            "Arn": "arn:aws:ec2:us-east-1:123456789012:subnet/subnet-1a2b3c4d",
            "LastReportedAt": "2022-07-21T21:22:23Z",
            "OwningAccountId": "123456789012",
            "Properties": [{
                "Data": [{
                    "Key": "Department",
                    "Value": "AppDevelopment"
                }, {
                    "Key": "Environment",
                    "Value": "Production"
                }],
                "LastReportedAt": "2021-07-29T19:02:39Z",
                "Name": "tags"
            }],
            "Region": "us-east-1",
            "ResourceType": "ec2:subnet",
            "Service": "ec2"
        }, {
            "Arn": "arn:aws:ec2:us-east-1:123456789012:dhcp-options/dopt-1a2b3c4d",
            "LastReportedAt": "2022-07-21T06:08:53Z",
            "OwningAccountId": "123456789012",
            "Properties": [{
                "Data": [{
                    "Key": "Department",
                    "Value": "AppDevelopment"
                }, {
                    "Key": "Environment",
                    "Value": "Production"
                }],
                "LastReportedAt": "2021-11-15T15:11:05Z",
                "Name": "tags"
            }],
            "Region": "us-east-1",
            "ResourceType": "ec2:dhcpoptions",
            "Service": "ec2"
        }, {
            ... TRUNCATED FOR BREVITY ...
        }],
        "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-EC2-view/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222"
    }
```
자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [Using AWS Resource Explorer to search for resources](https://docs.aws.amazon.com/resource-explorer/latest/userguide/using-search.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [Search](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/search.html) 섹션을 참조하세요.

### `tag-resource`
<a name="resource-explorer-2_TagResource_cli_topic"></a>

다음 코드 예시에서는 `tag-resource` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**Resource Explorer 뷰에 태그를 지정하는 방법**  
다음 `tag-resource` 예시에서는 지정된 ARN이 있는 보기에 'production' 값과 함께 태그 키 'environment'를 추가합니다.  

```
aws resource-explorer-2 tag-resource \
    --resource-arn arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-View//EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111 \
    --tags environment=production
```
이 명령은 출력을 생성하지 않습니다.  
자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [Tagging views for access control](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-tag.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/tag-resource.html)를 참조하세요.

### `untag-resource`
<a name="resource-explorer-2_UntagResource_cli_topic"></a>

다음 코드 예시에서는 `untag-resource` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**Resource Explorer 보기에서 태그를 제거하는 방법**  
다음 `untag-resource` 예시에서는 지정된 ARN이 있는 보기에서 키 이름이 'environment'인 태그를 모두 제거합니다.  

```
aws resource-explorer-2 untag-resource \
    --resource-arn arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-View//EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111 \
    --tag-keys environment
```
이 명령은 출력을 생성하지 않습니다.  
자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [Tagging views for access control](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-tag.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/untag-resource.html)를 참조하세요.

### `update-index-type`
<a name="resource-explorer-2_UpdateIndexType_cli_topic"></a>

다음 코드 예시에서는 `update-index-type` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**Resource Explorer 인덱스의 유형을 변경하는 방법**  
다음 `update-index-type` 예시에서는 지정된 인덱스를 `local` 유형에서 `aggregator` 유형으로 변환하여 계정의 모든 AWS 리전에서 리소스를 검색할 수 있는 기능을 켭니다. 업데이트하려는 인덱스가 포함된 AWS 리전으로 요청을 보내야 합니다.  

```
aws resource-explorer-2 update-index-type \
    --arn arn:aws:resource-explorer-2:us-east-1:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111 \
    --type aggregator \
    --region us-east-1
```
출력:  

```
{
    "Arn":"arn:aws:resource-explorer-2:us-east-1:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111",
    "LastUpdatedAt":"2022-07-13T18:41:58.799Z",
    "State":"updating",
    "Type":"aggregator"
}
```
인덱스 유형 변경에 대한 자세한 내용은 *AWS Resource Explorer 사용 설명서*의 [애그리게이터 인덱스를 만들어 리전 간 검색 켜기](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-aggregator-region.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [UpdateIndexType](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/update-index-type.html) 섹션을 참조하세요.

### `update-view`
<a name="resource-explorer-2_UpdateView_cli_topic"></a>

다음 코드 예시에서는 `update-view` 코드를 사용하는 방법을 보여줍니다.

**AWS CLI**  
**예시 1: Resource Explorer 보기에 포함된 IncludedProperties 필드를 업데이트하는 방법**  
다음 `update-view` 예시에서는 ``IncludedProperties`` 옵션에 ``tags``를 추가하여 지정된 보기를 업데이트합니다. 이 작업을 실행한 후 이 보기를 사용하는 검색 작업에는 결과에 표시되는 리소스에 연결된 태그에 대한 정보가 포함됩니다.  

```
aws resource-explorer-2 update-view \
    --included-properties Name=tags \
    --view-arn arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222
```
출력:  

```
{
    "View": {
        "Filters": {
            "FilterString": ""
        },
        "IncludedProperties": [
            {
                "Name": "tags"
            }
        ],
        "LastUpdatedAt": "2022-07-19T17:41:21.710000+00:00",
        "Owner": "123456789012",
        "Scope": "arn:aws:iam::123456789012:root",
        "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-EC2-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111"
    }
}
```
**예시 2: 뷰에 연결된 필터를 업데이트하는 방법**  
다음 `update-view` 예시에서는 Amazon EC2 서비스와 연결된 리소스 유형으로만 결과를 제한하는 필터를 사용하도록 지정된 보기를 업데이트합니다.  

```
aws resource-explorer-2 update-view \
    --filters FilterString="service:ec2" \
    --view-arn arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222
```
출력:  

```
{
    "View": {
    "Filters": {
        "FilterString": "service:ec2"
    },
    "IncludedProperties": [],
    "LastUpdatedAt": "2022-07-19T17:41:21.710000+00:00",
        "Owner": "123456789012",
        "Scope": "arn:aws:iam::123456789012:root",
        "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222"
    }
}
```
보기에 대한 자세한 내용은 *AWS Resource Explorer 사용 설명서*에서 [Resource Explorer 보기에 대한 정보](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-about.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [UpdateView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/update-view.html) 섹션을 참조하세요.