:doc:`AutoScaling <../../autoscaling>` / Client / create_or_update_tags

*********************
create_or_update_tags
*********************



.. py:method:: AutoScaling.Client.create_or_update_tags(**kwargs)

  

  Creates or updates tags for the specified Auto Scaling group.

   

  When you specify a tag with a key that already exists, the operation overwrites the previous tag definition, and you do not get an error message.

   

  For more information, see `Tag Auto Scaling groups and instances <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-tagging.html>`__ in the *Amazon EC2 Auto Scaling User Guide*.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateOrUpdateTags>`_  


  **Request Syntax**
  ::

    response = client.create_or_update_tags(
        Tags=[
            {
                'ResourceId': 'string',
                'ResourceType': 'string',
                'Key': 'string',
                'Value': 'string',
                'PropagateAtLaunch': True|False
            },
        ]
    )
    
  :type Tags: list
  :param Tags: **[REQUIRED]** 

    One or more tags.

    

  
    - *(dict) --* 

      Describes a tag for an Auto Scaling group.

      

    
      - **ResourceId** *(string) --* 

        The name of the Auto Scaling group.

        

      
      - **ResourceType** *(string) --* 

        The type of resource. The only supported value is ``auto-scaling-group``.

        

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

        The tag key.

        

      
      - **Value** *(string) --* 

        The tag value.

        

      
      - **PropagateAtLaunch** *(boolean) --* 

        Determines whether the tag is added to new instances as they are launched in the group.

        

      
    

  
  :returns: None
  **Exceptions**
  
  *   :py:class:`AutoScaling.Client.exceptions.LimitExceededFault`

  
  *   :py:class:`AutoScaling.Client.exceptions.AlreadyExistsFault`

  
  *   :py:class:`AutoScaling.Client.exceptions.ResourceContentionFault`

  
  *   :py:class:`AutoScaling.Client.exceptions.ResourceInUseFault`

  

  **Examples**

  This example adds two tags to the specified Auto Scaling group.
  ::

    response = client.create_or_update_tags(
        Tags=[
            {
                'Key': 'Role',
                'PropagateAtLaunch': True,
                'ResourceId': 'my-auto-scaling-group',
                'ResourceType': 'auto-scaling-group',
                'Value': 'WebServer',
            },
            {
                'Key': 'Dept',
                'PropagateAtLaunch': True,
                'ResourceId': 'my-auto-scaling-group',
                'ResourceType': 'auto-scaling-group',
                'Value': 'Research',
            },
        ],
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'ResponseMetadata': {
            '...': '...',
        },
    }

  