Adding, modifying, and removing tags
You can manage tags for an individual instance from the instance details page on the Triton portal or by using CloudAPI.
Use cases for tags
Tags are external descriptors added to an instance, which can allow users to identify an instance from a list. Tags are not accessible from inside an instance.
Here are some example scenarios in which you may want to add a tag. This list does not encompass all possibilities.
- Identify or group multiple instances together
- Adding firewall rules
- Adding Triton CNS
In some scenarios, tags are automatically added to your instance. For example, Docker containers are assigned the tag key-value pair sdc_docker: true
. Docker labels are also interpreted as tags.
To better understand the difference between tags and metadata, view the comparison chart.
Manage tags with the Triton portal
To use the Triton Compute Service portal to manage tags, you must be signed in.
Adding a tag to an instance
- Select Compute from the navigation.
- Select the instance to be tagged from the list displayed.
- Scroll down to the Tags section.
- Within the Tags section, specify the key and value for the tag using the corresponding input fields and then click Add.
Editing a tag on an instance
- Sign in to your the portal at http://my.mnx.io/
- Select Compute from the navigation.
- Select the instance on which to edit the tags from the list of instances displayed.
- Scroll down to Tags.
- Click somewhere on the key/value pair of the tag.
- Specify the new key and/or value for the tag using the input fields, and then click Save.
Deleting a tag from an instance
- Sign in to your Triton Compute Service dashboard at http://my.mnx.io/.
- Select Compute from the navigation.
- Select the instance on which to delete a tag from the list of instances displayed.
- Scroll down to Tags.
- Find the tag to be deleted.
- Click on the "X" icon to the right of the key/value pair.
Use CloudAPI to manage tags
To add, modify, and remove tags with CloudAPI, use triton instance tag
. To see all of the available options, execute that command with the --help
tag.
$ triton instance tag --help
NOTE: Actions executed with triton instance tag
are asynchronous. Wait for the update to be complete by adding the -w
or --wait
option.
View existing tags for an instance
Use triton instance get
to list the existing tags on an instance.
$ triton inst get <container> | json tags
{
"cns": "my-instance"
}
Add tags to an instance
To set tags on a given instance, use set
. The results including all existing tags on an instance will be echoed.
$ triton instance tag set -w <container> foo=bar
{
"cns": "my-instance",
"foo": "bar"
}
Any pre-existing tags with the same name will be overwritten. For example, if running that command again, using foo
as the key name:
$ triton instance tag set -w <container> foo=test
{
"cns": "my-instance",
"foo": "test"
}
Remove tags from an instance
To remove tags on an instance, you must only declare the key from the key-value pair with the delete
command.
$ triton instance tag delete -w <container> foo
Deleted tag foo on instance <container>
Modify existing tags on an instance
To fully replace all tags on an instance with other given tags, use replace-all
.
In the following example, we're replacing the existing key-value pairs.
$ triton instance tag replace-all -w <container> foo=bar group=test
{
"foo": "bar",
"group": "test"
}