CmdID

CmdID / aws / aws resource-explorer-2

aws resource-explorer-2 create-view

Creates a view that users can query by using the Search operation. AWS CLI reference

2 examples 6 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To create an unfiltered view for the index in an AWS Region

The following create-view example creates a view in the specified AWS 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-name My-Main-View --included-properties Name=tags --region us-west-2Identify
--view-nameThe name of the new view.
--included-propertiesSpecifies optional fields that you want included in search results from this view.
--regionThe region to use.
Its 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-west-2:123456789012:view/My-Main-View/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
    }
}

Example 2: To create a view that returns only resources associated with Amazon EC2

The following create-view example creates a view in AWS Region us-west-2 that returns only those resources in the Region that are associated with the Amazon EC2 service. 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-name My-EC2-Only-View --included-properties Name=tags --filters FilterString="service:ec2" --region us-west-2Identify
--view-nameThe name of the new view.
--included-propertiesSpecifies optional fields that you want included in search results from this view.
--filtersAn array of strings that specify which resources are included in the results of queries made using this view.
--regionThe region to use.
Its 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-west-2:123456789012:view/My-EC2-Only-View/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222"
    }
}

For more information, see Creating Resource Explorer views to use for search in the AWS Resource Explorer Users Guide.

Options

6 in the AWS CLI reference
--client-tokenThis value helps ensure idempotency.
--filtersAn array of strings that specify which resources are included in the results of queries made using this view.
--included-propertiesSpecifies optional fields that you want included in search results from this view.
--scopeThe root ARN of the account, an organizational unit (OU), or an organization ARN.
--tagsTag key and value pairs that are attached to the view.
--view-nameThe name of the new view.