

There are more AWS SDK examples available in the [AWS Doc SDK Examples](https://github.com/awsdocs/aws-doc-sdk-examples) GitHub repo.

# Code examples for Elastic Load Balancing - Version 1 using AWS SDKs
<a name="elastic-load-balancing_code_examples"></a>

The following code examples show you how to use Elastic Load Balancing - Version 1 with an AWS software development kit (SDK).

*Actions* are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.

**More resources**
+  **[ Elastic Load Balancing - Version 1 User Guide](https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/introduction.html)** – More information about Elastic Load Balancing - Version 1.
+ **[Elastic Load Balancing - Version 1 API Reference](https://docs.aws.amazon.com/elasticloadbalancing/2012-06-01/APIReference/Welcome.html)** – Details about all available Elastic Load Balancing - Version 1 actions.
+ **[AWS Developer Center](https://aws.amazon.com/developer/code-examples/?awsf.sdk-code-examples-product=product%23)** – Code examples that you can filter by category or full-text search.
+ **[AWS SDK Examples](https://github.com/awsdocs/aws-doc-sdk-examples)** – GitHub repo with complete code in preferred languages. Includes instructions for setting up and running the code.

**Contents**
+ [Basics](elastic-load-balancing_code_examples_basics.md)
  + [Actions](elastic-load-balancing_code_examples_actions.md)
    + [`AddTags`](elastic-load-balancing_example_elastic-load-balancing_AddTags_section.md)
    + [`ApplySecurityGroupsToLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_ApplySecurityGroupsToLoadBalancer_section.md)
    + [`AttachLoadBalancerToSubnets`](elastic-load-balancing_example_elastic-load-balancing_AttachLoadBalancerToSubnets_section.md)
    + [`ConfigureHealthCheck`](elastic-load-balancing_example_elastic-load-balancing_ConfigureHealthCheck_section.md)
    + [`CreateAppCookieStickinessPolicy`](elastic-load-balancing_example_elastic-load-balancing_CreateAppCookieStickinessPolicy_section.md)
    + [`CreateLbCookieStickinessPolicy`](elastic-load-balancing_example_elastic-load-balancing_CreateLbCookieStickinessPolicy_section.md)
    + [`CreateLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_CreateLoadBalancer_section.md)
    + [`CreateLoadBalancerListeners`](elastic-load-balancing_example_elastic-load-balancing_CreateLoadBalancerListeners_section.md)
    + [`CreateLoadBalancerPolicy`](elastic-load-balancing_example_elastic-load-balancing_CreateLoadBalancerPolicy_section.md)
    + [`DeleteLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_DeleteLoadBalancer_section.md)
    + [`DeleteLoadBalancerListeners`](elastic-load-balancing_example_elastic-load-balancing_DeleteLoadBalancerListeners_section.md)
    + [`DeleteLoadBalancerPolicy`](elastic-load-balancing_example_elastic-load-balancing_DeleteLoadBalancerPolicy_section.md)
    + [`DeregisterInstancesFromLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_DeregisterInstancesFromLoadBalancer_section.md)
    + [`DescribeInstanceHealth`](elastic-load-balancing_example_elastic-load-balancing_DescribeInstanceHealth_section.md)
    + [`DescribeLoadBalancerAttributes`](elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancerAttributes_section.md)
    + [`DescribeLoadBalancerPolicies`](elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancerPolicies_section.md)
    + [`DescribeLoadBalancerPolicyTypes`](elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancerPolicyTypes_section.md)
    + [`DescribeLoadBalancers`](elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancers_section.md)
    + [`DescribeTags`](elastic-load-balancing_example_elastic-load-balancing_DescribeTags_section.md)
    + [`DetachLoadBalancerFromSubnets`](elastic-load-balancing_example_elastic-load-balancing_DetachLoadBalancerFromSubnets_section.md)
    + [`DisableAvailabilityZonesForLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_DisableAvailabilityZonesForLoadBalancer_section.md)
    + [`EnableAvailabilityZonesForLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_EnableAvailabilityZonesForLoadBalancer_section.md)
    + [`ModifyLoadBalancerAttributes`](elastic-load-balancing_example_elastic-load-balancing_ModifyLoadBalancerAttributes_section.md)
    + [`RegisterInstancesWithLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_RegisterInstancesWithLoadBalancer_section.md)
    + [`RemoveTags`](elastic-load-balancing_example_elastic-load-balancing_RemoveTags_section.md)
    + [`SetLoadBalancerListenerSslCertificate`](elastic-load-balancing_example_elastic-load-balancing_SetLoadBalancerListenerSslCertificate_section.md)
    + [`SetLoadBalancerPoliciesForBackendServer`](elastic-load-balancing_example_elastic-load-balancing_SetLoadBalancerPoliciesForBackendServer_section.md)
    + [`SetLoadBalancerPoliciesOfListener`](elastic-load-balancing_example_elastic-load-balancing_SetLoadBalancerPoliciesOfListener_section.md)

# Basic examples for Elastic Load Balancing - Version 1 using AWS SDKs
<a name="elastic-load-balancing_code_examples_basics"></a>

The following code examples show how to use the basics of Elastic Load Balancing - Version 1 with AWS SDKs. 

**Contents**
+ [Actions](elastic-load-balancing_code_examples_actions.md)
  + [`AddTags`](elastic-load-balancing_example_elastic-load-balancing_AddTags_section.md)
  + [`ApplySecurityGroupsToLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_ApplySecurityGroupsToLoadBalancer_section.md)
  + [`AttachLoadBalancerToSubnets`](elastic-load-balancing_example_elastic-load-balancing_AttachLoadBalancerToSubnets_section.md)
  + [`ConfigureHealthCheck`](elastic-load-balancing_example_elastic-load-balancing_ConfigureHealthCheck_section.md)
  + [`CreateAppCookieStickinessPolicy`](elastic-load-balancing_example_elastic-load-balancing_CreateAppCookieStickinessPolicy_section.md)
  + [`CreateLbCookieStickinessPolicy`](elastic-load-balancing_example_elastic-load-balancing_CreateLbCookieStickinessPolicy_section.md)
  + [`CreateLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_CreateLoadBalancer_section.md)
  + [`CreateLoadBalancerListeners`](elastic-load-balancing_example_elastic-load-balancing_CreateLoadBalancerListeners_section.md)
  + [`CreateLoadBalancerPolicy`](elastic-load-balancing_example_elastic-load-balancing_CreateLoadBalancerPolicy_section.md)
  + [`DeleteLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_DeleteLoadBalancer_section.md)
  + [`DeleteLoadBalancerListeners`](elastic-load-balancing_example_elastic-load-balancing_DeleteLoadBalancerListeners_section.md)
  + [`DeleteLoadBalancerPolicy`](elastic-load-balancing_example_elastic-load-balancing_DeleteLoadBalancerPolicy_section.md)
  + [`DeregisterInstancesFromLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_DeregisterInstancesFromLoadBalancer_section.md)
  + [`DescribeInstanceHealth`](elastic-load-balancing_example_elastic-load-balancing_DescribeInstanceHealth_section.md)
  + [`DescribeLoadBalancerAttributes`](elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancerAttributes_section.md)
  + [`DescribeLoadBalancerPolicies`](elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancerPolicies_section.md)
  + [`DescribeLoadBalancerPolicyTypes`](elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancerPolicyTypes_section.md)
  + [`DescribeLoadBalancers`](elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancers_section.md)
  + [`DescribeTags`](elastic-load-balancing_example_elastic-load-balancing_DescribeTags_section.md)
  + [`DetachLoadBalancerFromSubnets`](elastic-load-balancing_example_elastic-load-balancing_DetachLoadBalancerFromSubnets_section.md)
  + [`DisableAvailabilityZonesForLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_DisableAvailabilityZonesForLoadBalancer_section.md)
  + [`EnableAvailabilityZonesForLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_EnableAvailabilityZonesForLoadBalancer_section.md)
  + [`ModifyLoadBalancerAttributes`](elastic-load-balancing_example_elastic-load-balancing_ModifyLoadBalancerAttributes_section.md)
  + [`RegisterInstancesWithLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_RegisterInstancesWithLoadBalancer_section.md)
  + [`RemoveTags`](elastic-load-balancing_example_elastic-load-balancing_RemoveTags_section.md)
  + [`SetLoadBalancerListenerSslCertificate`](elastic-load-balancing_example_elastic-load-balancing_SetLoadBalancerListenerSslCertificate_section.md)
  + [`SetLoadBalancerPoliciesForBackendServer`](elastic-load-balancing_example_elastic-load-balancing_SetLoadBalancerPoliciesForBackendServer_section.md)
  + [`SetLoadBalancerPoliciesOfListener`](elastic-load-balancing_example_elastic-load-balancing_SetLoadBalancerPoliciesOfListener_section.md)

# Actions for Elastic Load Balancing - Version 1 using AWS SDKs
<a name="elastic-load-balancing_code_examples_actions"></a>

The following code examples demonstrate how to perform individual Elastic Load Balancing - Version 1 actions with AWS SDKs. Each example includes a link to GitHub, where you can find instructions for setting up and running the code. 

 The following examples include only the most commonly used actions. For a complete list, see the [Elastic Load Balancing - Version 1 API Reference](https://docs.aws.amazon.com/elasticloadbalancing/2012-06-01/APIReference/Welcome.html). 

**Topics**
+ [`AddTags`](elastic-load-balancing_example_elastic-load-balancing_AddTags_section.md)
+ [`ApplySecurityGroupsToLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_ApplySecurityGroupsToLoadBalancer_section.md)
+ [`AttachLoadBalancerToSubnets`](elastic-load-balancing_example_elastic-load-balancing_AttachLoadBalancerToSubnets_section.md)
+ [`ConfigureHealthCheck`](elastic-load-balancing_example_elastic-load-balancing_ConfigureHealthCheck_section.md)
+ [`CreateAppCookieStickinessPolicy`](elastic-load-balancing_example_elastic-load-balancing_CreateAppCookieStickinessPolicy_section.md)
+ [`CreateLbCookieStickinessPolicy`](elastic-load-balancing_example_elastic-load-balancing_CreateLbCookieStickinessPolicy_section.md)
+ [`CreateLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_CreateLoadBalancer_section.md)
+ [`CreateLoadBalancerListeners`](elastic-load-balancing_example_elastic-load-balancing_CreateLoadBalancerListeners_section.md)
+ [`CreateLoadBalancerPolicy`](elastic-load-balancing_example_elastic-load-balancing_CreateLoadBalancerPolicy_section.md)
+ [`DeleteLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_DeleteLoadBalancer_section.md)
+ [`DeleteLoadBalancerListeners`](elastic-load-balancing_example_elastic-load-balancing_DeleteLoadBalancerListeners_section.md)
+ [`DeleteLoadBalancerPolicy`](elastic-load-balancing_example_elastic-load-balancing_DeleteLoadBalancerPolicy_section.md)
+ [`DeregisterInstancesFromLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_DeregisterInstancesFromLoadBalancer_section.md)
+ [`DescribeInstanceHealth`](elastic-load-balancing_example_elastic-load-balancing_DescribeInstanceHealth_section.md)
+ [`DescribeLoadBalancerAttributes`](elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancerAttributes_section.md)
+ [`DescribeLoadBalancerPolicies`](elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancerPolicies_section.md)
+ [`DescribeLoadBalancerPolicyTypes`](elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancerPolicyTypes_section.md)
+ [`DescribeLoadBalancers`](elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancers_section.md)
+ [`DescribeTags`](elastic-load-balancing_example_elastic-load-balancing_DescribeTags_section.md)
+ [`DetachLoadBalancerFromSubnets`](elastic-load-balancing_example_elastic-load-balancing_DetachLoadBalancerFromSubnets_section.md)
+ [`DisableAvailabilityZonesForLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_DisableAvailabilityZonesForLoadBalancer_section.md)
+ [`EnableAvailabilityZonesForLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_EnableAvailabilityZonesForLoadBalancer_section.md)
+ [`ModifyLoadBalancerAttributes`](elastic-load-balancing_example_elastic-load-balancing_ModifyLoadBalancerAttributes_section.md)
+ [`RegisterInstancesWithLoadBalancer`](elastic-load-balancing_example_elastic-load-balancing_RegisterInstancesWithLoadBalancer_section.md)
+ [`RemoveTags`](elastic-load-balancing_example_elastic-load-balancing_RemoveTags_section.md)
+ [`SetLoadBalancerListenerSslCertificate`](elastic-load-balancing_example_elastic-load-balancing_SetLoadBalancerListenerSslCertificate_section.md)
+ [`SetLoadBalancerPoliciesForBackendServer`](elastic-load-balancing_example_elastic-load-balancing_SetLoadBalancerPoliciesForBackendServer_section.md)
+ [`SetLoadBalancerPoliciesOfListener`](elastic-load-balancing_example_elastic-load-balancing_SetLoadBalancerPoliciesOfListener_section.md)

# Use `AddTags` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_AddTags_section"></a>

The following code examples show how to use `AddTags`.

------
#### [ CLI ]

**AWS CLI**  
**To add a tag to a load balancer**  
This example adds tags to the specified load balancer.  
Command:  

```
aws elb add-tags --load-balancer-name my-load-balancer --tags "Key=project,Value=lima" "Key=department,Value=digital-media"
```
+  For API details, see [AddTags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/add-tags.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example adds the specified tags to the specified load balancer. The syntax used by this example requires PowerShell version 3 or later.**  

```
Add-ELBResourceTag -LoadBalancerName my-load-balancer -Tag @{ Key="project";Value="lima" },@{ Key="department";Value="digital-media" }
```
**Example 2: With PowerShell version 2, you must use New-Object to create a tag for the Tag parameter.**  

```
$tag = New-Object Amazon.ElasticLoadBalancing.Model.Tag
$tag.Key = "project"
$tag.Value = "lima"
Add-ELBResourceTag -LoadBalancerName my-load-balancer -Tag $tag
```
+  For API details, see [AddTags](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example adds the specified tags to the specified load balancer. The syntax used by this example requires PowerShell version 3 or later.**  

```
Add-ELBResourceTag -LoadBalancerName my-load-balancer -Tag @{ Key="project";Value="lima" },@{ Key="department";Value="digital-media" }
```
**Example 2: With PowerShell version 2, you must use New-Object to create a tag for the Tag parameter.**  

```
$tag = New-Object Amazon.ElasticLoadBalancing.Model.Tag
$tag.Key = "project"
$tag.Value = "lima"
Add-ELBResourceTag -LoadBalancerName my-load-balancer -Tag $tag
```
+  For API details, see [AddTags](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `ApplySecurityGroupsToLoadBalancer` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_ApplySecurityGroupsToLoadBalancer_section"></a>

The following code examples show how to use `ApplySecurityGroupsToLoadBalancer`.

------
#### [ CLI ]

**AWS CLI**  
**To associate a security group with a load balancer in a VPC**  
This example associates a security group with the specified load balancer in a VPC.  
Command:  

```
aws elb apply-security-groups-to-load-balancer --load-balancer-name my-load-balancer --security-groups sg-fc448899
```
Output:  

```
{
  "SecurityGroups": [
      "sg-fc448899"
  ]
}
```
+  For API details, see [ApplySecurityGroupsToLoadBalancer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/apply-security-groups-to-load-balancer.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example replaces the current security group for the specified load balancer with the specified security group.**  

```
Join-ELBSecurityGroupToLoadBalancer -LoadBalancerName my-load-balancer -SecurityGroup sg-87654321
```
**Output:**  

```
sg-87654321
```
**Example 2: To keep the current security group and specify an additional security group, specify both the existing and new security groups.**  

```
Join-ELBSecurityGroupToLoadBalancer -LoadBalancerName my-load-balancer -SecurityGroup @("sg-12345678", "sg-87654321")
```
**Output:**  

```
sg-12345678
sg-87654321
```
+  For API details, see [ApplySecurityGroupsToLoadBalancer](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example replaces the current security group for the specified load balancer with the specified security group.**  

```
Join-ELBSecurityGroupToLoadBalancer -LoadBalancerName my-load-balancer -SecurityGroup sg-87654321
```
**Output:**  

```
sg-87654321
```
**Example 2: To keep the current security group and specify an additional security group, specify both the existing and new security groups.**  

```
Join-ELBSecurityGroupToLoadBalancer -LoadBalancerName my-load-balancer -SecurityGroup @("sg-12345678", "sg-87654321")
```
**Output:**  

```
sg-12345678
sg-87654321
```
+  For API details, see [ApplySecurityGroupsToLoadBalancer](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `AttachLoadBalancerToSubnets` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_AttachLoadBalancerToSubnets_section"></a>

The following code examples show how to use `AttachLoadBalancerToSubnets`.

------
#### [ CLI ]

**AWS CLI**  
**To attach subnets to a load balancer**  
This example adds the specified subnet to the set of configured subnets for the specified load balancer.  
Command:  

```
aws elb attach-load-balancer-to-subnets --load-balancer-name my-load-balancer --subnets subnet-0ecac448
```
Output:  

```
{
   "Subnets": [
       "subnet-15aaab61",
       "subnet-0ecac448"
   ]
}
```
+  For API details, see [AttachLoadBalancerToSubnets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/attach-load-balancer-to-subnets.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example adds the specified subnet to the set of subnets configured for the specified load balancer. The output includes the complete list of subnets.**  

```
Add-ELBLoadBalancerToSubnet -LoadBalancerName my-load-balancer -Subnet subnet-12345678
```
**Output:**  

```
subnet-12345678
subnet-87654321
```
+  For API details, see [AttachLoadBalancerToSubnets](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example adds the specified subnet to the set of subnets configured for the specified load balancer. The output includes the complete list of subnets.**  

```
Add-ELBLoadBalancerToSubnet -LoadBalancerName my-load-balancer -Subnet subnet-12345678
```
**Output:**  

```
subnet-12345678
subnet-87654321
```
+  For API details, see [AttachLoadBalancerToSubnets](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `ConfigureHealthCheck` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_ConfigureHealthCheck_section"></a>

The following code examples show how to use `ConfigureHealthCheck`.

------
#### [ CLI ]

**AWS CLI**  
**To specify the health check settings for your backend EC2 instances**  
This example specifies the health check settings used to evaluate the health of your backend EC2 instances.  
Command:  

```
aws elb configure-health-check --load-balancer-name my-load-balancer --health-check Target=HTTP:80/png,Interval=30,UnhealthyThreshold=2,HealthyThreshold=2,Timeout=3
```
Output:  

```
{
   "HealthCheck": {
       "HealthyThreshold": 2,
       "Interval": 30,
       "Target": "HTTP:80/png",
       "Timeout": 3,
       "UnhealthyThreshold": 2
   }
}
```
+  For API details, see [ConfigureHealthCheck](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/configure-health-check.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example configures the health check settings for the specified load balancer.**  

```
Set-ELBHealthCheck -LoadBalancerName my-load-balancer `
>> -HealthCheck_HealthyThreshold 2 `
>> -HealthCheck_UnhealthyThreshold 2 `
>> -HealthCheck_Target "HTTP:80/ping" `
>> -HealthCheck_Interval 30 `
>> -HealthCheck_Timeout 3
```
**Output:**  

```
HealthyThreshold   : 2
Interval           : 30
Target             : HTTP:80/ping
Timeout            : 3
UnhealthyThreshold : 2
```
+  For API details, see [ConfigureHealthCheck](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example configures the health check settings for the specified load balancer.**  

```
Set-ELBHealthCheck -LoadBalancerName my-load-balancer `
>> -HealthCheck_HealthyThreshold 2 `
>> -HealthCheck_UnhealthyThreshold 2 `
>> -HealthCheck_Target "HTTP:80/ping" `
>> -HealthCheck_Interval 30 `
>> -HealthCheck_Timeout 3
```
**Output:**  

```
HealthyThreshold   : 2
Interval           : 30
Target             : HTTP:80/ping
Timeout            : 3
UnhealthyThreshold : 2
```
+  For API details, see [ConfigureHealthCheck](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `CreateAppCookieStickinessPolicy` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_CreateAppCookieStickinessPolicy_section"></a>

The following code examples show how to use `CreateAppCookieStickinessPolicy`.

------
#### [ CLI ]

**AWS CLI**  
**To generate a stickiness policy for your HTTPS load balancer**  
This example generates a stickiness policy that follows the sticky session lifetimes of the application-generated cookie.  
Command:  

```
aws elb create-app-cookie-stickiness-policy --load-balancer-name my-load-balancer --policy-name my-app-cookie-policy --cookie-name my-app-cookie
```
+  For API details, see [CreateAppCookieStickinessPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/create-app-cookie-stickiness-policy.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example creates a stickiness policy that follows the sticky session lifetimes of the specified application-generated cookie.**  

```
New-ELBAppCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-app-cookie-policy -CookieName my-app-cookie
```
+  For API details, see [CreateAppCookieStickinessPolicy](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example creates a stickiness policy that follows the sticky session lifetimes of the specified application-generated cookie.**  

```
New-ELBAppCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-app-cookie-policy -CookieName my-app-cookie
```
+  For API details, see [CreateAppCookieStickinessPolicy](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `CreateLbCookieStickinessPolicy` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_CreateLbCookieStickinessPolicy_section"></a>

The following code examples show how to use `CreateLbCookieStickinessPolicy`.

------
#### [ CLI ]

**AWS CLI**  
**To generate a duration-based stickiness policy for your HTTPS load balancer**  
This example generates a stickiness policy with sticky session lifetimes controlled by the specified expiration period.  
Command:  

```
aws elb create-lb-cookie-stickiness-policy --load-balancer-name my-load-balancer --policy-name my-duration-cookie-policy --cookie-expiration-period 60
```
+  For API details, see [CreateLbCookieStickinessPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/create-lb-cookie-stickiness-policy.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example creates a stickiness policy with sticky session lifetimes controlled by the specified expiration period (in seconds).**  

```
New-ELBLBCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-duration-cookie-policy -CookieExpirationPeriod 60
```
**Example 2: This example creates a stickiness policy with sticky session lifetimes controlled by the by the lifetime of the browser (user-agent).**  

```
New-ELBLBCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-duration-cookie-policy
```
+  For API details, see [CreateLbCookieStickinessPolicy](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example creates a stickiness policy with sticky session lifetimes controlled by the specified expiration period (in seconds).**  

```
New-ELBLBCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-duration-cookie-policy -CookieExpirationPeriod 60
```
**Example 2: This example creates a stickiness policy with sticky session lifetimes controlled by the by the lifetime of the browser (user-agent).**  

```
New-ELBLBCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-duration-cookie-policy
```
+  For API details, see [CreateLbCookieStickinessPolicy](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `CreateLoadBalancer` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_CreateLoadBalancer_section"></a>

The following code examples show how to use `CreateLoadBalancer`.

------
#### [ CLI ]

**AWS CLI**  
**To create an HTTP load balancer**  
This example creates a load balancer with an HTTP listener in a VPC.  
Command:  

```
aws elb create-load-balancer --load-balancer-name my-load-balancer --listeners "Protocol=HTTP,LoadBalancerPort=80,InstanceProtocol=HTTP,InstancePort=80" --subnets subnet-15aaab61 --security-groups sg-a61988c3
```
Output:  

```
{
    "DNSName": "my-load-balancer-1234567890.us-west-2.elb.amazonaws.com"
}
```
This example creates a load balancer with an HTTP listener in EC2-Classic.  
Command:  

```
aws elb create-load-balancer --load-balancer-name my-load-balancer --listeners "Protocol=HTTP,LoadBalancerPort=80,InstanceProtocol=HTTP,InstancePort=80" --availability-zones us-west-2a us-west-2b
```
Output:  

```
{
    "DNSName": "my-load-balancer-123456789.us-west-2.elb.amazonaws.com"
}
```
**To create an HTTPS load balancer**  
This example creates a load balancer with an HTTPS listener in a VPC.  
Command:  

```
aws elb create-load-balancer --load-balancer-name my-load-balancer --listeners "Protocol=HTTP,LoadBalancerPort=80,InstanceProtocol=HTTP,InstancePort=80" "Protocol=HTTPS,LoadBalancerPort=443,InstanceProtocol=HTTP,InstancePort=80,SSLCertificateId=arn:aws:iam::123456789012:server-certificate/my-server-cert" --subnets subnet-15aaab61 --security-groups sg-a61988c3
```
Output:  

```
{
    "DNSName": "my-load-balancer-1234567890.us-west-2.elb.amazonaws.com"
}
```
This example creates a load balancer with an HTTPS listener in EC2-Classic.  
Command:  

```
aws elb create-load-balancer --load-balancer-name my-load-balancer --listeners "Protocol=HTTP,LoadBalancerPort=80,InstanceProtocol=HTTP,InstancePort=80" "Protocol=HTTPS,LoadBalancerPort=443,InstanceProtocol=HTTP,InstancePort=80,SSLCertificateId=arn:aws:iam::123456789012:server-certificate/my-server-cert" --availability-zones us-west-2a us-west-2b
```
Output:  

```
{
    "DNSName": "my-load-balancer-123456789.us-west-2.elb.amazonaws.com"
}
```
**To create an internal load balancer**  
This example creates an internal load balancer with an HTTP listener in a VPC.  
Command:  

```
aws elb create-load-balancer --load-balancer-name my-load-balancer --listeners "Protocol=HTTP,LoadBalancerPort=80,InstanceProtocol=HTTP,InstancePort=80" --scheme internal --subnets subnet-a85db0df --security-groups sg-a61988c3
```
Output:  

```
{
    "DNSName": "internal-my-load-balancer-123456789.us-west-2.elb.amazonaws.com"
}
```
+  For API details, see [CreateLoadBalancer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/create-load-balancer.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example creates a load balancer with an HTTP listener in a VPC.**  

```
$httpListener = New-Object Amazon.ElasticLoadBalancing.Model.Listener
$httpListener.Protocol = "http"
$httpListener.LoadBalancerPort = 80
$httpListener.InstanceProtocol = "http"
$httpListener.InstancePort = 80
New-ELBLoadBalancer -LoadBalancerName my-vpc-load-balancer -SecurityGroup sg-a61988c3 -Subnet subnet-15aaab61 -Listener $httpListener

my-vpc-load-balancer-1234567890.us-west-2.elb.amazonaws.com
```
**Example 2: This example creates a load balancer with an HTTP listener in EC2-Classic.**  

```
New-ELBLoadBalancer -LoadBalancerName my-classic-load-balancer -AvailabilityZone us-west-2a` -Listener $httpListener
```
**Output:**  

```
my-classic-load-balancer-123456789.us-west-2.elb.amazonaws.com
```
**Example 3: This example creates a load balancer with an HTTPS listener.**  

```
$httpsListener = New-Object Amazon.ElasticLoadBalancing.Model.Listener
$httpsListener.Protocol = "https"
$httpsListener.LoadBalancerPort = 443
$httpsListener.InstanceProtocol = "http"
$httpsListener.InstancePort = 80 
$httpsListener.SSLCertificateId="arn:aws:iam::123456789012:server-certificate/my-server-cert"
New-ELBLoadBalancer -LoadBalancerName my-load-balancer -AvailabilityZone us-west-2a -Listener $httpsListener

my-load-balancer-123456789.us-west-2.elb.amazonaws.com
```
+  For API details, see [CreateLoadBalancer](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example creates a load balancer with an HTTP listener in a VPC.**  

```
$httpListener = New-Object Amazon.ElasticLoadBalancing.Model.Listener
$httpListener.Protocol = "http"
$httpListener.LoadBalancerPort = 80
$httpListener.InstanceProtocol = "http"
$httpListener.InstancePort = 80
New-ELBLoadBalancer -LoadBalancerName my-vpc-load-balancer -SecurityGroup sg-a61988c3 -Subnet subnet-15aaab61 -Listener $httpListener

my-vpc-load-balancer-1234567890.us-west-2.elb.amazonaws.com
```
**Example 2: This example creates a load balancer with an HTTP listener in EC2-Classic.**  

```
New-ELBLoadBalancer -LoadBalancerName my-classic-load-balancer -AvailabilityZone us-west-2a` -Listener $httpListener
```
**Output:**  

```
my-classic-load-balancer-123456789.us-west-2.elb.amazonaws.com
```
**Example 3: This example creates a load balancer with an HTTPS listener.**  

```
$httpsListener = New-Object Amazon.ElasticLoadBalancing.Model.Listener
$httpsListener.Protocol = "https"
$httpsListener.LoadBalancerPort = 443
$httpsListener.InstanceProtocol = "http"
$httpsListener.InstancePort = 80 
$httpsListener.SSLCertificateId="arn:aws:iam::123456789012:server-certificate/my-server-cert"
New-ELBLoadBalancer -LoadBalancerName my-load-balancer -AvailabilityZone us-west-2a -Listener $httpsListener

my-load-balancer-123456789.us-west-2.elb.amazonaws.com
```
+  For API details, see [CreateLoadBalancer](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `CreateLoadBalancerListeners` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_CreateLoadBalancerListeners_section"></a>

The following code examples show how to use `CreateLoadBalancerListeners`.

------
#### [ CLI ]

**AWS CLI**  
**To create HTTP listeners for a load balancer**  
This example creates a listener for your load balancer at port 80 using the HTTP protocol.  
Command:  

```
aws elb create-load-balancer-listeners --load-balancer-name my-load-balancer --listeners "Protocol=HTTP,LoadBalancerPort=80,InstanceProtocol=HTTP,InstancePort=80"
```
**To create HTTPS listeners for a load balancer**  
This example creates a listener for your load balancer at port 443 using the HTTPS protocol.  
Command:  

```
aws elb create-load-balancer-listeners --load-balancer-name my-load-balancer --listeners "Protocol=HTTPS,LoadBalancerPort=443,InstanceProtocol=HTTP,InstancePort=80"
```
+  For API details, see [CreateLoadBalancerListeners](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/create-load-balancer-listeners.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example adds an HTTPS listener to the specified load balancer.**  

```
$httpsListener = New-Object Amazon.ElasticLoadBalancing.Model.Listener
$httpsListener.Protocol = "https"
$httpsListener.LoadBalancerPort = 443
$httpsListener.InstanceProtocol = "https"
$httpsListener.InstancePort = 443 
$httpsListener.SSLCertificateId="arn:aws:iam::123456789012:server-certificate/my-server-cert"
New-ELBLoadBalancerListener -LoadBalancerName my-load-balancer -Listener $httpsListener
```
+  For API details, see [CreateLoadBalancerListeners](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example adds an HTTPS listener to the specified load balancer.**  

```
$httpsListener = New-Object Amazon.ElasticLoadBalancing.Model.Listener
$httpsListener.Protocol = "https"
$httpsListener.LoadBalancerPort = 443
$httpsListener.InstanceProtocol = "https"
$httpsListener.InstancePort = 443 
$httpsListener.SSLCertificateId="arn:aws:iam::123456789012:server-certificate/my-server-cert"
New-ELBLoadBalancerListener -LoadBalancerName my-load-balancer -Listener $httpsListener
```
+  For API details, see [CreateLoadBalancerListeners](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `CreateLoadBalancerPolicy` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_CreateLoadBalancerPolicy_section"></a>

The following code examples show how to use `CreateLoadBalancerPolicy`.

------
#### [ CLI ]

**AWS CLI**  
**To create a policy that enables Proxy Protocol on a load balancer**  
This example creates a policy that enables Proxy Protocol on the specified load balancer.  
Command:  

```
aws elb create-load-balancer-policy --load-balancer-name my-load-balancer --policy-name my-ProxyProtocol-policy --policy-type-name ProxyProtocolPolicyType --policy-attributes AttributeName=ProxyProtocol,AttributeValue=true
```
**To create an SSL negotiation policy using the recommended security policy**  
This example creates an SSL negotiation policy for the specified HTTPS load balancer using the recommended security policy.  
Command:  

```
aws elb create-load-balancer-policy --load-balancer-name my-load-balancer --policy-name my-SSLNegotiation-policy --policy-type-name SSLNegotiationPolicyType --policy-attributes AttributeName=Reference-Security-Policy,AttributeValue=ELBSecurityPolicy-2015-03
```
**To create an SSL negotiation policy using a custom security policy**  
This example creates an SSL negotiation policy for your HTTPS load balancer using a custom security policy by enabling the protocols and the ciphers.  
Command:  

```
aws elb create-load-balancer-policy --load-balancer-name my-load-balancer --policy-name my-SSLNegotiation-policy --policy-type-name SSLNegotiationPolicyType --policy-attributes AttributeName=Protocol-SSLv3,AttributeValue=true AttributeName=Protocol-TLSv1.1,AttributeValue=true AttributeName=DHE-RSA-AES256-SHA256,AttributeValue=true AttributeName=Server-Defined-Cipher-Order,AttributeValue=true
```
**To create a public key policy**  
This example creates a public key policy.  
Command:  

```
aws elb create-load-balancer-policy --load-balancer-name my-load-balancer --policy-name my-PublicKey-policy --policy-type-name PublicKeyPolicyType --policy-attributes AttributeName=PublicKey,AttributeValue=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwAYUjnfyEyXr1pxjhFWBpMlggUcqoi3kl+dS74kj//c6x7ROtusUaeQCTgIUkayttRDWchuqo1pHC1u+n5xxXnBBe2ejbb2WRsKIQ5rXEeixsjFpFsojpSQKkzhVGI6mJVZBJDVKSHmswnwLBdofLhzvllpovBPTHe+o4haAWvDBALJU0pkSI1FecPHcs2hwxf14zHoXy1e2k36A64nXW43wtfx5qcVSIxtCEOjnYRg7RPvybaGfQ+v6Iaxb/+7J5kEvZhTFQId+bSiJImF1FSUT1W1xwzBZPUbcUkkXDj45vC2s3Z8E+Lk7a3uZhvsQHLZnrfuWjBWGWvZ/MhZYgEXAMPLE
```
**To create a backend server authentication policy**  
This example creates a backend server authentication policy that enables authentication on your backend instance using a public key policy.  
Command:  

```
aws elb create-load-balancer-policy --load-balancer-name my-load-balancer --policy-name my-authentication-policy --policy-type-name BackendServerAuthenticationPolicyType --policy-attributes AttributeName=PublicKeyPolicyName,AttributeValue=my-PublicKey-policy
```
+  For API details, see [CreateLoadBalancerPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/create-load-balancer-policy.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example creates a new proxy protocol policy for a specified load balancer.**  

```
$attribute = New-Object Amazon.ElasticLoadBalancing.Model.PolicyAttribute -Property @{
         AttributeName="ProxyProtocol"
         AttributeValue="True"
    }
New-ELBLoadBalancerPolicy -LoadBalancerName my-load-balancer -PolicyName my-ProxyProtocol-policy -PolicyTypeName ProxyProtocolPolicyType -PolicyAttribute $attribute
```
+  For API details, see [CreateLoadBalancerPolicy](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example creates a new proxy protocol policy for a specified load balancer.**  

```
$attribute = New-Object Amazon.ElasticLoadBalancing.Model.PolicyAttribute -Property @{
         AttributeName="ProxyProtocol"
         AttributeValue="True"
    }
New-ELBLoadBalancerPolicy -LoadBalancerName my-load-balancer -PolicyName my-ProxyProtocol-policy -PolicyTypeName ProxyProtocolPolicyType -PolicyAttribute $attribute
```
+  For API details, see [CreateLoadBalancerPolicy](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `DeleteLoadBalancer` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_DeleteLoadBalancer_section"></a>

The following code examples show how to use `DeleteLoadBalancer`.

------
#### [ CLI ]

**AWS CLI**  
**To delete a load balancer**  
This example deletes the specified load balancer.  
Command:  

```
aws elb delete-load-balancer --load-balancer-name my-load-balancer
```
+  For API details, see [DeleteLoadBalancer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/delete-load-balancer.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example deletes the specified load balancer. You are prompted for confirmation before the operation proceeds, unless you also specify the Force parameter.**  

```
Remove-ELBLoadBalancer -LoadBalancerName my-load-balancer
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-ELBLoadBalancer (DeleteLoadBalancer)" on Target "my-load-balancer".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  For API details, see [DeleteLoadBalancer](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example deletes the specified load balancer. You are prompted for confirmation before the operation proceeds, unless you also specify the Force parameter.**  

```
Remove-ELBLoadBalancer -LoadBalancerName my-load-balancer
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-ELBLoadBalancer (DeleteLoadBalancer)" on Target "my-load-balancer".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  For API details, see [DeleteLoadBalancer](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `DeleteLoadBalancerListeners` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_DeleteLoadBalancerListeners_section"></a>

The following code examples show how to use `DeleteLoadBalancerListeners`.

------
#### [ CLI ]

**AWS CLI**  
**To delete a listener from your load balancer**  
This example deletes the listener for the specified port from the specified load balancer.  
Command:  

```
aws elb delete-load-balancer-listeners --load-balancer-name my-load-balancer --load-balancer-ports 80
```
+  For API details, see [DeleteLoadBalancerListeners](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/delete-load-balancer-listeners.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example deletes the listener on port 80 for the specified load balancer. You are prompted for confirmation before the operation proceeds, unless you also specify the Force parameter.**  

```
Remove-ELBLoadBalancerListener -LoadBalancerName my-load-balancer -LoadBalancerPort 80
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-ELBLoadBalancerListener (DeleteLoadBalancerListeners)" on Target "80".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  For API details, see [DeleteLoadBalancerListeners](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example deletes the listener on port 80 for the specified load balancer. You are prompted for confirmation before the operation proceeds, unless you also specify the Force parameter.**  

```
Remove-ELBLoadBalancerListener -LoadBalancerName my-load-balancer -LoadBalancerPort 80
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-ELBLoadBalancerListener (DeleteLoadBalancerListeners)" on Target "80".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  For API details, see [DeleteLoadBalancerListeners](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `DeleteLoadBalancerPolicy` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_DeleteLoadBalancerPolicy_section"></a>

The following code examples show how to use `DeleteLoadBalancerPolicy`.

------
#### [ CLI ]

**AWS CLI**  
**To delete a policy from your load balancer**  
This example deletes the specified policy from the specified load balancer. The policy must not be enabled on any listener.  
Command:  

```
aws elb delete-load-balancer-policy --load-balancer-name my-load-balancer --policy-name my-duration-cookie-policy
```
+  For API details, see [DeleteLoadBalancerPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/delete-load-balancer-policy.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example deletes the specified policy from the specified load balancer. You are prompted for confirmation before the operation proceeds, unless you also specify the Force parameter.**  

```
Remove-ELBLoadBalancerPolicy -LoadBalancerName my-load-balancer -PolicyName my-duration-cookie-policy
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-ELBLoadBalancerPolicy (DeleteLoadBalancerPolicy)" on Target "my-duration-cookie-policy".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  For API details, see [DeleteLoadBalancerPolicy](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example deletes the specified policy from the specified load balancer. You are prompted for confirmation before the operation proceeds, unless you also specify the Force parameter.**  

```
Remove-ELBLoadBalancerPolicy -LoadBalancerName my-load-balancer -PolicyName my-duration-cookie-policy
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-ELBLoadBalancerPolicy (DeleteLoadBalancerPolicy)" on Target "my-duration-cookie-policy".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  For API details, see [DeleteLoadBalancerPolicy](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `DeregisterInstancesFromLoadBalancer` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_DeregisterInstancesFromLoadBalancer_section"></a>

The following code examples show how to use `DeregisterInstancesFromLoadBalancer`.

------
#### [ CLI ]

**AWS CLI**  
**To deregister instances from a load balancer**  
This example deregisters the specified instance from the specified load balancer.  
Command:  

```
aws elb deregister-instances-from-load-balancer --load-balancer-name my-load-balancer --instances i-d6f6fae3
```
Output:  

```
{
    "Instances": [
        {
            "InstanceId": "i-207d9717"
        },
        {
            "InstanceId": "i-afefb49b"
        }
    ]
}
```
+  For API details, see [DeregisterInstancesFromLoadBalancer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/deregister-instances-from-load-balancer.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example removes the specified EC2 instance from the specified load balancer. You are prompted for confirmation before the operation proceeds, unless you also specify the Force parameter.**  

```
Remove-ELBInstanceFromLoadBalancer -LoadBalancerName my-load-balancer -Instance i-12345678
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-ELBInstanceFromLoadBalancer (DeregisterInstancesFromLoadBalancer)" on Target
"Amazon.ElasticLoadBalancing.Model.Instance".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

InstanceId
----------
i-87654321
```
+  For API details, see [DeregisterInstancesFromLoadBalancer](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example removes the specified EC2 instance from the specified load balancer. You are prompted for confirmation before the operation proceeds, unless you also specify the Force parameter.**  

```
Remove-ELBInstanceFromLoadBalancer -LoadBalancerName my-load-balancer -Instance i-12345678
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-ELBInstanceFromLoadBalancer (DeregisterInstancesFromLoadBalancer)" on Target
"Amazon.ElasticLoadBalancing.Model.Instance".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

InstanceId
----------
i-87654321
```
+  For API details, see [DeregisterInstancesFromLoadBalancer](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `DescribeInstanceHealth` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_DescribeInstanceHealth_section"></a>

The following code examples show how to use `DescribeInstanceHealth`.

------
#### [ CLI ]

**AWS CLI**  
**To describe the health of the instances for a load balancer**  
This example describes the health of the instances for the specified load balancer.  
Command:  

```
aws elb describe-instance-health --load-balancer-name my-load-balancer
```
Output:  

```
{
  "InstanceStates": [
      {
          "InstanceId": "i-207d9717",
          "ReasonCode": "N/A",
          "State": "InService",
          "Description": "N/A"
      },
      {
          "InstanceId": "i-afefb49b",
          "ReasonCode": "N/A",
          "State": "InService",
          "Description": "N/A"
      }
  ]
}
```
**To describe the health of an instance for a load balancer**  
This example describes the health of the specified instance for the specified load balancer.  
Command:  

```
aws elb describe-instance-health --load-balancer-name my-load-balancer --instances i-7299c809
```
The following is an example response for an instance that is registering.  
Output:  

```
{
  "InstanceStates": [
      {
          "InstanceId": "i-7299c809",
          "ReasonCode": "ELB",
          "State": "OutOfService",
          "Description": "Instance registration is still in progress."
    }
  ]
}
```
The following is an example response for an unhealthy instance.  
Output:  

```
{
  "InstanceStates": [
      {
          "InstanceId": "i-7299c809",
          "ReasonCode": "Instance",
          "State": "OutOfService",
          "Description": "Instance has failed at least the UnhealthyThreshold number of health checks consecutively."
      }
  ]
}
```
+  For API details, see [DescribeInstanceHealth](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/describe-instance-health.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example describes the state of the instances registered with the specified load balancer.**  

```
Get-ELBInstanceHealth -LoadBalancerName my-load-balancer
```
**Output:**  

```
Description                   InstanceId                    ReasonCode                    State
-----------                   ----------                    ----------                    -----
N/A                           i-87654321                    N/A                           InService
Instance has failed at lea... i-12345678                    Instance                      OutOfService
```
**Example 2: This example describes the state of the specified instance registered with the specified load balancer.**  

```
Get-ELBInstanceHealth -LoadBalancerName my-load-balancer -Instance i-12345678
```
**Example 3: This example displays the complete description of the state of the specified instance.**  

```
(Get-ELBInstanceHealth -LoadBalancerName my-load-balancer -Instance i-12345678).Description
```
**Output:**  

```
Instance has failed at least the UnhealthyThreshold number of health checks consecutively.
```
+  For API details, see [DescribeInstanceHealth](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example describes the state of the instances registered with the specified load balancer.**  

```
Get-ELBInstanceHealth -LoadBalancerName my-load-balancer
```
**Output:**  

```
Description                   InstanceId                    ReasonCode                    State
-----------                   ----------                    ----------                    -----
N/A                           i-87654321                    N/A                           InService
Instance has failed at lea... i-12345678                    Instance                      OutOfService
```
**Example 2: This example describes the state of the specified instance registered with the specified load balancer.**  

```
Get-ELBInstanceHealth -LoadBalancerName my-load-balancer -Instance i-12345678
```
**Example 3: This example displays the complete description of the state of the specified instance.**  

```
(Get-ELBInstanceHealth -LoadBalancerName my-load-balancer -Instance i-12345678).Description
```
**Output:**  

```
Instance has failed at least the UnhealthyThreshold number of health checks consecutively.
```
+  For API details, see [DescribeInstanceHealth](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `DescribeLoadBalancerAttributes` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancerAttributes_section"></a>

The following code examples show how to use `DescribeLoadBalancerAttributes`.

------
#### [ CLI ]

**AWS CLI**  
**To describe the attributes of a load balancer**  
This example describes the attributes of the specified load balancer.  
Command:  

```
aws elb describe-load-balancer-attributes --load-balancer-name my-load-balancer
```
Output:  

```
{
  "LoadBalancerAttributes": {
      "ConnectionDraining": {
          "Enabled": false,
          "Timeout": 300
      },
      "CrossZoneLoadBalancing": {
          "Enabled": true
      },
      "ConnectionSettings": {
          "IdleTimeout": 30
      },
      "AccessLog": {
          "Enabled": false
    }
  }
}
```
+  For API details, see [DescribeLoadBalancerAttributes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/describe-load-balancer-attributes.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example describes the attributes for the specified load balancer.**  

```
Get-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer
```
**Output:**  

```
AccessLog              : Amazon.ElasticLoadBalancing.Model.AccessLog
AdditionalAttributes   : {}
ConnectionDraining     : Amazon.ElasticLoadBalancing.Model.ConnectionDraining
ConnectionSettings     : Amazon.ElasticLoadBalancing.Model.ConnectionSettings
CrossZoneLoadBalancing : Amazon.ElasticLoadBalancing.Model.CrossZoneLoadBalancing
```
+  For API details, see [DescribeLoadBalancerAttributes](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example describes the attributes for the specified load balancer.**  

```
Get-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer
```
**Output:**  

```
AccessLog              : Amazon.ElasticLoadBalancing.Model.AccessLog
AdditionalAttributes   : {}
ConnectionDraining     : Amazon.ElasticLoadBalancing.Model.ConnectionDraining
ConnectionSettings     : Amazon.ElasticLoadBalancing.Model.ConnectionSettings
CrossZoneLoadBalancing : Amazon.ElasticLoadBalancing.Model.CrossZoneLoadBalancing
```
+  For API details, see [DescribeLoadBalancerAttributes](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `DescribeLoadBalancerPolicies` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancerPolicies_section"></a>

The following code examples show how to use `DescribeLoadBalancerPolicies`.

------
#### [ CLI ]

**AWS CLI**  
**To describe all policies associated with a load balancer**  
This example describes all of the policies associated with the specified load balancer.  
Command:  

```
aws elb describe-load-balancer-policies --load-balancer-name my-load-balancer
```
Output:  

```
{
  "PolicyDescriptions": [
    {
      "PolicyAttributeDescriptions": [
        {
          "AttributeName": "ProxyProtocol",
          "AttributeValue": "true"
        }
      ],
      "PolicyName": "my-ProxyProtocol-policy",
      "PolicyTypeName": "ProxyProtocolPolicyType"
    },
    {
        "PolicyAttributeDescriptions": [
            {
                "AttributeName": "CookieName",
                "AttributeValue": "my-app-cookie"
            }
        ],
        "PolicyName": "my-app-cookie-policy",
        "PolicyTypeName": "AppCookieStickinessPolicyType"
    },
    {
      "PolicyAttributeDescriptions": [
        {
          "AttributeName": "CookieExpirationPeriod",
          "AttributeValue": "60"
        }
      ],
      "PolicyName": "my-duration-cookie-policy",
      "PolicyTypeName": "LBCookieStickinessPolicyType"
    },
    .
    .
    .
  ]
}
```
**To describe a specific policy associated with a load balancer**  
This example describes the specified policy associated with the specified load balancer.  
Command:  

```
aws elb describe-load-balancer-policies --load-balancer-name my-load-balancer --policy-name my-authentication-policy
```
Output:  

```
{
  "PolicyDescriptions": [
      {
          "PolicyAttributeDescriptions": [
              {
                  "AttributeName": "PublicKeyPolicyName",
                  "AttributeValue": "my-PublicKey-policy"
              }
          ],
          "PolicyName": "my-authentication-policy",
          "PolicyTypeName": "BackendServerAuthenticationPolicyType"
      }
  ]
}
```
+  For API details, see [DescribeLoadBalancerPolicies](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/describe-load-balancer-policies.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example describes the policies associated with the specified load balancer.**  

```
Get-ELBLoadBalancerPolicy -LoadBalancerName my-load-balancer
```
**Output:**  

```
PolicyAttributeDescriptions             PolicyName                              PolicyTypeName
---------------------------             ----------                              --------------
{ProxyProtocol}                         my-ProxyProtocol-policy                 ProxyProtocolPolicyType
{CookieName}                            my-app-cookie-policy                    AppCookieStickinessPolicyType
```
**Example 2: This example describes the attributes of the specified policy.**  

```
(Get-ELBLoadBalancerPolicy -LoadBalancerName my-load-balancer -PolicyName my-ProxyProtocol-policy).PolicyAttributeDescriptions
```
**Output:**  

```
AttributeName    AttributeValue
-------------    --------------
ProxyProtocol    true
```
**Example 3: This example describes the predefined policies, including the sample policies. The names of the sample policies have the ELBSample- prefix.**  

```
Get-ELBLoadBalancerPolicy
```
**Output:**  

```
PolicyAttributeDescriptions             PolicyName                              PolicyTypeName
---------------------------             ----------                              --------------
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2015-05               SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2015-03               SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2015-02               SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2014-10               SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2014-01               SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2011-08               SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSample-ELBDefaultCipherPolicy        SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSample-OpenSSLDefaultCipherPolicy    SSLNegotiationPolicyType
```
+  For API details, see [DescribeLoadBalancerPolicies](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example describes the policies associated with the specified load balancer.**  

```
Get-ELBLoadBalancerPolicy -LoadBalancerName my-load-balancer
```
**Output:**  

```
PolicyAttributeDescriptions             PolicyName                              PolicyTypeName
---------------------------             ----------                              --------------
{ProxyProtocol}                         my-ProxyProtocol-policy                 ProxyProtocolPolicyType
{CookieName}                            my-app-cookie-policy                    AppCookieStickinessPolicyType
```
**Example 2: This example describes the attributes of the specified policy.**  

```
(Get-ELBLoadBalancerPolicy -LoadBalancerName my-load-balancer -PolicyName my-ProxyProtocol-policy).PolicyAttributeDescriptions
```
**Output:**  

```
AttributeName    AttributeValue
-------------    --------------
ProxyProtocol    true
```
**Example 3: This example describes the predefined policies, including the sample policies. The names of the sample policies have the ELBSample- prefix.**  

```
Get-ELBLoadBalancerPolicy
```
**Output:**  

```
PolicyAttributeDescriptions             PolicyName                              PolicyTypeName
---------------------------             ----------                              --------------
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2015-05               SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2015-03               SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2015-02               SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2014-10               SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2014-01               SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2011-08               SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSample-ELBDefaultCipherPolicy        SSLNegotiationPolicyType
{Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSample-OpenSSLDefaultCipherPolicy    SSLNegotiationPolicyType
```
+  For API details, see [DescribeLoadBalancerPolicies](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `DescribeLoadBalancerPolicyTypes` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancerPolicyTypes_section"></a>

The following code examples show how to use `DescribeLoadBalancerPolicyTypes`.

------
#### [ CLI ]

**AWS CLI**  
**To describe the load balancer policy types defined by Elastic Load Balancing**  
This example describes the load balancer policy types that you can use to create policy configurations for your load balancer.  
Command:  

```
aws elb describe-load-balancer-policy-types
```
Output:  

```
{
  "PolicyTypeDescriptions": [
      {
          "PolicyAttributeTypeDescriptions": [
              {
                  "Cardinality": "ONE",
                  "AttributeName": "ProxyProtocol",
                  "AttributeType": "Boolean"
              }
          ],
          "PolicyTypeName": "ProxyProtocolPolicyType",
          "Description": "Policy that controls whether to include the IP address and port of the originating request for TCP messages. This policy operates on TCP/SSL listeners only"
      },
      {
          "PolicyAttributeTypeDescriptions": [
              {
                  "Cardinality": "ONE",
                  "AttributeName": "PublicKey",
                  "AttributeType": "String"
              }
          ],
          "PolicyTypeName": "PublicKeyPolicyType",
          "Description": "Policy containing a list of public keys to accept when authenticating the back-end server(s). This policy cannot be applied directly to back-end servers or listeners but must be part of a BackendServerAuthenticationPolicyType."
      },
      {
          "PolicyAttributeTypeDescriptions": [
              {
                  "Cardinality": "ONE",
                  "AttributeName": "CookieName",
                  "AttributeType": "String"
              }
          ],
          "PolicyTypeName": "AppCookieStickinessPolicyType",
          "Description": "Stickiness policy with session lifetimes controlled by the lifetime of the application-generated cookie. This policy can be associated only with HTTP/HTTPS listeners."
      },
      {
          "PolicyAttributeTypeDescriptions": [
              {
                  "Cardinality": "ZERO_OR_ONE",
                  "AttributeName": "CookieExpirationPeriod",
                  "AttributeType": "Long"
              }
          ],
          "PolicyTypeName": "LBCookieStickinessPolicyType",
          "Description": "Stickiness policy with session lifetimes controlled by the browser (user-agent) or a specified expiration period. This policy can be associated only with HTTP/HTTPS listeners."
      },
      {
          "PolicyAttributeTypeDescriptions": [
              .
              .
              .
          ],
          "PolicyTypeName": "SSLNegotiationPolicyType",
          "Description": "Listener policy that defines the ciphers and protocols that will be accepted by the load balancer. This policy can be associated only with HTTPS/SSL listeners."
      },
      {
          "PolicyAttributeTypeDescriptions": [
              {
                  "Cardinality": "ONE_OR_MORE",
                  "AttributeName": "PublicKeyPolicyName",
                  "AttributeType": "PolicyName"
              }
          ],
          "PolicyTypeName": "BackendServerAuthenticationPolicyType",
          "Description": "Policy that controls authentication to back-end server(s) and contains one or more policies, such as an instance of a PublicKeyPolicyType. This policy can be associated only with back-end servers that are using HTTPS/SSL."
      }
  ]
}
```
+  For API details, see [DescribeLoadBalancerPolicyTypes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/describe-load-balancer-policy-types.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example gets the policy types supported by Elastic Load Balancing.**  

```
Get-ELBLoadBalancerPolicyType
```
**Output:**  

```
Description                             PolicyAttributeTypeDescriptions         PolicyTypeName
-----------                             -------------------------------         --------------
Stickiness policy with session lifet... {CookieExpirationPeriod}                LBCookieStickinessPolicyType
Policy that controls authentication ... {PublicKeyPolicyName}                   BackendServerAuthenticationPolicyType
Listener policy that defines the cip... {Protocol-SSLv2, Protocol-TLSv1, Pro... SSLNegotiationPolicyType
Policy containing a list of public k... {PublicKey}                             PublicKeyPolicyType
Stickiness policy with session lifet... {CookieName}                            AppCookieStickinessPolicyType
Policy that controls whether to incl... {ProxyProtocol}                         ProxyProtocolPolicyType
```
**Example 2: This example describes the specified policy type.**  

```
Get-ELBLoadBalancerPolicyType -PolicyTypeName ProxyProtocolPolicyType
```
**Output:**  

```
Description                             PolicyAttributeTypeDescriptions         PolicyTypeName
-----------                             -------------------------------         --------------
Policy that controls whether to incl... {ProxyProtocol}                         ProxyProtocolPolicyType
```
**Example 3: This example displays the complete description of the specified policy type.**  

```
(Get-ELBLoadBalancerPolicyType -PolicyTypeName).Description
```
**Output:**  

```
Policy that controls whether to include the IP address and port of the originating request for TCP messages. 
This policy operates on TCP/SSL listeners only
```
+  For API details, see [DescribeLoadBalancerPolicyTypes](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example gets the policy types supported by Elastic Load Balancing.**  

```
Get-ELBLoadBalancerPolicyType
```
**Output:**  

```
Description                             PolicyAttributeTypeDescriptions         PolicyTypeName
-----------                             -------------------------------         --------------
Stickiness policy with session lifet... {CookieExpirationPeriod}                LBCookieStickinessPolicyType
Policy that controls authentication ... {PublicKeyPolicyName}                   BackendServerAuthenticationPolicyType
Listener policy that defines the cip... {Protocol-SSLv2, Protocol-TLSv1, Pro... SSLNegotiationPolicyType
Policy containing a list of public k... {PublicKey}                             PublicKeyPolicyType
Stickiness policy with session lifet... {CookieName}                            AppCookieStickinessPolicyType
Policy that controls whether to incl... {ProxyProtocol}                         ProxyProtocolPolicyType
```
**Example 2: This example describes the specified policy type.**  

```
Get-ELBLoadBalancerPolicyType -PolicyTypeName ProxyProtocolPolicyType
```
**Output:**  

```
Description                             PolicyAttributeTypeDescriptions         PolicyTypeName
-----------                             -------------------------------         --------------
Policy that controls whether to incl... {ProxyProtocol}                         ProxyProtocolPolicyType
```
**Example 3: This example displays the complete description of the specified policy type.**  

```
(Get-ELBLoadBalancerPolicyType -PolicyTypeName).Description
```
**Output:**  

```
Policy that controls whether to include the IP address and port of the originating request for TCP messages. 
This policy operates on TCP/SSL listeners only
```
+  For API details, see [DescribeLoadBalancerPolicyTypes](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `DescribeLoadBalancers` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_DescribeLoadBalancers_section"></a>

The following code examples show how to use `DescribeLoadBalancers`.

------
#### [ CLI ]

**AWS CLI**  
**To describe your load balancers**  
This example describes all of your load balancers.  
Command:  

```
aws elb describe-load-balancers
```
**To describe one of your load balancers**  
This example describes the specified load balancer.  
Command:  

```
aws elb describe-load-balancers --load-balancer-name my-load-balancer
```
The following example response is for an HTTPS load balancer in a VPC.  
Output:  

```
{
  "LoadBalancerDescriptions": [
    {
      "Subnets": [
          "subnet-15aaab61"
      ],
      "CanonicalHostedZoneNameID": "Z3DZXE0EXAMPLE",
      "CanonicalHostedZoneName": "my-load-balancer-1234567890.us-west-2.elb.amazonaws.com",
      "ListenerDescriptions": [
          {
              "Listener": {
                  "InstancePort": 80,
                  "LoadBalancerPort": 80,
                  "Protocol": "HTTP",
                  "InstanceProtocol": "HTTP"
              },
              "PolicyNames": []
          },
          {
              "Listener": {
                  "InstancePort": 443,
                  "SSLCertificateId": "arn:aws:iam::123456789012:server-certificate/my-server-cert",
                  "LoadBalancerPort": 443,
                  "Protocol": "HTTPS",
                  "InstanceProtocol": "HTTPS"
              },
              "PolicyNames": [
                  "ELBSecurityPolicy-2015-03"
              ]
          }
      ],
      "HealthCheck": {
          "HealthyThreshold": 2,
          "Interval": 30,
          "Target": "HTTP:80/png",
          "Timeout": 3,
          "UnhealthyThreshold": 2
      },
      "VPCId": "vpc-a01106c2",
      "BackendServerDescriptions": [
          {
              "InstancePort": 80,
              "PolicyNames": [
                  "my-ProxyProtocol-policy"
              ]
          }
      ],
      "Instances": [
          {
              "InstanceId": "i-207d9717"
          },
          {
              "InstanceId": "i-afefb49b"
          }
      ],
      "DNSName": "my-load-balancer-1234567890.us-west-2.elb.amazonaws.com",
      "SecurityGroups": [
          "sg-a61988c3"
      ],
      "Policies": {
          "LBCookieStickinessPolicies": [
              {
                  "PolicyName": "my-duration-cookie-policy",
                  "CookieExpirationPeriod": 60
              }
          ],
          "AppCookieStickinessPolicies": [],
          "OtherPolicies": [
              "my-PublicKey-policy",
              "my-authentication-policy",
              "my-SSLNegotiation-policy",
              "my-ProxyProtocol-policy",
              "ELBSecurityPolicy-2015-03"
          ]
      },
      "LoadBalancerName": "my-load-balancer",
      "CreatedTime": "2015-03-19T03:24:02.650Z",
      "AvailabilityZones": [
          "us-west-2a"
      ],
      "Scheme": "internet-facing",
      "SourceSecurityGroup": {
          "OwnerAlias": "123456789012",
          "GroupName": "my-elb-sg"
      }
    }
  ]
}
```
+  For API details, see [DescribeLoadBalancers](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/describe-load-balancers.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example lists the names of your load balancers.**  

```
Get-ELBLoadBalancer | format-table -property LoadBalancerName
```
**Output:**  

```
LoadBalancerName
----------------
my-load-balancer
my-other-load-balancer
my-internal-load-balancer
```
**Example 2: This example describes the specified load balancer.**  

```
Get-ELBLoadBalancer -LoadBalancerName my-load-balancer
```
**Output:**  

```
AvailabilityZones         : {us-west-2a, us-west-2b}
BackendServerDescriptions : {Amazon.ElasticLoadBalancing.Model.BackendServerDescription}
CanonicalHostedZoneName   : my-load-balancer-1234567890.us-west-2.elb.amazonaws.com
CanonicalHostedZoneNameID : Z3DZXE0EXAMPLE
CreatedTime               : 4/11/2015 12:12:45 PM
DNSName                   : my-load-balancer-1234567890.us-west-2.elb.amazonaws.com
HealthCheck               : Amazon.ElasticLoadBalancing.Model.HealthCheck
Instances                 : {i-207d9717, i-afefb49b}
ListenerDescriptions      : {Amazon.ElasticLoadBalancing.Model.ListenerDescription}
LoadBalancerName          : my-load-balancer
Policies                  : Amazon.ElasticLoadBalancing.Model.Policies
Scheme                    : internet-facing
SecurityGroups            : {sg-a61988c3}
SourceSecurityGroup       : Amazon.ElasticLoadBalancing.Model.SourceSecurityGroup
Subnets                   : {subnet-15aaab61}
VPCId                     : vpc-a01106c2
```
**Example 3: This example describes all your load balancers in the current AWS region.**  

```
Get-ELBLoadBalancer
```
**Example 4: This example describes all your load balancers across all available AWS Regions.**  

```
Get-AWSRegion | % { Get-ELBLoadBalancer -Region $_ }
```
+  For API details, see [DescribeLoadBalancers](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example lists the names of your load balancers.**  

```
Get-ELBLoadBalancer | format-table -property LoadBalancerName
```
**Output:**  

```
LoadBalancerName
----------------
my-load-balancer
my-other-load-balancer
my-internal-load-balancer
```
**Example 2: This example describes the specified load balancer.**  

```
Get-ELBLoadBalancer -LoadBalancerName my-load-balancer
```
**Output:**  

```
AvailabilityZones         : {us-west-2a, us-west-2b}
BackendServerDescriptions : {Amazon.ElasticLoadBalancing.Model.BackendServerDescription}
CanonicalHostedZoneName   : my-load-balancer-1234567890.us-west-2.elb.amazonaws.com
CanonicalHostedZoneNameID : Z3DZXE0EXAMPLE
CreatedTime               : 4/11/2015 12:12:45 PM
DNSName                   : my-load-balancer-1234567890.us-west-2.elb.amazonaws.com
HealthCheck               : Amazon.ElasticLoadBalancing.Model.HealthCheck
Instances                 : {i-207d9717, i-afefb49b}
ListenerDescriptions      : {Amazon.ElasticLoadBalancing.Model.ListenerDescription}
LoadBalancerName          : my-load-balancer
Policies                  : Amazon.ElasticLoadBalancing.Model.Policies
Scheme                    : internet-facing
SecurityGroups            : {sg-a61988c3}
SourceSecurityGroup       : Amazon.ElasticLoadBalancing.Model.SourceSecurityGroup
Subnets                   : {subnet-15aaab61}
VPCId                     : vpc-a01106c2
```
**Example 3: This example describes all your load balancers in the current AWS region.**  

```
Get-ELBLoadBalancer
```
**Example 4: This example describes all your load balancers across all available AWS Regions.**  

```
Get-AWSRegion | % { Get-ELBLoadBalancer -Region $_ }
```
+  For API details, see [DescribeLoadBalancers](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `DescribeTags` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_DescribeTags_section"></a>

The following code examples show how to use `DescribeTags`.

------
#### [ CLI ]

**AWS CLI**  
**To describe the tags assigned to a load balancer**  
This example describes the tags assigned to the specified load balancer.  
Command:  

```
aws elb describe-tags --load-balancer-name my-load-balancer
```
Output:  

```
{
  "TagDescriptions": [
      {
          "Tags": [
              {
                  "Value": "lima",
                  "Key": "project"
              },
              {
                  "Value": "digital-media",
                  "Key": "department"
              }
          ],
          "LoadBalancerName": "my-load-balancer"
      }
  ]
}
```
+  For API details, see [DescribeTags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/describe-tags.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example lists the tags for the specified load balancers.**  

```
Get-ELBResourceTag -LoadBalancerName @("my-load-balancer","my-internal-load-balancer")
```
**Output:**  

```
LoadBalancerName             Tags
----------------             ----
my-load-balancer             {project, department}
my-internal-load-balancer    {project, department}
```
**Example 2: This example describes the tags for the specified load balancer.**  

```
(Get-ELBResourceTag -LoadBalancerName my-load-balancer).Tags
```
**Output:**  

```
Key           Value
---           -----
project       lima
department    digital-media
```
+  For API details, see [DescribeTags](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example lists the tags for the specified load balancers.**  

```
Get-ELBResourceTag -LoadBalancerName @("my-load-balancer","my-internal-load-balancer")
```
**Output:**  

```
LoadBalancerName             Tags
----------------             ----
my-load-balancer             {project, department}
my-internal-load-balancer    {project, department}
```
**Example 2: This example describes the tags for the specified load balancer.**  

```
(Get-ELBResourceTag -LoadBalancerName my-load-balancer).Tags
```
**Output:**  

```
Key           Value
---           -----
project       lima
department    digital-media
```
+  For API details, see [DescribeTags](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `DetachLoadBalancerFromSubnets` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_DetachLoadBalancerFromSubnets_section"></a>

The following code examples show how to use `DetachLoadBalancerFromSubnets`.

------
#### [ CLI ]

**AWS CLI**  
**To detach load balancers from subnets**  
This example detaches the specified load balancer from the specified subnet.  
Command:  

```
aws elb detach-load-balancer-from-subnets --load-balancer-name my-load-balancer --subnets subnet-0ecac448
```
Output:  

```
{
   "Subnets": [
       "subnet-15aaab61"
   ]
}
```
+  For API details, see [DetachLoadBalancerFromSubnets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/detach-load-balancer-from-subnets.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example removes the specified subnet from the set of subnets configured for the specified load balancer. The output includes the remaining subnets.**  

```
Dismount-ELBLoadBalancerFromSubnet -LoadBalancerName my-load-balancer -Subnet subnet-12345678
```
**Output:**  

```
subnet-87654321
```
+  For API details, see [DetachLoadBalancerFromSubnets](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example removes the specified subnet from the set of subnets configured for the specified load balancer. The output includes the remaining subnets.**  

```
Dismount-ELBLoadBalancerFromSubnet -LoadBalancerName my-load-balancer -Subnet subnet-12345678
```
**Output:**  

```
subnet-87654321
```
+  For API details, see [DetachLoadBalancerFromSubnets](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `DisableAvailabilityZonesForLoadBalancer` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_DisableAvailabilityZonesForLoadBalancer_section"></a>

The following code examples show how to use `DisableAvailabilityZonesForLoadBalancer`.

------
#### [ CLI ]

**AWS CLI**  
**To disable Availability Zones for a load balancer**  
This example removes the specified Availability Zone from the set of Availability Zones for the specified load balancer.  
Command:  

```
aws elb disable-availability-zones-for-load-balancer --load-balancer-name my-load-balancer --availability-zones us-west-2a
```
Output:  

```
{
    "AvailabilityZones": [
        "us-west-2b"
    ]
}
```
+  For API details, see [DisableAvailabilityZonesForLoadBalancer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/disable-availability-zones-for-load-balancer.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example removes the specified Availability Zone from the specified load balancer. The output includes the remaining Availability Zones.**  

```
Disable-ELBAvailabilityZoneForLoadBalancer -LoadBalancerName my-load-balancer -AvailabilityZone us-west-2a
```
**Output:**  

```
us-west-2b
```
+  For API details, see [DisableAvailabilityZonesForLoadBalancer](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example removes the specified Availability Zone from the specified load balancer. The output includes the remaining Availability Zones.**  

```
Disable-ELBAvailabilityZoneForLoadBalancer -LoadBalancerName my-load-balancer -AvailabilityZone us-west-2a
```
**Output:**  

```
us-west-2b
```
+  For API details, see [DisableAvailabilityZonesForLoadBalancer](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `EnableAvailabilityZonesForLoadBalancer` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_EnableAvailabilityZonesForLoadBalancer_section"></a>

The following code examples show how to use `EnableAvailabilityZonesForLoadBalancer`.

------
#### [ CLI ]

**AWS CLI**  
**To enable Availability Zones for a load balancer**  
This example adds the specified Availability Zone to the specified load balancer.  
Command:  

```
aws elb enable-availability-zones-for-load-balancer --load-balancer-name my-load-balancer --availability-zones us-west-2b
```
Output:  

```
{
    "AvailabilityZones": [
        "us-west-2a",
        "us-west-2b"
    ]
}
```
+  For API details, see [EnableAvailabilityZonesForLoadBalancer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/enable-availability-zones-for-load-balancer.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example adds the specified Availability Zone to the specified load balancer. The output includes the complete list of Availability Zones.**  

```
Enable-ELBAvailabilityZoneForLoadBalancer -LoadBalancerName my-load-balancer -AvailabilityZone us-west-2a
```
**Output:**  

```
us-west-2a
us-west-2b
```
+  For API details, see [EnableAvailabilityZonesForLoadBalancer](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example adds the specified Availability Zone to the specified load balancer. The output includes the complete list of Availability Zones.**  

```
Enable-ELBAvailabilityZoneForLoadBalancer -LoadBalancerName my-load-balancer -AvailabilityZone us-west-2a
```
**Output:**  

```
us-west-2a
us-west-2b
```
+  For API details, see [EnableAvailabilityZonesForLoadBalancer](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `ModifyLoadBalancerAttributes` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_ModifyLoadBalancerAttributes_section"></a>

The following code examples show how to use `ModifyLoadBalancerAttributes`.

------
#### [ CLI ]

**AWS CLI**  
**To modify the attributes of a load balancer**  
This example modifies the `CrossZoneLoadBalancing` attribute of the specified load balancer.  
Command:  

```
aws elb modify-load-balancer-attributes --load-balancer-name my-load-balancer --load-balancer-attributes "{\"CrossZoneLoadBalancing\":{\"Enabled\":true}}"
```
Output:  

```
{
    "LoadBalancerAttributes": {
        "CrossZoneLoadBalancing": {
            "Enabled": true
        }
    },
    "LoadBalancerName": "my-load-balancer"
}
```
This example modifies the `ConnectionDraining` attribute of the specified load balancer.  
Command:  

```
aws elb modify-load-balancer-attributes --load-balancer-name my-load-balancer --load-balancer-attributes "{\"ConnectionDraining\":{\"Enabled\":true,\"Timeout\":300}}"
```
Output:  

```
{
    "LoadBalancerAttributes": {
        "ConnectionDraining": {
            "Enabled": true,
            "Timeout": 300
        }
    },
    "LoadBalancerName": "my-load-balancer"
}
```
+  For API details, see [ModifyLoadBalancerAttributes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/modify-load-balancer-attributes.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example enables cross-zone load balancing for the specified load balancer.**  

```
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer -CrossZoneLoadBalancing_Enabled $true
```
**Example 2: This example disables connection draining for the specified load balancer.**  

```
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer -ConnectionDraining_Enabled $false
```
**Example 3: This example enables access logging for the specified load balancer.**  

```
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer `
>> -AccessLog_Enabled $true `
>> -AccessLog_S3BucketName amzn-s3-demo-logging-bucket `
>> -AccessLog_S3BucketPrefix my-app/prod `
>> -AccessLog_EmitInterval 60
```
+  For API details, see [ModifyLoadBalancerAttributes](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example enables cross-zone load balancing for the specified load balancer.**  

```
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer -CrossZoneLoadBalancing_Enabled $true
```
**Example 2: This example disables connection draining for the specified load balancer.**  

```
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer -ConnectionDraining_Enabled $false
```
**Example 3: This example enables access logging for the specified load balancer.**  

```
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer `
>> -AccessLog_Enabled $true `
>> -AccessLog_S3BucketName amzn-s3-demo-logging-bucket `
>> -AccessLog_S3BucketPrefix my-app/prod `
>> -AccessLog_EmitInterval 60
```
+  For API details, see [ModifyLoadBalancerAttributes](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `RegisterInstancesWithLoadBalancer` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_RegisterInstancesWithLoadBalancer_section"></a>

The following code examples show how to use `RegisterInstancesWithLoadBalancer`.

------
#### [ CLI ]

**AWS CLI**  
**To register instances with a load balancer**  
This example registers the specified instance with the specified load balancer.  
Command:  

```
aws elb register-instances-with-load-balancer --load-balancer-name my-load-balancer --instances i-d6f6fae3
```
Output:  

```
{
   "Instances": [
       {
           "InstanceId": "i-d6f6fae3"
       },
       {
           "InstanceId": "i-207d9717"
       },
       {
           "InstanceId": "i-afefb49b"
       }
   ]
}
```
+  For API details, see [RegisterInstancesWithLoadBalancer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/register-instances-with-load-balancer.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example registers the specified EC2 instance with the specified load balancer.**  

```
Register-ELBInstanceWithLoadBalancer -LoadBalancerName my-load-balancer -Instance i-12345678
```
**Output:**  

```
InstanceId
----------
i-12345678
i-87654321
```
+  For API details, see [RegisterInstancesWithLoadBalancer](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example registers the specified EC2 instance with the specified load balancer.**  

```
Register-ELBInstanceWithLoadBalancer -LoadBalancerName my-load-balancer -Instance i-12345678
```
**Output:**  

```
InstanceId
----------
i-12345678
i-87654321
```
+  For API details, see [RegisterInstancesWithLoadBalancer](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `RemoveTags` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_RemoveTags_section"></a>

The following code examples show how to use `RemoveTags`.

------
#### [ CLI ]

**AWS CLI**  
**To remove tags from a load balancer**  
This example removes a tag from the specified load balancer.  
Command:  

```
aws elb remove-tags --load-balancer-name my-load-balancer --tags project
```
+  For API details, see [RemoveTags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/remove-tags.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example removes the specified tag from the specified load balancer. You are prompted for confirmation before the operation proceeds, unless you also specify the Force parameter. The syntax used by this example requires PowerShell version 3 or later.**  

```
Remove-ELBResourceTag -LoadBalancerName my-load-balancer -Tag @{ Key="project" }
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-ELBResourceTag (RemoveTags)" on target "Amazon.ElasticLoadBalancing.Model.TagKeyOnly".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
**Example 2: With Powershell version 2, you must use New-Object to create the tag for the Tag parameter.**  

```
$tag = New-Object Amazon.ElasticLoadBalancing.Model.TagKeyOnly
$tag.Key = "project"
Remove-ELBResourceTag -Tag $tag -Force
```
+  For API details, see [RemoveTags](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example removes the specified tag from the specified load balancer. You are prompted for confirmation before the operation proceeds, unless you also specify the Force parameter. The syntax used by this example requires PowerShell version 3 or later.**  

```
Remove-ELBResourceTag -LoadBalancerName my-load-balancer -Tag @{ Key="project" }
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-ELBResourceTag (RemoveTags)" on target "Amazon.ElasticLoadBalancing.Model.TagKeyOnly".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
**Example 2: With Powershell version 2, you must use New-Object to create the tag for the Tag parameter.**  

```
$tag = New-Object Amazon.ElasticLoadBalancing.Model.TagKeyOnly
$tag.Key = "project"
Remove-ELBResourceTag -Tag $tag -Force
```
+  For API details, see [RemoveTags](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `SetLoadBalancerListenerSslCertificate` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_SetLoadBalancerListenerSslCertificate_section"></a>

The following code examples show how to use `SetLoadBalancerListenerSslCertificate`.

------
#### [ CLI ]

**AWS CLI**  
**To update the SSL certificate for an HTTPS load balancer**  
This example replaces the existing SSL certificate for the specified HTTPS load balancer.  
Command:  

```
aws elb set-load-balancer-listener-ssl-certificate --load-balancer-name my-load-balancer --load-balancer-port 443 --ssl-certificate-id arn:aws:iam::123456789012:server-certificate/new-server-cert
```
+  For API details, see [SetLoadBalancerListenerSslCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/set-load-balancer-listener-ssl-certificate.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example replaces the certificate that terminates the SSL connections for the specified listener.**  

```
Set-ELBLoadBalancerListenerSSLCertificate -LoadBalancerName my-load-balancer `
>> -LoadBalancerPort 443 `
>> -SSLCertificateId "arn:aws:iam::123456789012:server-certificate/new-server-cert"
```
+  For API details, see [SetLoadBalancerListenerSslCertificate](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example replaces the certificate that terminates the SSL connections for the specified listener.**  

```
Set-ELBLoadBalancerListenerSSLCertificate -LoadBalancerName my-load-balancer `
>> -LoadBalancerPort 443 `
>> -SSLCertificateId "arn:aws:iam::123456789012:server-certificate/new-server-cert"
```
+  For API details, see [SetLoadBalancerListenerSslCertificate](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `SetLoadBalancerPoliciesForBackendServer` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_SetLoadBalancerPoliciesForBackendServer_section"></a>

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-name my-load-balancer --instance-port 80 --policy-names my-ProxyProtocol-policy
```
**To 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-name my-load-balancer --instance-port 80 --policy-names []
```
To confirm that the policies are removed, use the `describe-load-balancer-policies` command.  
+  For API details, see [SetLoadBalancerPoliciesForBackendServer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/set-load-balancer-policies-for-backend-server.html) 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-policy
```
**Example 2: This example removes all policies associated with the specified port.**  

```
Set-ELBLoadBalancerPolicyForBackendServer -LoadBalancerName my-load-balancer -InstancePort 80
```
+  For API details, see [SetLoadBalancerPoliciesForBackendServer](https://docs.aws.amazon.com/powershell/v4/reference) 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-policy
```
**Example 2: This example removes all policies associated with the specified port.**  

```
Set-ELBLoadBalancerPolicyForBackendServer -LoadBalancerName my-load-balancer -InstancePort 80
```
+  For API details, see [SetLoadBalancerPoliciesForBackendServer](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------

# Use `SetLoadBalancerPoliciesOfListener` with a CLI
<a name="elastic-load-balancing_example_elastic-load-balancing_SetLoadBalancerPoliciesOfListener_section"></a>

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.  
+  For API details, see [SetLoadBalancerPoliciesOfListener](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elb/set-load-balancer-policies-of-listener.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**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
```
+  For API details, see [SetLoadBalancerPoliciesOfListener](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**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
```
+  For API details, see [SetLoadBalancerPoliciesOfListener](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------