

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Contoh Resource Explorer menggunakan AWS CLI
<a name="cli_resource-explorer-2_code_examples"></a>

Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan AWS Command Line Interface with Resource Explorer.

*Tindakan* merupakan kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.

Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.

**Topics**
+ [Tindakan](#actions)

## Tindakan
<a name="actions"></a>

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

Contoh kode berikut menunjukkan cara menggunakan`associate-default-view`.

**AWS CLI**  
**Untuk menetapkan tampilan Resource Explorer sebagai default untuk AWS Region**  
`associate-default-view`Contoh berikut menetapkan tampilan, seperti yang ditentukan oleh ARN, menjadi tampilan default untuk AWS Wilayah di mana Anda memanggil operasi.  

```
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
```
Output:  

```
{
    "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-Main-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111"
}
```
Untuk informasi selengkapnya, lihat [Menyetel tampilan default di AWS Wilayah](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-set-default.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [AssociateDefaultView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/associate-default-view.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`batch-get-view`.

**AWS CLI**  
**Untuk mengambil detail tentang beberapa tampilan Resource Explorer**  
`batch-get-view`Contoh berikut menampilkan rincian tentang dua tampilan yang ditentukan oleh mereka ARNs. Gunakan spasi untuk memisahkan kelipatan ARNs dalam parameter --view-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
```
Output:  

```
{
    "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": []
}
```
Untuk informasi selengkapnya tentang tampilan, lihat [Tentang tampilan Resource Explorer](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-about.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [BatchGetView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/batch-get-view.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`create-index`.

**AWS CLI**  
**Untuk mengaktifkan Resource Explorer di AWS Region dengan membuat indeks**  
`create-index`Contoh berikut membuat indeks lokal di AWS Wilayah di mana operasi dipanggil. AWS CLI secara otomatis menghasilkan nilai `client-token` parameter acak dan memasukkannya ke dalam panggilan ke AWS jika Anda tidak menentukan nilai.  

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

```
{
    "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"
}
```
Setelah Anda membuat indeks lokal, Anda dapat mengubahnya menjadi indeks agregator untuk akun dengan menjalankan [update-index-type](https://docs.aws.amazon.com/cli/latest/reference/resource-explorer-2/update-index-type.html)perintah.  
Untuk informasi selengkapnya, lihat [Mengaktifkan Penjelajah Sumber Daya di AWS Wilayah untuk mengindeks sumber daya Anda](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-service-register.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [CreateIndex](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/create-index.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`create-view`.

**AWS CLI**  
**Contoh 1: Untuk membuat tampilan tanpa filter untuk indeks di Wilayah AWS **  
`create-view`Contoh berikut membuat tampilan di AWS Wilayah tertentu yang mengembalikan semua hasil di Wilayah tanpa pemfilteran apa pun. Tampilan menyertakan bidang Tag opsional pada hasil yang dikembalikan. Karena tampilan ini dibuat di Wilayah yang berisi indeks agregator, tampilan ini dapat menyertakan hasil dari semua Wilayah di akun yang berisi indeks Resource Explorer.  

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

```
{
    "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"
    }
}
```
**Contoh 2: Untuk membuat tampilan yang hanya menampilkan sumber daya yang terkait dengan Amazon EC2**  
Berikut ini `create-view` membuat tampilan di AWS Wilayah `us-east-1` yang hanya menampilkan sumber daya tersebut di Wilayah yang terkait dengan layanan Amazon EC2. Tampilan mencakup `Tags` bidang opsional pada hasil yang dikembalikan. Karena tampilan ini dibuat di Wilayah yang berisi indeks agregator, tampilan ini dapat menyertakan hasil dari semua Wilayah di akun yang berisi indeks 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
```
Output:  

```
{
    "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"
    }
}
```
Untuk informasi selengkapnya, lihat [Membuat tampilan untuk pencarian](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-create.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [CreateView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/create-view.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`delete-index`.

**AWS CLI**  
**Untuk mematikan Resource Explorer di AWS Region dengan menghapus indeksnya**  
`delete-index`Contoh berikut menghapus indeks Resource Explorer yang ditentukan di AWS Wilayah tempat Anda membuat permintaan.  

```
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
```
Output:  

```
{
    "Arn": "arn:aws:resource-explorer-2:us-west-2:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222",
    "State": "DELETING"
}
```
Untuk informasi selengkapnya tentang menghapus indeks, lihat [Menonaktifkan Penjelajah AWS Sumber Daya di AWS Wilayah](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-service-deregister.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [DeleteIndex](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/delete-index.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`delete-view`.

**AWS CLI**  
**Untuk menghapus tampilan Resource Explorer**  
`delete-view`Contoh berikut menghapus tampilan yang ditentukan oleh ARN nya.  

```
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
```
Output:  

```
{
    "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/EC2-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111"
}
```
Untuk informasi selengkapnya, lihat [Menghapus tampilan](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-delete.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [DeleteView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/delete-view.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`disassociate-default-view`.

**AWS CLI**  
**Untuk menghapus tampilan Resource Explorer default untuk AWS Wilayah**  
Berikut ini `disassociate-default-view` menghapus tampilan Resource Explorer default untuk AWS Wilayah di mana Anda memanggil operasi. Setelah melakukan operasi ini, semua operasi pencarian di Wilayah harus secara eksplisit menentukan tampilan atau operasi gagal.  

```
aws resource-explorer-2 disassociate-default-view
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Menyetel tampilan default di AWS Wilayah](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-set-default.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [DisassociateDefaultView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/disassociate-default-view.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`get-default-view`.

**AWS CLI**  
**Untuk mengambil tampilan Resource Explorer yang merupakan tampilan default untuk Region nya AWS **  
`get-default-view`Contoh berikut mengambil ARN dari tampilan yang merupakan default untuk Wilayah AWS di mana Anda memanggil operasi.  

```
aws resource-explorer-2 get-default-view
```
Output:  

```
{
    "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/default-view/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111"
}
```
Untuk informasi selengkapnya, lihat [Menyetel tampilan default di AWS Wilayah](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-set-default.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [GetDefaultView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/get-default-view.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`get-index`.

**AWS CLI**  
**Contoh 1: Untuk mengambil detail untuk indeks agregator Resource Explorer**  
`get-index`Contoh berikut menampilkan rincian untuk indeks Resource Explorer di AWS Wilayah tertentu. Karena Region yang ditentukan berisi indeks agregator untuk akun, output mencantumkan Wilayah yang mereplikasi data ke dalam indeks Region ini.  

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

```
{
    "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"
}
```
**Contoh 2: Untuk mengambil detail untuk indeks lokal Resource Explorer**  
`get-index`Contoh berikut menampilkan rincian untuk indeks Resource Explorer di AWS Wilayah tertentu. Karena Wilayah yang ditentukan berisi indeks lokal, output mencantumkan Wilayah tempat ia mereplikasi data dari indeks Wilayah ini.  

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

```
{
    "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"
}
```
Untuk informasi selengkapnya tentang indeks, lihat [Memeriksa AWS Wilayah mana yang mengaktifkan Resource Explorer di](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-service-check.html) *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [GetIndex](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/get-index.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`get-view`.

**AWS CLI**  
**Untuk mengambil detail tentang tampilan Resource Explorer**  
`get-view`Contoh berikut menampilkan rincian tentang tampilan yang ditentukan oleh ARN nya.  

```
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
```
Output:  

```
{
  "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"
  }
}
```
Untuk informasi selengkapnya tentang tampilan, lihat [Tentang tampilan Resource Explorer](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-about.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [GetView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/get-view.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`list-indexes`.

**AWS CLI**  
**Untuk membuat daftar AWS Wilayah tempat Resource Explorer memiliki indeks**  
`list-indexes`Contoh berikut mencantumkan indeks untuk semua Wilayah di mana Resource Explorer memiliki indeks. Respons menentukan jenis setiap indeks, AWS Wilayah, dan ARN-nya.  

```
aws resource-explorer-2 list-indexes
```
Output:  

```
{
    "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"
        }
    ]
}
```
Untuk informasi selengkapnya tentang indeks, lihat [Memeriksa AWS Wilayah mana yang mengaktifkan Resource Explorer di](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-service-check.html) *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [ListIndexes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/list-indexes.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`list-supported-resource-types`.

**AWS CLI**  
**Untuk membuat daftar AWS Wilayah tempat Resource Explorer memiliki indeks**  
`list-supported-resource-types`Contoh berikut mencantumkan semua jenis sumber daya yang saat ini didukung oleh &AREXlong;. Contoh respons mencakup `NextToken` nilai, yang menunjukkan bahwa ada lebih banyak output yang tersedia untuk diambil dengan panggilan tambahan.  

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

```
{
    "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="
}
```
Untuk mendapatkan bagian berikutnya dari output, panggil operasi lagi, dan berikan nilai `NextToken` respons panggilan sebelumnya sebagai nilai untuk`--starting-token`. `NextToken`Ulangi sampai tidak ada respon.  

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

```
{
    "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="
}
```
Untuk informasi selengkapnya tentang indeks, lihat [Memeriksa AWS Wilayah mana yang mengaktifkan Resource Explorer di](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-service-check.html) *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [ListSupportedResourceTypes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/list-supported-resource-types.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`list-tags-for-resource`.

**AWS CLI**  
**Untuk mencantumkan tag yang dilampirkan ke tampilan atau indeks Resource Explorer**  
`list-tags-for-resource`Contoh berikut mencantumkan kunci tag dan pasangan nilai yang dilampirkan untuk melihat dengan ARN yang ditentukan. Anda harus memanggil operasi dari AWS Wilayah yang berisi sumber daya.  

```
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
```
Output:  

```
{
    "Tags": {
        "application": "MainCorpApp",
        "department": "1234"
    }
}
```
Untuk informasi selengkapnya tentang menandai tampilan, lihat [Menandai tampilan untuk kontrol akses di Panduan](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-tag.html) *Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/list-tags-for-resource.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`list-views`.

**AWS CLI**  
**Untuk mencantumkan tampilan Resource Explorer yang tersedia di AWS Wilayah**  
`list-views`Contoh berikut mencantumkan semua tampilan yang tersedia di Wilayah tempat Anda menjalankan operasi.  

```
aws resource-explorer-2 list-views
```
Output:  

```
{
    "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"
    ]
}
```
Untuk informasi selengkapnya tentang tampilan, lihat [Tentang tampilan Resource Explorer](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-about.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [ListViews](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/list-views.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`search`.

**AWS CLI**  
**Contoh 1: Untuk mencari menggunakan tampilan default**  
`search`Contoh berikut menampilkan semua sumber daya dalam yang ditentukan yang terkait dengan layanan. Pencarian menggunakan tampilan default untuk Wilayah. Contoh respons mencakup `NextToken` nilai, yang menunjukkan bahwa ada lebih banyak output yang tersedia untuk diambil dengan panggilan tambahan.  

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

```
{
    "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"
}
```
**Contoh 2: Untuk mencari menggunakan tampilan tertentu**  
`search`Contoh pencarian berikut menampilkan semua sumber daya (“\$1”) di AWS Wilayah tertentu yang terlihat melalui tampilan yang ditentukan. Hasilnya hanya mencakup sumber daya yang terkait dengan Amazon EC2 karena filter yang dilampirkan pada tampilan.  

```
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
```
Output:  

```
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"
    }
```
Untuk informasi selengkapnya, lihat [Menggunakan AWS Resource Explorer untuk mencari sumber daya](https://docs.aws.amazon.com/resource-explorer/latest/userguide/using-search.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [Cari](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/search.html) di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`tag-resource`.

**AWS CLI**  
**Untuk menandai tampilan Resource Explorer**  
`tag-resource`Contoh berikut menambahkan kunci tag “lingkungan” dengan nilai “produksi” ke tampilan dengan ARN yang ditentukan.  

```
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
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Menandai tampilan untuk kontrol akses](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-tag.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/tag-resource.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`untag-resource`.

**AWS CLI**  
**Untuk menghapus tag dari tampilan Resource Explorer**  
`untag-resource`Contoh berikut menghapus tag apa pun dengan nama kunci “lingkungan” dari tampilan dengan ARN yang ditentukan.  

```
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
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Menandai tampilan untuk kontrol akses](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-tag.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/untag-resource.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`update-index-type`.

**AWS CLI**  
**Untuk mengubah jenis indeks Resource Explorer**  
`update-index-type`Contoh berikut mengonversi indeks yang ditentukan dari jenis `local` ke jenis `aggregator` untuk mengaktifkan kemampuan untuk mencari sumber daya di semua AWS Wilayah dalam akun. Anda harus mengirim permintaan ke AWS Wilayah yang berisi indeks yang ingin Anda perbarui.  

```
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
```
Output:  

```
{
    "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"
}
```
Untuk informasi selengkapnya tentang mengubah jenis indeks, lihat [Mengaktifkan pencarian lintas wilayah dengan membuat indeks agregator](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-aggregator-region.html) di Panduan *Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [UpdateIndexType](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/update-index-type.html)di *Referensi AWS CLI Perintah*. 

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

Contoh kode berikut menunjukkan cara menggunakan`update-view`.

**AWS CLI**  
**Contoh 1: Untuk memperbarui IncludedProperties bidang untuk tampilan Resource Explorer**  
`update-view`Contoh berikut memperbarui tampilan yang ditentukan dengan ``tags`` menambahkan opsional``IncludedProperties``. Setelah menjalankan operasi ini, operasi pencarian yang menggunakan tampilan ini menyertakan informasi tentang tag yang dilampirkan ke sumber daya yang muncul di hasil.  

```
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
```
Output:  

```
{
    "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"
    }
}
```
**Contoh 2: Untuk memperbarui filter yang dilampirkan ke tampilan**  
`update-view`Contoh berikut memperbarui tampilan yang ditentukan untuk menggunakan filter yang membatasi hasil hanya pada jenis sumber daya yang terkait dengan layanan 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
```
Output:  

```
{
    "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"
    }
}
```
Untuk informasi selengkapnya tentang tampilan, lihat [Tentang tampilan Resource Explorer](https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views-about.html) di *Panduan Pengguna AWS Resource Explorer*.  
+  Untuk detail API, lihat [UpdateView](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/resource-explorer-2/update-view.html)di *Referensi AWS CLI Perintah*. 