You can execute a SELECT statement to search for resources based on fields in the resource properties. For example, you can use this method to search for the memory of an Elastic Compute Service (ECS) instance.

Background information

Before you write a SELECT statement to search for resources, you must obtain the fields and the types of the fields from the properties file of the specified resource type. For more information about properties files, see Alibaba Cloud Config Resource Schema.

Each resource type supported by Cloud Config has a properties file. Properties files are named based on the corresponding resource types. For example, the properties file of the ACS::ECS::Instance resource type is named ACS_ECS_Instance.properties.json. Properties files of different resource types are placed under the config/properties/resource-types path.

Use an ordinary account

If you use an ordinary account, you can search for the resources within your account.

  1. Log on to the Cloud Config console.
  2. In the left-side navigation pane, choose Resources > Advanced.
  3. On the Advanced page, click the SQL tab.
  4. On the SQL tab, enter an SQL query statement.
  5. Click Execute.
    The resources that meet the search conditions specified in the query statement are returned.
    Note A maximum of 1,000 resources can be displayed in the resource list. You can click Download Query Result in the upper-right corner to download a CSV file that contains all the resources that meet the search conditions.

Use a management account

If you use a management account, you can search for the resources within your account and those within the member accounts in each account group.

  1. Log on to the Cloud Config console.
  2. In the left-side navigation pane, choose Resources > Advanced.
  3. On the Advanced page, click the required account group tab.
  4. Click the SQL tab.
  5. On the SQL tab, enter an SQL query statement.
  6. Click Execute.
    The resources that meet the search conditions specified in the query statement are returned.
    Note A maximum of 1,000 resources can be displayed in the resource list. You can click Download Query Result in the upper-right corner to download a CSV file that contains all the resources that meet the search conditions.