HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/doc/awscli/examples/ec2/describe-tags.rst
**Example 1: To describe all tags for a single resource**

The following ``describe-tags`` example describes the tags for the specified instance. ::

    aws ec2 describe-tags \
        --filters "Name=resource-id,Values=i-1234567890abcdef8"

Output::

    {
        "Tags": [
            {
                "ResourceType": "instance",
                "ResourceId": "i-1234567890abcdef8",
                "Value": "Test",
                "Key": "Stack"
            },
            {
                "ResourceType": "instance",
                "ResourceId": "i-1234567890abcdef8",
                "Value": "Beta Server",
                "Key": "Name"
            }
        ]
    }

**Example 2: To describe all tags for a resource type**

The following ``describe-tags`` example describes the tags for your volumes. ::

    aws ec2 describe-tags \
        --filters "Name=resource-type,Values=volume"

Output::

    {
        "Tags": [
            {
                "ResourceType": "volume",
                "ResourceId": "vol-1234567890abcdef0",
                "Value": "Project1",
                "Key": "Purpose"
            },
            {
                "ResourceType": "volume",
                "ResourceId": "vol-049df61146c4d7901",
                "Value": "Logs",
                "Key": "Purpose"
            }
        ]
    }

**Example 3: To describe all your tags**

The following ``describe-tags`` example describes the tags for all your resources. ::

    aws ec2 describe-tags

**Example 4: To describe the tags for your resources based on a tag key**

The following ``describe-tags`` example describes the tags for your resources that have a tag with the key ``Stack``. ::

    aws ec2 describe-tags \
        --filters Name=key,Values=Stack

Output::

    {
        "Tags": [
            {
                "ResourceType": "volume",
                "ResourceId": "vol-027552a73f021f3b",
                "Value": "Production",
                "Key": "Stack"
            },
            {
                "ResourceType": "instance",
                "ResourceId": "i-1234567890abcdef8",
                "Value": "Test",
                "Key": "Stack"
            }
        ]
    }

**Example 5: To describe the tags for your resources based on a tag key and tag value**

The following ``describe-tags`` example describes the tags for your resources that have the tag ``Stack=Test``. ::

    aws ec2 describe-tags \
        --filters Name=key,Values=Stack Name=value,Values=Test

Output::

  {
      "Tags": [
          {
              "ResourceType": "image",
              "ResourceId": "ami-3ac336533f021f3bd",
              "Value": "Test",
              "Key": "Stack"
          },
          {
              "ResourceType": "instance",
              "ResourceId": "i-1234567890abcdef8",
              "Value": "Test",
              "Key": "Stack"
          }
      ]
  }

The following ``describe-tags`` example uses alternate syntax to describe resources with the tag ``Stack=Test``. ::

    aws ec2 describe-tags \
        --filters "Name=tag:Stack,Values=Test"

The following ``describe-tags`` example describes the tags for all your instances that have a tag with the key ``Purpose`` and no value. ::

    aws ec2 describe-tags \
        --filters "Name=resource-type,Values=instance" "Name=key,Values=Purpose" "Name=value,Values="

Output::

  {
      "Tags": [
          {
              "ResourceType": "instance", 
              "ResourceId": "i-1234567890abcdef5", 
              "Value": null, 
              "Key": "Purpose"
          }
      ]
  }