:doc:`ComputeOptimizerAutomation <../../compute-optimizer-automation>` / Client / associate_accounts

******************
associate_accounts
******************



.. py:method:: ComputeOptimizerAutomation.Client.associate_accounts(**kwargs)

  

  Associates one or more member accounts with your organization's management account, enabling centralized implementation of optimization actions across those accounts. Once associated, the management account (or a delegated administrator) can apply recommended actions to the member account. When you associate a member account, its organization rule mode is automatically set to "Any allowed," which permits the management account to create Automation rules that automatically apply actions to that account. If the member account has not previously enabled the Automation feature, the association process automatically enables it.

   

  .. note::

    

    Only the management account or a delegated administrator can perform this action.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/compute-optimizer-automation-2025-09-22/AssociateAccounts>`_  


  **Request Syntax**
  ::

    response = client.associate_accounts(
        accountIds=[
            'string',
        ],
        clientToken='string'
    )
    
  :type accountIds: list
  :param accountIds: **[REQUIRED]** 

    The IDs of the member accounts to associate. You can specify up to 50 account IDs.

    

  
    - *(string) --* 

    

  :type clientToken: string
  :param clientToken: 

    A unique identifier to ensure idempotency of the request. Valid for 24 hours after creation.

    This field is autopopulated if not provided.

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

    
    ::

      {
          'accountIds': [
              'string',
          ],
          'errors': [
              'string',
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **accountIds** *(list) --* 

        The IDs of the member accounts that were successfully associated.

        
        

        - *(string) --* 
    
      

      - **errors** *(list) --* 

        Any errors that occurred during the association process.

        
        

        - *(string) --* 
    
  
  **Exceptions**
  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.InvalidParameterValueException`

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.ForbiddenException`

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.OptInRequiredException`

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.IdempotentParameterMismatchException`

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

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

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

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.NotManagementAccountException`

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

  
  *   :py:class:`ComputeOptimizerAutomation.Client.exceptions.IdempotencyTokenInUseException`

  