:doc:`LicenseManagerUserSubscriptions <../../license-manager-user-subscriptions>` / Client / associate_user

**************
associate_user
**************



.. py:method:: LicenseManagerUserSubscriptions.Client.associate_user(**kwargs)

  

  Associates the user to an EC2 instance to utilize user-based subscriptions.

   

  .. note::

    

    Your estimated bill for charges on the number of users and related costs will take 48 hours to appear for billing periods that haven't closed (marked as **Pending** billing status) in Amazon Web Services Billing. For more information, see `Viewing your monthly charges <https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/invoice.html>`__ in the *Amazon Web Services Billing User Guide*.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/license-manager-user-subscriptions-2018-05-10/AssociateUser>`_  


  **Request Syntax**
  ::

    response = client.associate_user(
        Username='string',
        InstanceId='string',
        IdentityProvider={
            'ActiveDirectoryIdentityProvider': {
                'DirectoryId': 'string',
                'ActiveDirectorySettings': {
                    'DomainName': 'string',
                    'DomainIpv4List': [
                        'string',
                    ],
                    'DomainIpv6List': [
                        'string',
                    ],
                    'DomainCredentialsProvider': {
                        'SecretsManagerCredentialsProvider': {
                            'SecretId': 'string'
                        }
                    },
                    'DomainNetworkSettings': {
                        'Subnets': [
                            'string',
                        ]
                    }
                },
                'ActiveDirectoryType': 'SELF_MANAGED'|'AWS_MANAGED',
                'IsSharedActiveDirectory': True|False
            }
        },
        Domain='string',
        Tags={
            'string': 'string'
        }
    )
    
  :type Username: string
  :param Username: **[REQUIRED]** 

    The user name from the identity provider.

    

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

    The ID of the EC2 instance that provides the user-based subscription.

    

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

    The identity provider for the user.

    .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``ActiveDirectoryIdentityProvider``. 

  
    - **ActiveDirectoryIdentityProvider** *(dict) --* 

      The ``ActiveDirectoryIdentityProvider`` resource contains settings and other details about a specific Active Directory identity provider.

      

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

        The directory ID for an Active Directory identity provider.

        

      
      - **ActiveDirectorySettings** *(dict) --* 

        The ``ActiveDirectorySettings`` resource contains details about the Active Directory, including network access details such as domain name and IP addresses, and the credential provider for user administration.

        

      
        - **DomainName** *(string) --* 

          The domain name for the Active Directory.

          

        
        - **DomainIpv4List** *(list) --* 

          A list of domain IPv4 addresses that are used for the Active Directory.

          

        
          - *(string) --* 

          
      
        - **DomainIpv6List** *(list) --* 

          A list of domain IPv6 addresses that are used for the Active Directory.

          

        
          - *(string) --* 

          
      
        - **DomainCredentialsProvider** *(dict) --* 

          Points to the ``CredentialsProvider`` resource that contains information about the credential provider for user administration.

          .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``SecretsManagerCredentialsProvider``. 

        
          - **SecretsManagerCredentialsProvider** *(dict) --* 

            Identifies the Secrets Manager secret that contains credentials needed for user administration in the Active Directory.

            

          
            - **SecretId** *(string) --* 

              The ID of the Secrets Manager secret that contains credentials.

              

            
          
        
        - **DomainNetworkSettings** *(dict) --* 

          The ``DomainNetworkSettings`` resource contains an array of subnets that apply for the Active Directory.

          

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

            Contains a list of subnets that apply for the Active Directory domain.

            

          
            - *(string) --* 

            
        
        
      
      - **ActiveDirectoryType** *(string) --* 

        The type of Active Directory – either a self-managed Active Directory or an Amazon Web Services Managed Active Directory.

        

      
      - **IsSharedActiveDirectory** *(boolean) --* 

        Whether this directory is shared from an Amazon Web Services Managed Active Directory. The default value is false.

        

      
    
  
  :type Domain: string
  :param Domain: 

    The domain name of the Active Directory that contains information for the user to associate.

    

  
  :type Tags: dict
  :param Tags: 

    The tags that apply for the user association.

    

  
    - *(string) --* 

    
      - *(string) --* 

      


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

    
    ::

      {
          'InstanceUserSummary': {
              'Username': 'string',
              'InstanceId': 'string',
              'IdentityProvider': {
                  'ActiveDirectoryIdentityProvider': {
                      'DirectoryId': 'string',
                      'ActiveDirectorySettings': {
                          'DomainName': 'string',
                          'DomainIpv4List': [
                              'string',
                          ],
                          'DomainIpv6List': [
                              'string',
                          ],
                          'DomainCredentialsProvider': {
                              'SecretsManagerCredentialsProvider': {
                                  'SecretId': 'string'
                              }
                          },
                          'DomainNetworkSettings': {
                              'Subnets': [
                                  'string',
                              ]
                          }
                      },
                      'ActiveDirectoryType': 'SELF_MANAGED'|'AWS_MANAGED',
                      'IsSharedActiveDirectory': True|False
                  }
              },
              'Status': 'string',
              'InstanceUserArn': 'string',
              'StatusMessage': 'string',
              'Domain': 'string',
              'AssociationDate': 'string',
              'DisassociationDate': 'string'
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **InstanceUserSummary** *(dict) --* 

        Metadata that describes the associate user operation.

        
        

        - **Username** *(string) --* 

          The user name from the identity provider for the user.

          
        

        - **InstanceId** *(string) --* 

          The ID of the EC2 instance that provides user-based subscriptions.

          
        

        - **IdentityProvider** *(dict) --* 

          The ``IdentityProvider`` resource specifies details about the identity provider.

          .. note::    This is a Tagged Union structure. Only one of the     following top level keys will be set: ``ActiveDirectoryIdentityProvider``.     If a client receives an unknown member it will     set ``SDK_UNKNOWN_MEMBER`` as the top level key,     which maps to the name or tag of the unknown     member. The structure of ``SDK_UNKNOWN_MEMBER`` is     as follows::

                    'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}


        
          

          - **ActiveDirectoryIdentityProvider** *(dict) --* 

            The ``ActiveDirectoryIdentityProvider`` resource contains settings and other details about a specific Active Directory identity provider.

            
            

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

              The directory ID for an Active Directory identity provider.

              
            

            - **ActiveDirectorySettings** *(dict) --* 

              The ``ActiveDirectorySettings`` resource contains details about the Active Directory, including network access details such as domain name and IP addresses, and the credential provider for user administration.

              
              

              - **DomainName** *(string) --* 

                The domain name for the Active Directory.

                
              

              - **DomainIpv4List** *(list) --* 

                A list of domain IPv4 addresses that are used for the Active Directory.

                
                

                - *(string) --* 
            
              

              - **DomainIpv6List** *(list) --* 

                A list of domain IPv6 addresses that are used for the Active Directory.

                
                

                - *(string) --* 
            
              

              - **DomainCredentialsProvider** *(dict) --* 

                Points to the ``CredentialsProvider`` resource that contains information about the credential provider for user administration.

                .. note::    This is a Tagged Union structure. Only one of the     following top level keys will be set: ``SecretsManagerCredentialsProvider``.     If a client receives an unknown member it will     set ``SDK_UNKNOWN_MEMBER`` as the top level key,     which maps to the name or tag of the unknown     member. The structure of ``SDK_UNKNOWN_MEMBER`` is     as follows::

                                'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}


              
                

                - **SecretsManagerCredentialsProvider** *(dict) --* 

                  Identifies the Secrets Manager secret that contains credentials needed for user administration in the Active Directory.

                  
                  

                  - **SecretId** *(string) --* 

                    The ID of the Secrets Manager secret that contains credentials.

                    
              
            
              

              - **DomainNetworkSettings** *(dict) --* 

                The ``DomainNetworkSettings`` resource contains an array of subnets that apply for the Active Directory.

                
                

                - **Subnets** *(list) --* 

                  Contains a list of subnets that apply for the Active Directory domain.

                  
                  

                  - *(string) --* 
              
            
          
            

            - **ActiveDirectoryType** *(string) --* 

              The type of Active Directory – either a self-managed Active Directory or an Amazon Web Services Managed Active Directory.

              
            

            - **IsSharedActiveDirectory** *(boolean) --* 

              Whether this directory is shared from an Amazon Web Services Managed Active Directory. The default value is false.

              
        
      
        

        - **Status** *(string) --* 

          The status of a user associated with an EC2 instance.

          
        

        - **InstanceUserArn** *(string) --* 

          The Amazon Resource Name (ARN) that identifies the instance user.

          
        

        - **StatusMessage** *(string) --* 

          The status message for users of an EC2 instance.

          
        

        - **Domain** *(string) --* 

          The domain name of the Active Directory that contains the user information for the product subscription.

          
        

        - **AssociationDate** *(string) --* 

          The date a user was associated with an EC2 instance.

          
        

        - **DisassociationDate** *(string) --* 

          The date a user was disassociated from an EC2 instance.

          
    
  
  **Exceptions**
  
  *   :py:class:`LicenseManagerUserSubscriptions.Client.exceptions.ServiceQuotaExceededException`

  
  *   :py:class:`LicenseManagerUserSubscriptions.Client.exceptions.ValidationException`

  
  *   :py:class:`LicenseManagerUserSubscriptions.Client.exceptions.ConflictException`

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

  
  *   :py:class:`LicenseManagerUserSubscriptions.Client.exceptions.InternalServerException`

  
  *   :py:class:`LicenseManagerUserSubscriptions.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`LicenseManagerUserSubscriptions.Client.exceptions.AccessDeniedException`

  