Resource Explorer examples using Amazon CLI
The following code examples show you how to perform actions and implement common scenarios by using the Amazon Command Line Interface with Resource Explorer.
Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.
Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.
Topics
Actions
The following code example shows how to use associate-default-view.
- Amazon CLI
-
To set a Resource Explorer view as the default for its Amazon Region
The following
associate-default-viewexample sets a view, as specified by its ARN, to be the default view for the Amazon Region in which you call the operation.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" }For more information, see Setting a default view in an Amazon Region
in the Amazon Resource Explorer Users Guide. -
For API details, see AssociateDefaultView
in Amazon CLI Command Reference.
-
The following code example shows how to use batch-get-view.
- Amazon CLI
-
To retrieve details about multiple Resource Explorer views
The following
batch-get-viewexample displays the details about two views specified by their ARNs. Use spaces to separate the multiple ARNs in the --view-arn parameter.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": [] }For more information about views, see About Resource Explorer views
in the Amazon Resource Explorer Users Guide. -
For API details, see BatchGetView
in Amazon CLI Command Reference.
-
The following code example shows how to use create-index.
- Amazon CLI
-
To turn on Resource Explorer in an Amazon Region by creating an index
The following
create-indexexample creates a local index in the Amazon Region in which the operation is called. The Amazon CLI automatically generates a randomclient-tokenparameter value and includes it in the call to Amazon if you don't specify a value.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" }After you create a local index, you can convert it into the aggregator index for the account by running the update-index-type
command. For more information, see Turning on Resource Explorer in an Amazon Region to index your resources
in the Amazon Resource Explorer Users Guide. -
For API details, see CreateIndex
in Amazon CLI Command Reference.
-
The following code example shows how to use create-view.
- Amazon CLI
-
Example 1: To create an unfiltered view for the index in an Amazon Region
The following
create-viewexample creates a view in the specified Amazon Region that returns all results in the Region without any filtering. The view includes the optional Tags field on returned results. Because this view is created in the Region that contains the aggregator index, it can include results from all Regions in the account that contain a Resource Explorer index.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" } }Example 2: To create a view that returns only resources associated with Amazon EC2
The following
create-viewcreates a view in Amazon Regionus-east-1that returns only those resources in the Region that are associated with the Amazon EC2 service. The view includes the optionalTagsfield on returned results. Because this view is created in the Region that contains the aggregator index, it can include results from all Regions in the account that contain a Resource Explorer index.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" } }For more information, see Creating views for search
in the Amazon Resource Explorer Users Guide. -
For API details, see CreateView
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-index.
- Amazon CLI
-
To turn off Resource Explorer in an Amazon Region by deleting its index
The following
delete-indexexample deletes the specified Resource Explorer index in the Amazon Region in which you make the request.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" }For more information about deleting an index, see Turning off Amazon Resource Explorer in an Amazon Region
in the Amazon Resource Explorer Users Guide. -
For API details, see DeleteIndex
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-view.
- Amazon CLI
-
To delete a Resource Explorer view
The following
delete-viewexample deletes a view specified by its ARN.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" }For more information, see Deleting views
in the Amazon Resource Explorer Users Guide. -
For API details, see DeleteView
in Amazon CLI Command Reference.
-
The following code example shows how to use disassociate-default-view.
- Amazon CLI
-
To remove the default Resource Explorer view for an Amazon Region
The following
disassociate-default-viewremoves the default Resource Explorer view for the Amazon Region in which you call the operation. After performing this operation, all search operations in the Region must explicitly specify a view or the operation fails.aws resource-explorer-2 disassociate-default-viewThis command produces no output.
For more information, see Setting a default view in an Amazon Region
in the Amazon Resource Explorer Users Guide. -
For API details, see DisassociateDefaultView
in Amazon CLI Command Reference.
-
The following code example shows how to use get-default-view.
- Amazon CLI
-
To retrieve the Resource Explorer view that is the default view for its Amazon Region
The following
get-default-viewexample retrieves the ARN of the view that is the default for the Amazon Region in which you call the operation.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" }For more information, see Setting a default view in an Amazon Region
in the Amazon Resource Explorer Users Guide. -
For API details, see GetDefaultView
in Amazon CLI Command Reference.
-
The following code example shows how to use get-index.
- Amazon CLI
-
Example 1: To retrieve the details for a Resource Explorer aggregator index
The following
get-indexexample displays the details for the Resource Explorer index in the specified Amazon Region. Because the specified Region contains the aggregator index for the account, the output lists the Regions that replicate data into this Region's index.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" }Example 2: To retrieve the details for a Resource Explorer local index
The following
get-indexexample displays the details for the Resource Explorer index in the specified Amazon Region. Because the specified Region contains a local index, the output lists the Region to which it replicates data from this Region's index.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" }For more information about indexes, see Checking which Amazon Regions have Resource Explorer turned on
in the Amazon Resource Explorer Users Guide. -
For API details, see GetIndex
in Amazon CLI Command Reference.
-
The following code example shows how to use get-view.
- Amazon CLI
-
To retrieve details about a Resource Explorer view
The following
get-viewexample displays the details about a view specified by its ARN.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" } }For more information about views, see About Resource Explorer views
in the Amazon Resource Explorer Users Guide. -
For API details, see GetView
in Amazon CLI Command Reference.
-
The following code example shows how to use list-indexes.
- Amazon CLI
-
To list the Amazon Regions where Resource Explorer has indexes
The following
list-indexesexample lists the indexes for all Regions where Resource Explorer has an index. The response specifies the type of each index, its Amazon Region, and its ARN.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" } ] }For more information about indexes, see Checking which Amazon Regions have Resource Explorer turned on
in the Amazon Resource Explorer Users Guide. -
For API details, see ListIndexes
in Amazon CLI Command Reference.
-
The following code example shows how to use list-supported-resource-types.
- Amazon CLI
-
To list the Amazon Regions where Resource Explorer has indexes
The following
list-supported-resource-typesexample lists all of the resource types currently supported by &AREXlong;. The example response includes aNextTokenvalue, which indicates that there is more output available to retrieve with additional calls.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=" }To get the next part of the output, call the operation again, and pass the previous call's
NextTokenresponse value as the value for--starting-token. Repeat untilNextTokenis absent from the response.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=" }For more information about indexes, see Checking which Amazon Regions have Resource Explorer turned on
in the Amazon Resource Explorer Users Guide. -
For API details, see ListSupportedResourceTypes
in Amazon CLI Command Reference.
-
The following code example shows how to use list-tags-for-resource.
- Amazon CLI
-
To list the tags attached to a Resource Explorer view or index
The following
list-tags-for-resourceexample lists the tag key and value pairs attached to view with the specified ARN. You must call the operation from the Amazon Region that contains the resource.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" } }For more information about tagging views, see Tagging views for access control
in the Amazon Resource Explorer Users Guide. -
For API details, see ListTagsForResource
in Amazon CLI Command Reference.
-
The following code example shows how to use list-views.
- Amazon CLI
-
To list the Resource Explorer views available in an Amazon Region
The following
list-viewsexample lists all of the views available in the Region in which you invoke the operation.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" ] }For more information about views, see About Resource Explorer views
in the Amazon Resource Explorer Users Guide. -
For API details, see ListViews
in Amazon CLI Command Reference.
-
The following code example shows how to use search.
- Amazon CLI
-
Example 1: To search using the default view
The following
searchexample displays all resources in the specified that are associated with the service. The search uses the default view for the Region. The example response includes aNextTokenvalue, which indicates that there is more output available to retrieve with additional calls.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" }Example 2: To search using a specified view
The following
searchexample search displays all resources ("*") in the specified Amazon Region that are visible through the specified view. The results include only resources associated with Amazon EC2 because of the filters attached to the view.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" }For more information, see Using Amazon Resource Explorer to search for resources
in the Amazon Resource Explorer Users Guide. -
For API details, see Search
in Amazon CLI Command Reference.
-
The following code example shows how to use tag-resource.
- Amazon CLI
-
To tag a Resource Explorer view
The following
tag-resourceexample adds the tag key "environment" with the value "production" to the view with the specified ARN.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=productionThis command produces no output.
For more information, see Tagging views for access control
in the Amazon Resource Explorer Users Guide. -
For API details, see TagResource
in Amazon CLI Command Reference.
-
The following code example shows how to use untag-resource.
- Amazon CLI
-
To remove a tag from a Resource Explorer view
The following
untag-resourceexample removes any tag with the key name "environment" from the view with the specified ARN.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-keysenvironmentThis command produces no output.
For more information, see Tagging views for access control
in the Amazon Resource Explorer Users Guide. -
For API details, see UntagResource
in Amazon CLI Command Reference.
-
The following code example shows how to use update-index-type.
- Amazon CLI
-
To change the type of a Resource Explorer index
The following
update-index-typeexample converts the specified index from typelocalto typeaggregatorto turn on the ability to search for resources across all Amazon Regions in the account. You must send the request to the Amazon Region that contains the index you want to update.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" }For more information about changing an index's type, see Turning on cross-Region search by creating an aggregator index
in the Amazon Resource Explorer Users Guide. -
For API details, see UpdateIndexType
in Amazon CLI Command Reference.
-
The following code example shows how to use update-view.
- Amazon CLI
-
Example 1: To update the IncludedProperties field for a Resource Explorer view
The following
update-viewexample updates the specified view by adding`tags`to the optional`IncludedProperties`. After running this operation, search operations that use this view include information about the tags attached to the resources that appear in the results.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" } }Example 2: To update the filters attached to a view
The following
update-viewexample updates the specified view to use a filter that limits results to only resource types that are associated with the Amazon EC2 service.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" } }For more information about views, see About Resource Explorer views
in the Amazon Resource Explorer Users Guide. -
For API details, see UpdateView
in Amazon CLI Command Reference.
-