:doc:`DirectoryService <../../ds>` / Client / create_alias

************
create_alias
************



.. py:method:: DirectoryService.Client.create_alias(**kwargs)

  

  Creates an alias for a directory and assigns the alias to the directory. The alias is used to construct the access URL for the directory, such as ``http://<alias>.awsapps.com``.

   

  .. warning::

     

    After an alias has been created, it cannot be deleted or reused, so this operation should only be used when absolutely necessary.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/CreateAlias>`_  


  **Request Syntax**
  ::

    response = client.create_alias(
        DirectoryId='string',
        Alias='string'
    )
    
  :type DirectoryId: string
  :param DirectoryId: **[REQUIRED]** 

    The identifier of the directory for which to create the alias.

    

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

    The requested alias.

     

    The alias must be unique amongst all aliases in Amazon Web Services. This operation throws an ``EntityAlreadyExistsException`` error if the alias already exists.

    

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

    
    ::

      {
          'DirectoryId': 'string',
          'Alias': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 

      Contains the results of the  CreateAlias operation.

      
      

      - **DirectoryId** *(string) --* 

        The identifier of the directory.

        
      

      - **Alias** *(string) --* 

        The alias for the directory.

        
  
  **Exceptions**
  
  *   :py:class:`DirectoryService.Client.exceptions.EntityAlreadyExistsException`

  
  *   :py:class:`DirectoryService.Client.exceptions.EntityDoesNotExistException`

  
  *   :py:class:`DirectoryService.Client.exceptions.InvalidParameterException`

  
  *   :py:class:`DirectoryService.Client.exceptions.ClientException`

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

  