Use SetLoadBalancerPoliciesOfListener with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use SetLoadBalancerPoliciesOfListener with a CLI

The following code examples show how to use SetLoadBalancerPoliciesOfListener.

CLI
AWS CLI

To replace the policies associated with a listener

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

Command:

aws elb set-load-balancer-policies-of-listener --load-balancer-name my-load-balancer --load-balancer-port 443 --policy-names my-SSLNegotiation-policy

To remove all policies associated with your listener

This example removes all policies that are currently associated with the specified listener.

Command:

aws elb set-load-balancer-policies-of-listener --load-balancer-name my-load-balancer --load-balancer-port 443 --policy-names []

To confirm that the policies are removed from the load balancer, use the describe-load-balancer-policies command.

PowerShell
Tools for PowerShell

Example 1: This example replaces the policies for the specified listener with the specified policy.

Set-ELBLoadBalancerPolicyOfListener -LoadBalancerName my-load-balancer -LoadBalancerPort 443 -PolicyName my-SSLNegotiation-policy

Example 2: This example removes all policies associated with the specified listener.

Set-ELBLoadBalancerPolicyOfListener -LoadBalancerName my-load-balancer -LoadBalancerPort 443