There are more AWS SDK examples available in the AWS Doc SDK Examples
Use SetLoadBalancerPoliciesForBackendServer with a CLI
The following code examples show how to use SetLoadBalancerPoliciesForBackendServer.
- CLI
-
- AWS CLI
-
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.
Command:
aws elb set-load-balancer-policies-for-backend-server --load-balancer-namemy-load-balancer--instance-port80--policy-namesmy-ProxyProtocol-policyTo remove all policies that are currently associated with a port on your backend instance
This example removes all policies associated with the specified port.
Command:
aws elb set-load-balancer-policies-for-backend-server --load-balancer-namemy-load-balancer--instance-port80--policy-names[]To confirm that the policies are removed, use the
describe-load-balancer-policiescommand.-
For API details, see SetLoadBalancerPoliciesForBackendServer
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example replaces the policies for the specified port with the specified policy.
Set-ELBLoadBalancerPolicyForBackendServer -LoadBalancerName my-load-balancer -InstancePort 80 -PolicyName my-ProxyProtocol-policyExample 2: This example removes all policies associated with the specified port.
Set-ELBLoadBalancerPolicyForBackendServer -LoadBalancerName my-load-balancer -InstancePort 80-
For API details, see SetLoadBalancerPoliciesForBackendServer in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: This example replaces the policies for the specified port with the specified policy.
Set-ELBLoadBalancerPolicyForBackendServer -LoadBalancerName my-load-balancer -InstancePort 80 -PolicyName my-ProxyProtocol-policyExample 2: This example removes all policies associated with the specified port.
Set-ELBLoadBalancerPolicyForBackendServer -LoadBalancerName my-load-balancer -InstancePort 80-
For API details, see SetLoadBalancerPoliciesForBackendServer in AWS Tools for PowerShell Cmdlet Reference (V5).
-