:doc:`ElasticLoadBalancing <../../elb>` / Client / attach_load_balancer_to_subnets

*******************************
attach_load_balancer_to_subnets
*******************************



.. py:method:: ElasticLoadBalancing.Client.attach_load_balancer_to_subnets(**kwargs)

  

  Adds one or more subnets to the set of configured subnets for the specified load balancer.

   

  The load balancer evenly distributes requests across all registered subnets. For more information, see `Add or Remove Subnets for Your Load Balancer in a VPC <https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-manage-subnets.html>`__ in the *Classic Load Balancers Guide*.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/AttachLoadBalancerToSubnets>`_  


  **Request Syntax**
  ::

    response = client.attach_load_balancer_to_subnets(
        LoadBalancerName='string',
        Subnets=[
            'string',
        ]
    )
    
  :type LoadBalancerName: string
  :param LoadBalancerName: **[REQUIRED]** 

    The name of the load balancer.

    

  
  :type Subnets: list
  :param Subnets: **[REQUIRED]** 

    The IDs of the subnets to add. You can add only one subnet per Availability Zone.

    

  
    - *(string) --* 

    

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

    
    ::

      {
          'Subnets': [
              'string',
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 

      Contains the output of AttachLoadBalancerToSubnets.

      
      

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

        The IDs of the subnets attached to the load balancer.

        
        

        - *(string) --* 
    
  
  **Exceptions**
  
  *   :py:class:`ElasticLoadBalancing.Client.exceptions.AccessPointNotFoundException`

  
  *   :py:class:`ElasticLoadBalancing.Client.exceptions.InvalidConfigurationRequestException`

  
  *   :py:class:`ElasticLoadBalancing.Client.exceptions.SubnetNotFoundException`

  
  *   :py:class:`ElasticLoadBalancing.Client.exceptions.InvalidSubnetException`

  

  **Examples**

  This example adds the specified subnet to the set of configured subnets for the specified load balancer.
  ::

    response = client.attach_load_balancer_to_subnets(
        LoadBalancerName='my-load-balancer',
        Subnets=[
            'subnet-0ecac448',
        ],
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'Subnets': [
            'subnet-15aaab61',
            'subnet-0ecac448',
        ],
        'ResponseMetadata': {
            '...': '...',
        },
    }

  