Identifying resources - Cloud Control API

Identifying resources

Every resource type has a property that is defined as its primary identifier. The value of this property must be unique for each resource of that type in a given AWS account and AWS Region. For example, many resource types include a Name property that must be unique for each resource of that type. In some cases, the primary identifier is defined as a combination of multiple properties that together form a unique identifier. By using this primary identifier, combined with the resource type, you can specify exactly which resource on which you want to perform resource operations such as update-resource or delete-resource.

In addition, some resource types define secondary identifiers that can also be used to uniquely identify resources of that type.

To determine which resource property (or combination of properties) is the primary identifier for a resource type, refer to the primaryIdentifier attribute of the resource type schema. The schema includes secondary identifiers defined, as well. For more information, see Viewing resource type schemas.

Getting a resource's primary identifier

You can find the identifier value for a specific resource by using Cloud Control API commands. Each of the following commands returns a ProgressEvent object that contains the primary identifier of the specified resources:

  • cancel-resource-request

  • create-resource

  • get-resource-request-status

  • list-resource-requests

Using a resource's primary identifier

When using Cloud Control API commands, you can specify the primary identifier or any secondary identifier defined for the resource type in its resource schema. You can only specify one identifier. Primary identifiers can be specified as a string or JSON; secondary identifiers must be specified as JSON.

For compound primary identifiers (that is, one that consists of multiple resource properties strung together), to specify the primary identifier as a string, list the property values in the order that they are specified in the primary identifier definition, separated by |.

For example, the primary identifier for the resource is defined as:

"primaryIdentifier": [ "/properties/DatabaseName", "/properties/TableName"

So, to specify the primary identifier of a resource as a string, you use the following format.

DatabaseName|TableName

For example, given a database with a database name of MyDatabase and table name of MyTable, you specify MyDatabase|MyTable.

For compound identifiers specified as JSON, property order is not required, as shown in the following example.

{"TableName": "MyTable", "DatabaseName": "MyDatabase"}

For more information about resource identifiers, see primaryidentifier in the CloudFormation Command Line Interface User Guide for Extension Development.