:doc:`IoT <../../iot>` / Client / create_role_alias

*****************
create_role_alias
*****************



.. py:method:: IoT.Client.create_role_alias(**kwargs)

  

  Creates a role alias.

   

  Requires permission to access the `CreateRoleAlias <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions>`__ action.

   

  .. warning::

     

    The value of `credentialDurationSeconds <https://docs.aws.amazon.com/iot/latest/apireference/API_CreateRoleAlias.html#iot-CreateRoleAlias-request-credentialDurationSeconds>`__ must be less than or equal to the maximum session duration of the IAM role that the role alias references. For more information, see `Modifying a role maximum session duration (Amazon Web Services API) <https://docs.aws.amazon.com/IAM/latest/UserGuide/roles-managingrole-editing-api.html#roles-modify_max-session-duration-api>`__ from the Amazon Web Services Identity and Access Management User Guide.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iot-2015-05-28/CreateRoleAlias>`_  


  **Request Syntax**
  ::

    response = client.create_role_alias(
        roleAlias='string',
        roleArn='string',
        credentialDurationSeconds=123,
        tags=[
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    )
    
  :type roleAlias: string
  :param roleAlias: **[REQUIRED]** 

    The role alias that points to a role ARN. This allows you to change the role without having to update the device.

    

  
  :type roleArn: string
  :param roleArn: **[REQUIRED]** 

    The role ARN.

    

  
  :type credentialDurationSeconds: integer
  :param credentialDurationSeconds: 

    How long (in seconds) the credentials will be valid. The default value is 3,600 seconds.

     

    This value must be less than or equal to the maximum session duration of the IAM role that the role alias references.

    

  
  :type tags: list
  :param tags: 

    Metadata which can be used to manage the role alias.

     

    .. note::

      

      For URI Request parameters use format: ...key1=value1&key2=value2...

       

      For the CLI command-line parameter use format: &&tags "key1=value1&key2=value2..."

       

      For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."

      

    

  
    - *(dict) --* 

      A set of key/value pairs that are used to manage the resource.

      

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

        The tag's key.

        

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

        The tag's value.

        

      
    

  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'roleAlias': 'string',
          'roleAliasArn': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **roleAlias** *(string) --* 

        The role alias.

        
      

      - **roleAliasArn** *(string) --* 

        The role alias ARN.

        
  
  **Exceptions**
  
  *   :py:class:`IoT.Client.exceptions.ResourceAlreadyExistsException`

  
  *   :py:class:`IoT.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`IoT.Client.exceptions.LimitExceededException`

  
  *   :py:class:`IoT.Client.exceptions.ThrottlingException`

  
  *   :py:class:`IoT.Client.exceptions.UnauthorizedException`

  
  *   :py:class:`IoT.Client.exceptions.ServiceUnavailableException`

  
  *   :py:class:`IoT.Client.exceptions.InternalFailureException`

  