There are more AWS SDK examples available in the AWS Doc SDK Examples
Use RegisterInstancesWithLoadBalancer
with a CLI
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
--instancesi-d6f6fae3
Output:
{ "Instances": [ { "InstanceId": "i-d6f6fae3" }, { "InstanceId": "i-207d9717" }, { "InstanceId": "i-afefb49b" } ] }
-
For API details, see RegisterInstancesWithLoadBalancer
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 in AWS Tools for PowerShell Cmdlet Reference (V4).
-