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

*****************
connect_directory
*****************



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

  

  Creates an AD Connector to connect to a self-managed directory.

   

  Before you call ``ConnectDirectory``, ensure that all of the required permissions have been explicitly granted through a policy. For details about what permissions are required to run the ``ConnectDirectory`` operation, see `Directory Service API Permissions\: Actions, Resources, and Conditions Reference <http://docs.aws.amazon.com/directoryservice/latest/admin-guide/UsingWithDS_IAM_ResourcePermissions.html>`__.

  

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


  **Request Syntax**
  ::

    response = client.connect_directory(
        Name='string',
        ShortName='string',
        Password='string',
        Description='string',
        Size='Small'|'Large',
        ConnectSettings={
            'VpcId': 'string',
            'SubnetIds': [
                'string',
            ],
            'CustomerDnsIps': [
                'string',
            ],
            'CustomerDnsIpsV6': [
                'string',
            ],
            'CustomerUserName': 'string'
        },
        Tags=[
            {
                'Key': 'string',
                'Value': 'string'
            },
        ],
        NetworkType='Dual-stack'|'IPv4'|'IPv6'
    )
    
  :type Name: string
  :param Name: **[REQUIRED]** 

    The fully qualified name of your self-managed directory, such as ``corp.example.com``.

    

  
  :type ShortName: string
  :param ShortName: 

    The NetBIOS name of your self-managed directory, such as ``CORP``.

    

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

    The password for your self-managed user account.

    

  
  :type Description: string
  :param Description: 

    A description for the directory.

    

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

    The size of the directory.

    

  
  :type ConnectSettings: dict
  :param ConnectSettings: **[REQUIRED]** 

    A  DirectoryConnectSettings object that contains additional information for the operation.

    

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

      The identifier of the VPC in which the AD Connector is created.

      

    
    - **SubnetIds** *(list) --* **[REQUIRED]** 

      A list of subnet identifiers in the VPC in which the AD Connector is created.

      

    
      - *(string) --* 

      
  
    - **CustomerDnsIps** *(list) --* 

      The IP addresses of DNS servers or domain controllers in your self-managed directory.

      

    
      - *(string) --* 

      
  
    - **CustomerDnsIpsV6** *(list) --* 

      The IPv6 addresses of DNS servers or domain controllers in your self-managed directory.

      

    
      - *(string) --* 

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

      The user name of an account in your self-managed directory that is used to connect to the directory. This account must have the following permissions:

       

      
      * Read users and groups
       
      * Create computer objects
       
      * Join computers to the domain
      

      

    
  
  :type Tags: list
  :param Tags: 

    The tags to be assigned to AD Connector.

    

  
    - *(dict) --* 

      Metadata assigned to a directory consisting of a key-value pair.

      

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

        Required name of the tag. The string value can be Unicode characters and cannot be prefixed with "aws:". The string can contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-', ':', '@'(Java regex: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-]*)$").

        

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

        The optional value of the tag. The string value can be Unicode characters. The string can contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-', ':', '@' (Java regex: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-]*)$").

        

      
    

  :type NetworkType: string
  :param NetworkType: 

    The network type for your directory. The default value is ``IPv4`` or ``IPv6`` based on the provided subnet capabilities.

    

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

    
    ::

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

    

    - *(dict) --* 

      Contains the results of the  ConnectDirectory operation.

      
      

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

        The identifier of the new directory.

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

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

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

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

  