:doc:`Organizations <../../organizations>` / Client / tag_resource

************
tag_resource
************



.. py:method:: Organizations.Client.tag_resource(**kwargs)

  

  Adds one or more tags to the specified resource.

   

  Currently, you can attach tags to the following resources in Organizations.

   

  
  * Amazon Web Services account
   
  * Organization root
   
  * Organizational unit (OU)
   
  * Policy (any type)
  

   

  You can only call this operation from the management account or a member account that is a delegated administrator.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/TagResource>`_  


  **Request Syntax**
  ::

    response = client.tag_resource(
        ResourceId='string',
        Tags=[
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    )
    
  :type ResourceId: string
  :param ResourceId: **[REQUIRED]** 

    The ID of the resource to add a tag to.

     

    You can specify any of the following taggable resources.

     

    
    * Amazon Web Services account – specify the account ID number.
     
    * Organizational unit – specify the OU ID that begins with ``ou-`` and looks similar to: ``ou-1a2b-34uvwxyz``
     
    * Root – specify the root ID that begins with ``r-`` and looks similar to: ``r-1a2b``
     
    * Policy – specify the policy ID that begins with ``p-`` andlooks similar to: ``p-12abcdefg3``
    

    

  
  :type Tags: list
  :param Tags: **[REQUIRED]** 

    A list of tags to add to the specified resource.

     

    For each tag in the list, you must specify both a tag key and a value. The value can be an empty string, but you can't set it to ``null``.

     

    .. note::

      

      If any one of the tags is not valid or if you exceed the maximum allowed number of tags for a resource, then the entire request fails.

      

    

  
    - *(dict) --* 

      A custom key-value pair associated with a resource within your organization.

       

      You can attach tags to any of the following organization resources.

       

      
      * Amazon Web Services account
       
      * Organizational unit (OU)
       
      * Organization root
       
      * Policy
      

      

    
      - **Key** *(string) --* **[REQUIRED]** 

        The key identifier, or name, of the tag.

        

      
      - **Value** *(string) --* **[REQUIRED]** 

        The string value that's associated with the key of the tag. You can set the value of a tag to an empty string, but you can't set the value of a tag to null.

        

      
    

  
  :returns: None
  **Exceptions**
  
  *   :py:class:`Organizations.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`Organizations.Client.exceptions.ConcurrentModificationException`

  
  *   :py:class:`Organizations.Client.exceptions.AWSOrganizationsNotInUseException`

  
  *   :py:class:`Organizations.Client.exceptions.TargetNotFoundException`

  
  *   :py:class:`Organizations.Client.exceptions.ConstraintViolationException`

  
  *   :py:class:`Organizations.Client.exceptions.InvalidInputException`

  
  *   :py:class:`Organizations.Client.exceptions.ServiceException`

  
  *   :py:class:`Organizations.Client.exceptions.TooManyRequestsException`

  