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

  1. Click inside the dashboard of the resource whose tags you want to get information about to make checkboxes appear.

  2. Check the box of the resource whose tags you want to get information about.
    The resource is selected and an action menu appears.

  3. Click IconTag 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.

Request sample
$ 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.

The ReadTags command returns the following elements:

  • ResponseContext: Information about the context of the response.

  • Tags: Information about one or more tags.

Result sample
{
  "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

To get information about tags associated with your resources, use the describe-tags command following this syntax:

Request sample
$ 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.

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.

Result sample
{
    "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.