Ejemplo n.º 1
0
        public void ElasticLoadBalancingCreateLoadBalancer()
        {
            #region elb-create-load-balancer-5

            var client   = new AmazonElasticLoadBalancingClient();
            var response = client.CreateLoadBalancer(new CreateLoadBalancerRequest
            {
                Listeners = new List <Listener> {
                    new Listener {
                        InstancePort     = 80,
                        InstanceProtocol = "HTTP",
                        LoadBalancerPort = 80,
                        Protocol         = "HTTP"
                    }
                },
                LoadBalancerName = "my-load-balancer",
                Scheme           = "internal",
                SecurityGroups   = new List <string> {
                    "sg-a61988c3"
                },
                Subnets = new List <string> {
                    "subnet-15aaab61"
                }
            });

            string dnsName = response.DNSName;

            #endregion
        }
Ejemplo n.º 2
0
        public void ElasticLoadBalancingCreateLoadBalancer()
        {
            #region elb-create-load-balancer-3

            var client   = new AmazonElasticLoadBalancingClient();
            var response = client.CreateLoadBalancer(new CreateLoadBalancerRequest
            {
                Listeners = new List <Listener> {
                    new Listener {
                        InstancePort     = 80,
                        InstanceProtocol = "HTTP",
                        LoadBalancerPort = 80,
                        Protocol         = "HTTP"
                    },
                    new Listener {
                        InstancePort     = 80,
                        InstanceProtocol = "HTTP",
                        LoadBalancerPort = 443,
                        Protocol         = "HTTPS",
                        SSLCertificateId = "arn:aws:iam::123456789012:server-certificate/my-server-cert"
                    }
                },
                LoadBalancerName = "my-load-balancer",
                SecurityGroups   = new List <string> {
                    "sg-a61988c3"
                },
                Subnets = new List <string> {
                    "subnet-15aaab61"
                }
            });

            string dnsName = response.DNSName;

            #endregion
        }
Ejemplo n.º 3
0
        public void ElasticLoadBalancingCreateLoadBalancer()
        {
            #region elb-create-load-balancer-4

            var client   = new AmazonElasticLoadBalancingClient();
            var response = client.CreateLoadBalancer(new CreateLoadBalancerRequest
            {
                AvailabilityZones = new List <string> {
                    "us-west-2a"
                },
                Listeners = new List <Listener> {
                    new Listener {
                        InstancePort     = 80,
                        InstanceProtocol = "HTTP",
                        LoadBalancerPort = 80,
                        Protocol         = "HTTP"
                    },
                    new Listener {
                        InstancePort     = 80,
                        InstanceProtocol = "HTTP",
                        LoadBalancerPort = 443,
                        Protocol         = "HTTPS",
                        SSLCertificateId = "arn:aws:iam::123456789012:server-certificate/my-server-cert"
                    }
                },
                LoadBalancerName = "my-load-balancer"
            });

            string dnsName = response.DNSName;

            #endregion
        }
Ejemplo n.º 4
0
        public void ElasticLoadBalancingCreateLoadBalancer()
        {
            #region elb-create-load-balancer-2

            var client   = new AmazonElasticLoadBalancingClient();
            var response = client.CreateLoadBalancer(new CreateLoadBalancerRequest
            {
                AvailabilityZones = new List <string> {
                    "us-west-2a"
                },
                Listeners = new List <Listener> {
                    new Listener {
                        InstancePort     = 80,
                        InstanceProtocol = "HTTP",
                        LoadBalancerPort = 80,
                        Protocol         = "HTTP"
                    }
                },
                LoadBalancerName = "my-load-balancer"
            });

            string dnsName = response.DNSName;

            #endregion
        }
Ejemplo n.º 5
0
        public override Result Execute(ConDepSettings settings, CancellationToken token)
        {
            var client   = new AmazonElasticLoadBalancingClient(GetCredentials(settings), GetEndpoint(settings));
            var response = client.CreateLoadBalancer(_request);

            foreach (var server in settings.Config.Servers)
            {
                server.LoadBalancerFarm = _request.LoadBalancerName;
            }

            var result = response.HttpStatusCode == HttpStatusCode.Created ? Result.SuccessChanged() : Result.SuccessUnChanged();

            result.Data.LoadBalancerDnsName = response.DNSName;
            result.Data.HttpStatusCode      = response.HttpStatusCode;
            return(result);
        }