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

*********************************************
set_load_balancer_policies_for_backend_server
*********************************************



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

  

  Replaces the set of policies associated with the specified port on which the EC2 instance is listening with a new set of policies. At this time, only the back-end server authentication policy type can be applied to the instance ports; this policy type is composed of multiple public key policies.

   

  Each time you use ``SetLoadBalancerPoliciesForBackendServer`` to enable the policies, use the ``PolicyNames`` parameter to list the policies that you want to enable.

   

  You can use  DescribeLoadBalancers or  DescribeLoadBalancerPolicies to verify that the policy is associated with the EC2 instance.

   

  For more information about enabling back-end instance authentication, see `Configure Back-end Instance Authentication <https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-create-https-ssl-load-balancer.html#configure_backendauth_clt>`__ in the *Classic Load Balancers Guide*. For more information about Proxy Protocol, see `Configure Proxy Protocol Support <https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-proxy-protocol.html>`__ in the *Classic Load Balancers Guide*.

  

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


  **Request Syntax**
  ::

    response = client.set_load_balancer_policies_for_backend_server(
        LoadBalancerName='string',
        InstancePort=123,
        PolicyNames=[
            'string',
        ]
    )
    
  :type LoadBalancerName: string
  :param LoadBalancerName: **[REQUIRED]** 

    The name of the load balancer.

    

  
  :type InstancePort: integer
  :param InstancePort: **[REQUIRED]** 

    The port number associated with the EC2 instance.

    

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

    The names of the policies. If the list is empty, then all current polices are removed from the EC2 instance.

    

  
    - *(string) --* 

    

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

    
    ::

      {}
      
    **Response Structure**

    

    - *(dict) --* 

      Contains the output of SetLoadBalancerPoliciesForBackendServer.

      
  
  **Exceptions**
  
  *   :py:class:`ElasticLoadBalancing.Client.exceptions.AccessPointNotFoundException`

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

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

  

  **Examples**

  This example replaces the policies that are currently associated with the specified port.
  ::

    response = client.set_load_balancer_policies_for_backend_server(
        InstancePort=80,
        LoadBalancerName='my-load-balancer',
        PolicyNames=[
            'my-ProxyProtocol-policy',
        ],
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'ResponseMetadata': {
            '...': '...',
        },
    }

  