Dokumentasi ini AWS CLI hanya untuk Versi 1.
Kami mengumumkan akhir dukungan yang akan datang untuk AWS CLI versi 1. Kami menyarankan Anda bermigrasi ke AWS CLI versi 2. Untuk tanggal, detail tambahan, dan informasi tentang cara bermigrasi, lihat pengumuman
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
Contoh kode berikut menunjukkan cara melakukan tindakan dan menerapkan skenario umum dengan menggunakan AWS Command Line Interface dengan 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.
Topik
Tindakan
Contoh kode berikut menunjukkan cara menggunakanassociate-default-view.
- AWS CLI
-
Untuk mengatur tampilan Resource Explorer sebagai default untuk Wilay AWS anya
associate-default-viewContoh berikut menetapkan tampilan, seperti yang ditentukan oleh ARN-nya, menjadi tampilan default untuk Wil AWS ayah tempat Anda memanggil operasi.aws resource-explorer-2 associate-default-view \ --view-arnarn:aws:resource-explorer-2:us-east-1:123456789012:view/My-Main-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111Output:
{ "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/My-Main-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111" }Untuk informasi selengkapnya, lihat Mengatur tampilan default di AWS Wilayah di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat AssociateDefaultView
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanbatch-get-view.
- AWS CLI
-
Untuk mengambil detail tentang beberapa tampilan Resource Explorer
batch-get-viewContoh berikut menampilkan detail tentang dua tampilan yang ditentukan oleh ARN mereka. Gunakan spasi untuk memisahkan beberapa ARN dalam parameter --view-arn.aws resource-explorer-2 batch-get-view \ --view-arnsarn: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-EXAMPLE11111Output:
{ "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 Mengenai tampilan Res AWS ource Explorer di Panduan Pengguna Resource Explorer.
-
Untuk detail API, lihat BatchGetView
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-index.
- AWS CLI
-
Untuk mengaktifkan Resource Explorer di AWS Wilayah dengan membuat indeks
create-indexContoh berikut membuat indeks lokal di Wil AWS ayah di mana operasi dipanggil. AWS CLI secara otomatis menghasilkan nilaiclient-tokenparameter acak dan memasukkannya ke dalam panggilan ke AWS jika Anda tidak menentukan nilai.aws resource-explorer-2 create-index \ --regionus-east-1Output:
{ "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 perintah update- index-type.
Untuk informasi selengkapnya, lihat Mengaktifkan Resource Explorer di Wil AWS ayah untuk mengindeks sumber daya Anda di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat CreateIndex
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-view.
- AWS CLI
-
Contoh 1: Untuk membuat tampilan tanpa filter untuk indeks di Wilayah AWS
create-viewContoh berikut membuat tampilan di Wil AWS ayah yang ditentukan 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-nameMy-Main-View\ --included-propertiesName=tags\ --regionus-east-1Output:
{ "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 mengembalikan sumber daya yang terkait dengan Amazon EC2
Berikut ini
create-viewmembuat tampilan di Wil AWS ayahus-east-1yang hanya mengembalikan sumber daya di Wilayah yang terkait dengan layanan Amazon EC2. Tampilan menyertakanTagsbidang 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-nameMy-EC2-Only-View\ --included-propertiesName=tags\ --filters FilterString="service:ec2" \ --regionus-east-1Output:
{ "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 di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat CreateView
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-index.
- AWS CLI
-
Untuk mematikan Resource Explorer di Wil AWS ayah dengan menghapus indeksnya
delete-indexContoh berikut menghapus indeks Resource Explorer yang ditentukan di Wil AWS ayah tempat Anda membuat permintaan.aws resource-explorer-2 delete-index \ --arnarn:aws:resource-explorer-2:us-west-2:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222\ --regionus-west-2Output:
{ "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 Mematikan AWS Resource Explorer di AWS Wilayah di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat DeleteIndex
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-view.
- AWS CLI
-
Untuk menghapus tampilan Resource Explorer
delete-viewContoh berikut menghapus tampilan yang ditentukan oleh ARN-nya.aws resource-explorer-2 delete-view \ --view-arnarn:aws:resource-explorer-2:us-east-1:123456789012:view/EC2-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111Output:
{ "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 di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat DeleteView
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandisassociate-default-view.
- AWS CLI
-
Untuk menghapus tampilan Resource Explorer default untuk Wil AWS ayah
Berikut ini
disassociate-default-viewmenghapus tampilan Resource Explorer default untuk AWS Wilayah tempat 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-viewPerintah ini tidak menghasilkan output.
Untuk informasi selengkapnya, lihat Mengatur tampilan default di AWS Wilayah di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat DisassociateDefaultView
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-default-view.
- AWS CLI
-
Untuk mengambil tampilan Resource Explorer yang merupakan tampilan default untuk Wil AWS ayahnya
get-default-viewContoh berikut mengambil ARN dari tampilan yang merupakan default untuk Wil AWS ayah di mana Anda memanggil operasi.aws resource-explorer-2 get-default-viewOutput:
{ "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/default-view/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111" }Untuk informasi selengkapnya, lihat Mengatur tampilan default di AWS Wilayah di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat GetDefaultView
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-index.
- AWS CLI
-
Contoh 1: Untuk mengambil detail untuk indeks agregator Resource Explorer
get-indexContoh berikut menampilkan rincian untuk indeks Resource Explorer di Wilayah yang ditentukan AWS . Karena Wilayah yang ditentukan berisi indeks agregator untuk akun, output mencantumkan Wilayah yang mereplikasi data ke dalam indeks Wilayah ini.aws resource-explorer-2 get-index \ --regionus-east-1Output:
{ "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-indexContoh berikut menampilkan rincian untuk indeks Resource Explorer di Wilayah yang ditentukan AWS . Karena Wilayah yang ditentukan berisi indeks lokal, output mencantumkan Wilayah tempat ia mereplikasi data dari indeks Wilayah ini.aws resource-explorer-2 get-index \ --regionus-west-2Output:
{ "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 M emeriksa AWS Wilayah mana yang mengaktifkan Resource Explorer di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat GetIndex
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-view.
- AWS CLI
-
Untuk mengambil detail tentang tampilan Resource Explorer
get-viewContoh berikut menampilkan rincian tentang tampilan yang ditentukan oleh ARN-nya.aws resource-explorer-2 get-view \ --view-arnarn:aws:resource-explorer-2:us-east-1:123456789012:view/EC2-Only-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111Output:
{ "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 Mengenai tampilan Res AWS ource Explorer di Panduan Pengguna Resource Explorer.
-
Untuk detail API, lihat GetView
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-indexes.
- AWS CLI
-
Untuk membuat daftar Wil AWS ayah di mana Resource Explorer memiliki indeks
list-indexesContoh berikut mencantumkan indeks untuk semua Wilayah di mana Resource Explorer memiliki indeks. Respons menentukan jenis setiap indeks, Wilayahnya AWS , dan ARN-nya.aws resource-explorer-2 list-indexesOutput:
{ "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 M emeriksa AWS Wilayah mana yang mengaktifkan Resource Explorer di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat ListIndexes
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-supported-resource-types.
- AWS CLI
-
Untuk membuat daftar Wil AWS ayah di mana Resource Explorer memiliki indeks
list-supported-resource-typesContoh berikut mencantumkan semua jenis sumber daya yang saat ini didukung oleh &arexLong;. Contoh respons mencakupNextTokennilai, yang menunjukkan bahwa ada lebih banyak output yang tersedia untuk diambil dengan panggilan tambahan.aws resource-explorer-2 list-supported-resource-types \ --max-items10Output:
{ "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
NextTokenrespons panggilan sebelumnya sebagai nilai untuk--starting-token. Ulangi sampaiNextTokentidak ada dari respons.aws resource-explorer-2 list-supported-resource-types \ --max-items10\ --starting-tokeneyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAxMH0=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 M emeriksa AWS Wilayah mana yang mengaktifkan Resource Explorer di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat ListSupportedResourceTypes
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-tags-for-resource.
- AWS CLI
-
Untuk membuat daftar tag yang dilampirkan ke tampilan atau indeks Resource Explorer
list-tags-for-resourceContoh berikut mencantumkan kunci tag dan pasangan nilai yang dilampirkan untuk dilihat dengan ARN yang ditentukan. Anda harus memanggil operasi dari Wil AWS ayah yang berisi sumber daya.aws resource-explorer-2 list-tags-for-resource \ --resource-arnarn:aws:resource-explorer-2:us-east-1:123456789012:view/My-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111Output:
{ "Tags": { "application": "MainCorpApp", "department": "1234" } }Untuk informasi selengkapnya tentang menandai tampilan, lihat Menandai tampilan untuk kontrol akses di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat ListTagsForResource
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-views.
- AWS CLI
-
Untuk membuat daftar tampilan Resource Explorer yang tersedia di suatu Wil AWS ayah
list-viewsContoh berikut mencantumkan semua tampilan yang tersedia di Wilayah tempat Anda memanggil operasi.aws resource-explorer-2 list-viewsOutput:
{ "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 di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat ListViews
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakansearch.
- AWS CLI
-
Contoh 1: Untuk mencari menggunakan tampilan default
searchContoh berikut menampilkan semua sumber daya di Wilayah yang ditentukan yang terkait dengan layanan IAM. Pencarian menggunakan tampilan default untuk Wilayah. Contoh respons mencakupNextTokennilai, 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 yang ditentukan
searchContoh pencarian berikut menampilkan semua sumber daya (“*”) di Wil AWS ayah yang ditentukan yang terlihat melalui tampilan yang ditentukan. Hasilnya hanya mencakup sumber daya yang terkait dengan Amazon EC2 karena filter yang terpasang pada tampilan.aws resource-explorer-2 search \ --query-string"*"\ --view-arnarn:aws:resource-explorer-2:us-east-1:123456789012:view/My-EC2-view/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222Output:
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 di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat Pencarian
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakantag-resource.
- AWS CLI
-
Untuk menandai tampilan Resource Explorer
tag-resourceContoh berikut menambahkan kunci tag “lingkungan” dengan nilai “produksi” ke tampilan dengan ARN yang ditentukan.aws resource-explorer-2 tag-resource \ --resource-arnarn:aws:resource-explorer-2:us-east-1:123456789012:view/My-View//EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111\ --tagsenvironment=productionPerintah ini tidak menghasilkan output.
Untuk informasi selengkapnya, lihat Menandai tampilan untuk kontrol akses di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat TagResource
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanuntag-resource.
- AWS CLI
-
Untuk menghapus tag dari tampilan Resource Explorer
untag-resourceContoh berikut menghapus tag dengan nama kunci “lingkungan” dari tampilan dengan ARN yang ditentukan.aws resource-explorer-2 untag-resource \ --resource-arnarn:aws:resource-explorer-2:us-east-1:123456789012:view/My-View//EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111\ --tag-keysenvironmentPerintah ini tidak menghasilkan output.
Untuk informasi selengkapnya, lihat Menandai tampilan untuk kontrol akses di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat UntagResource
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-index-type.
- AWS CLI
-
Untuk mengubah jenis indeks Resource Explorer
update-index-typeContoh berikut mengonversi indeks yang ditentukan dari tipelocalaggregatorke jenis untuk mengaktifkan kemampuan mencari sumber daya di semua AWS Wilayah dalam akun. Anda harus mengirim permintaan ke Wil AWS ayah yang berisi indeks yang ingin Anda perbarui.aws resource-explorer-2 update-index-type \ --arnarn:aws:resource-explorer-2:us-east-1:123456789012:index/EXAMPLE8-90ab-cdef-fedc-EXAMPLE11111\ --typeaggregator\ --regionus-east-1Output:
{ "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 di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat UpdateIndexType
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-view.
- AWS CLI
-
Contoh 1: Untuk memperbarui IncludedProperties bidang untuk tampilan Resource Explorer
update-viewContoh berikut memperbarui tampilan yang ditentukan dengan menambahkan`tags`ke opsional`IncludedProperties`. Setelah menjalankan operasi ini, operasi pencarian yang menggunakan tampilan ini menyertakan informasi tentang tag yang dilampirkan ke sumber daya yang muncul dalam hasil.aws resource-explorer-2 update-view \ --included-propertiesName=tags\ --view-arnarn:aws:resource-explorer-2:us-east-1:123456789012:view/My-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222Output:
{ "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-viewContoh 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-arnarn:aws:resource-explorer-2:us-east-1:123456789012:view/My-View/EXAMPLE8-90ab-cdef-fedc-EXAMPLE22222Output:
{ "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 di Panduan Pengguna AWS Resource Explorer.
-
Untuk detail API, lihat UpdateView
di Refer AWS CLI ensi Perintah.
-