/// <summary> /// Adds the specified Availability Zones to the set of Availability Zones for the specified load balancer. /// The load balancer evenly distributes requests across all its registered Availability Zones that contain instances. /// </summary> /// <param name="loadBalancer">The name associated with the load balancer.</param> /// <param name="zones">The Availability Zones to add to the load balancer.</param> /// <param name="settings">The <see cref="LoadBalancingSettings"/> used during the request to AWS.</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> public async Task <bool> EnableAvailabilityZones(string loadBalancer, IList <string> zones, LoadBalancingSettings settings, CancellationToken cancellationToken = default(CancellationToken)) { if (String.IsNullOrEmpty(loadBalancer)) { throw new ArgumentNullException("loadBalancer"); } if ((zones == null) || (zones.Count == 0)) { throw new ArgumentNullException("zones"); } //Create Request AmazonElasticLoadBalancingClient client = this.CreateClient(settings); EnableAvailabilityZonesForLoadBalancerRequest request = new EnableAvailabilityZonesForLoadBalancerRequest(); request.LoadBalancerName = loadBalancer; foreach (string zone in zones) { request.AvailabilityZones.Add(zone); } //Check Response EnableAvailabilityZonesForLoadBalancerResponse response = await client.EnableAvailabilityZonesForLoadBalancerAsync(request, cancellationToken); if (response.HttpStatusCode == HttpStatusCode.OK) { _Log.Verbose("Successfully enabled zones '{0}'", string.Join(",", zones)); return(true); } else { _Log.Error("Failed to enabled zones '{0}'", string.Join(",", zones)); return(false); } }