public async Task CreateLoadBalancer() { _context.Logger.WriteLine("CreateLoadBalancer"); var subNets = await GetSubNets(); var securityGroups = await GetSecurityGroups(); var request = new CreateLoadBalancerRequest { LoadBalancerName = _task.Name, AvailabilityZones = _cluster.AvailabilityZones.ToList(), Subnets = subNets, Listeners = { new Listener("http", _task.HostPort, _task.HostPort) }, Scheme = "internet-facing", SecurityGroups = securityGroups }; await _client.CreateLoadBalancerAsync(request); }
private Amazon.ElasticLoadBalancing.Model.CreateLoadBalancerResponse CallAWSServiceOperation(IAmazonElasticLoadBalancing client, Amazon.ElasticLoadBalancing.Model.CreateLoadBalancerRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Elastic Load Balancing", "CreateLoadBalancer"); try { #if DESKTOP return(client.CreateLoadBalancer(request)); #elif CORECLR return(client.CreateLoadBalancerAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }