Getting Information About Tags Associated with a Resource
You can get information about tags associated with a resource.
In the case of a virtual machine (VM), you can also get information about associated tags from within the VM itself. For more information, see Accessing the Metadata and User Data of a VM.
Getting Information About Your Tags Using Cockpit v2
-
Check the box of the resource whose tags you want to get information about.
The resource is selected. -
Click Edit Tags.
The EDIT TAGS dialog box appears with all the tags associated with the selected resource.
Getting Information About Your Tags Using OSC CLI
The ReadTags command lists one or more tags for your resources.
$ osc-cli api ReadTags --profile "default" \
--Filters '{
"ResourceTypes": ["snapshot"],
"Keys": ["key1"]
}'
This command contains the following attributes that you need to specify:
-
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
Filters
: (optional) One or more filters.-
Keys
: (optional) The keys of the tags that are assigned to the resources. You can use this filter alongside theValues
filter. In that case, you filter the resources corresponding to each tag, regardless of the other filter. -
ResourceIds
: (optional) The IDs of the resources with which the tags are associated. -
ResourceTypes
: (optional) The resource type (vm
|image
|volume
|snapshot
|public-ip
|security-group
|route-table
|nic
|net
|subnet
|net-peering
|net-access-point
|nat-service
|internet-service
|client-gateway
|virtual-gateway
|vpn-connection
|dhcp-options
|task
). -
Values
: (optional) The values of the tags that are assigned to the resources. You can use this filter alongside theTagKeys
filter. In that case, you filter the resources corresponding to each tag, regardless of the other filter.
-
-
NextPageToken
: (optional) The token to request the next page of results. Each token refers to a specific page. -
ResultsPerPage
: (optional) The maximum number of logs returned in a single response (between1
and1000
, both included). By default,100
.
The ReadTags command returns the following elements:
-
NextPageToken
: The token to request the next page of results. Each token refers to a specific page. -
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
-
Tags
: Information about one or more tags.-
Key
: The key of the tag, with a minimum of 1 character. -
ResourceId
: The ID of the resource. -
ResourceType
: The type of the resource. -
Value
: The value of the tag, between 0 and 255 characters.
-
{
"Tags": [
{
"Value": "value1",
"ResourceType": "snapshot",
"ResourceId": "snap-12345678",
"Key": "key1"
}
],
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Getting Information About Your Tags Using oapi-cli
The ReadTags command lists one or more tags for your resources.
$ oapi-cli --profile "default" ReadTags \
--Filters '{
"ResourceTypes": ["snapshot"],
"Keys": ["key1"]
}'
This command contains the following attributes that you need to specify:
-
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
Filters
: (optional) One or more filters.-
Keys
: (optional) The keys of the tags that are assigned to the resources. You can use this filter alongside theValues
filter. In that case, you filter the resources corresponding to each tag, regardless of the other filter. -
ResourceIds
: (optional) The IDs of the resources with which the tags are associated. -
ResourceTypes
: (optional) The resource type (vm
|image
|volume
|snapshot
|public-ip
|security-group
|route-table
|nic
|net
|subnet
|net-peering
|net-access-point
|nat-service
|internet-service
|client-gateway
|virtual-gateway
|vpn-connection
|dhcp-options
|task
). -
Values
: (optional) The values of the tags that are assigned to the resources. You can use this filter alongside theTagKeys
filter. In that case, you filter the resources corresponding to each tag, regardless of the other filter.
-
-
NextPageToken
: (optional) The token to request the next page of results. Each token refers to a specific page. -
ResultsPerPage
: (optional) The maximum number of logs returned in a single response (between1
and1000
, both included). By default,100
.
The ReadTags command returns the following elements:
-
NextPageToken
: The token to request the next page of results. Each token refers to a specific page. -
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
-
Tags
: Information about one or more tags.-
Key
: The key of the tag, with a minimum of 1 character. -
ResourceId
: The ID of the resource. -
ResourceType
: The type of the resource. -
Value
: The value of the tag, between 0 and 255 characters.
-
{
"Tags": [
{
"Value": "value1",
"ResourceType": "snapshot",
"ResourceId": "snap-12345678",
"Key": "key1"
}
],
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Getting Information About Your Tags Using AWS CLI
Before you begin: Install and configure AWS CLI. For more information, see Installing and Configuring AWS CLI. |
To get information about tags associated with your resources, use the describe-tags command following this syntax:
$ aws ec2 describe-tags \
--profile YOUR_PROFILE \
--filters Name=resource-id,Values=i-12345678 \
--endpoint https://fcu.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
(optional)
filters
: One or more filters, in the "Name=X,Values=Y" format.You can specify several values for a same filter using the "Name=X,Values=Y, Z" format.
The following filters are available:
-
key
: The key of the tags. -
resource-id
: The ID of the resource. -
resource-type
: The resource type (instance
|image
|volume
|snapshot
|public-ip
|security-group
|route-table
|network-interface
|vpc
|subnet
|network-link
|vpc-endpoint
|nat-gateway
|internet-gateway
|customer-gateway
|vpn-gateway
|vpn-connection
|dhcp-options
|task
). -
value
: The value of the tags.If you use this filter and set it to an empty string, you get information about all your tags with a value set to an empty string.
-
-
endpoint
: The endpoint corresponding to the Region you want to send the request to. For more information, see Installing and Configuring AWS CLI.
The describe-tags command returns the following elements:
-
Tags
: The tags associated to the resources.-
ResourceType
: The resource type. -
ResourceId
: The ID of the resource. -
Value
: The value of the tags. -
Key
: The key of the tags.
-
{
"Tags": [
{
"ResourceType": "instance",
"ResourceId": "i-12345678",
"Value": "Production",
"Key": "Stack"
},
{
"ResourceType": "instance",
"ResourceId": "i-12345678",
"Value": "Beta Server",
"Key": "Name"
}
]
}
Related Pages
Corresponding API Methods
AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.