Resource Tags
When you have many resources (for example, instances, VCNs, load balancers, and block volumes) across multiple compartments in your tenancy, it can become difficult to track resources used for specific purposes, or to aggregate them, report on them, or take bulk actions on them. Tagging allows you to define keys and values and associate them with resources. You can then use the tags to help you organize and list resources based on your business needs.
There are two types of tags:
Defined tags are set up in your tenancy by an administrator. Only users granted permission to work with the defined tags can apply them to resources.
Free-form tags can be applied by any user with permissions on the resource.
For more detailed information about tags and their features, see Overview of Tagging.
Watch a video to introduce you to the concepts and features of tagging: Introduction to Tagging.
Avoid entering confidential information when assigning descriptions, tags, or friendly names to cloud resources through the Oracle Cloud Infrastructure Console, API, or CLI.
Working with Resource Tags
To apply a defined tag, you must have permission to use the namespace.
-
Open the Console, go to the details page of the resource you want to tag.
For example, to tag a compute instance: Open the navigation menu and click Compute. Under Compute, click Instances. A list of the instances in your current compartment is displayed. Find the instance that you want to tag, and click its name to view its details page.
- Click Apply Tags. Depending on the resource, this option might appear in the More Actions menu.
-
In the Apply Tags to the Resource dialog:
- Select the Tag Namespace.
- Select the Tag Key.
- In Value, either enter a value or select one from the list.
- To apply another tag, click + Additional Tag.
- When finished adding tags, click Apply Tag(s).
-
Open the Console, go to the details page of the resource you want to tag.
For example, to tag a compute instance: Open the navigation menu and click Compute. Under Compute, click Instances. A list of the instances in your current compartment is displayed. Find the instance that you want to tag, and click its name to view its details page.
- Click Apply Tags. Depending on the resource, this option might appear in the More Actions menu.
-
In the Apply Tags to the Resource dialog:
- Select None (apply a free-form tag).
- Enter the Tag Key.
- Enter a Value.
- To apply another tag, click + Additional Tag.
- When finished adding tags, click Apply Tag(s).
You can apply tags during resource creation. The location of the Apply Tag(s) option in the dialog varies by resource. The general steps are:
-
In the resource Create dialog, click Apply Tags.
On some resources, you have to click Show Advanced Options to apply a tag.
-
In the Apply Tags to the Resource dialog:
- Select the Tag Namespace, or select None to apply a free-form tag.
- Select or enter the Tag Key.
- In Value, either enter a value or select one from the list.
- To apply another tag, click + Additional Tag.
- Click Apply Tag(s).
Open the Console, click the service name and then click the resource you want to view. The left side of the page shows all the filters currently applied to the list.
For example, to view compute instances: Click Compute and then click Instances, to see the list of instances in your current compartment.
- Next to Tag filters, click add.
- In the Add a tag filter dialog, enter the following:
- Tag namespace: Select the tag namespace.
- Tag key: Select the key.
- Tag value: Select from the following:
- Match any value - returns all resources tagged with the selected namespace and key, regardless of the tag value.
- Specify matching values - returns resources with the tag value you enter in the text box. Enter a single value in the text box. To specify multiple values for the same namespace and key, click + to display another text box. Enter one value per text box.
- Click Apply filter.
- Next to Tag filters, click add.
- In the Add a tag filter dialog, enter the following:
- Tag namespace: Select None (free-form tag).
- Tag key: Enter the key.
- Tag value: Select from the following:
- Match any value - returns all resources tagged with the selected namespace and key, regardless of the tag value.
- Specify matching values - returns resources with the tag value you enter in the text box. Enter a single value in the text box. To specify multiple values for the same namespace and key, click + to display another text box. Enter one value per text box.
- Click Apply filter.
-
Open the Console, click the service name, and then click the resource you want to view.
For example, to view compute instances: Open the navigation menu and click Compute. Under Compute, click Instances. A list of the instances in your current compartment is displayed. Find the instance that you want to update, and click its name to view its details page.
-
Click Tags.
The list of tags applied to the resource is displayed.
- Find the tag you want to update and click the pencil icon next to it.
- Enter or select a new value.
- Click Save.
-
Open the Console, click the service name and then click the resource you want to view.
For example, to view a compute instance: Open the navigation menu and click Compute. Under Compute, click Instances. A list of the instances in your current compartment is displayed. Find the instance that you want to remove the tag from, and click its name to view its details page.
-
Click Tags.
The list of tags applied to the resource is displayed.
- Find the tag you want to remove and click the pencil icon next to it.
- Click Remove Tag.
Using the API
For information about using the API and signing requests, see REST API documentation and Security Credentials. For information about SDKs, see SDKs and the CLI.
- To apply a tag to an individual resource using the API, use the appropriate
resource's
create
orupdate
operation. - BulkEditTags - adds, updates, and removes multiple tag key definitions on the selected resources
- ListBulkEditTagsResourceTypes - lists the resource types that support bulk tag editing