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 in the Classic Load Balancers Guide. For more information about Proxy Protocol, see Configure Proxy Protocol Support in the Classic Load Balancers Guide.
Parameters:
-
load_balancer_name
(AccessPointName)
–
The name of the load balancer.
-
instance_port
(EndPointPort)
–
The port number associated with the EC2 instance.
-
policy_names
(PolicyNames)
–
The names of the policies. If the list is empty, then all current polices are removed from the EC2 instance.
Raises:
Examples:
To replace the policies associated with a port for a backend instance
This example replaces the policies that are currently associated with the specified port.
>>> await client.set_load_balancer_policies_for_backend_server(load_balancer_name='my-load-balancer', instance_port=80, policy_names=['my-ProxyProtocol-policy'])
Source code in docs_src/capo_elastic_load_balancing/_services/async_elastic_load_balancing.py
| async def set_load_balancer_policies_for_backend_server(
self,
load_balancer_name: "capo_elastic_load_balancing.types.access_point_name.AccessPointName",
instance_port: "capo_elastic_load_balancing.types.end_point_port.EndPointPort",
policy_names: "capo_elastic_load_balancing.types.policy_names.PolicyNames",
*,
config_overrides: Optional[AsyncElasticLoadBalancingClientConfig] = None,
) -> "capo_elastic_load_balancing.types.set_load_balancer_policies_for_backend_server_output.SetLoadBalancerPoliciesForBackendServerOutput":
"""<p>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.</p> <p>Each time you use <code>SetLoadBalancerPoliciesForBackendServer</code> to enable the policies, use the <code>PolicyNames</code> parameter to list the policies that you want to enable.</p> <p>You can use <a>DescribeLoadBalancers</a> or <a>DescribeLoadBalancerPolicies</a> to verify that the policy is associated with the EC2 instance.</p> <p>For more information about enabling back-end instance authentication, see <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-create-https-ssl-load-balancer.html#configure_backendauth_clt">Configure Back-end Instance Authentication</a> in the <i>Classic Load Balancers Guide</i>. For more information about Proxy Protocol, see <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-proxy-protocol.html">Configure Proxy Protocol Support</a> in the <i>Classic Load Balancers Guide</i>.</p>
Args:
load_balancer_name: <p>The name of the load balancer.</p>
instance_port: <p>The port number associated with the EC2 instance.</p>
policy_names: <p>The names of the policies. If the list is empty, then all current polices are removed from the EC2 instance.</p>
Raises:
capo_elastic_load_balancing.errors.access_point_not_found_exception.AccessPointNotFoundException: <p>The specified load balancer does not exist.</p>
capo_elastic_load_balancing.errors.invalid_configuration_request_exception.InvalidConfigurationRequestException: <p>The requested configuration change is not valid.</p>
capo_elastic_load_balancing.errors.policy_not_found_exception.PolicyNotFoundException: <p>One or more of the specified policies do not exist.</p>
capo_elastic_load_balancing.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To replace the policies associated with a port for a backend instance
This example replaces the policies that are currently associated with the specified port.
>>> await client.set_load_balancer_policies_for_backend_server(load_balancer_name='my-load-balancer', instance_port=80, policy_names=['my-ProxyProtocol-policy'])
"""
async def _handler(
req: "AsyncOperationRequest[capo_elastic_load_balancing.types.set_load_balancer_policies_for_backend_server_input.SetLoadBalancerPoliciesForBackendServerInput]",
) -> AsyncOperationResponse[
"capo_elastic_load_balancing.types.set_load_balancer_policies_for_backend_server_output.SetLoadBalancerPoliciesForBackendServerOutput"
]:
import capo_elastic_load_balancing._operations.elastic_load_balancing_v7.set_load_balancer_policies_for_backend_server
(
output,
http_response,
) = await capo_elastic_load_balancing._operations.elastic_load_balancing_v7.set_load_balancer_policies_for_backend_server.async_set_load_balancer_policies_for_backend_server(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("SetLoadBalancerPoliciesForBackendServer"),
)
input_: capo_elastic_load_balancing.types.set_load_balancer_policies_for_backend_server_input.SetLoadBalancerPoliciesForBackendServerInput = {
"load_balancer_name": load_balancer_name,
"instance_port": instance_port,
"policy_names": policy_names,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|