AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Contains the output for CreateLoadBalancer.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceResponse
    Amazon.ElasticLoadBalancing.Model.CreateLoadBalancerResponse

Namespace: Amazon.ElasticLoadBalancing.Model
Assembly: AWSSDK.ElasticLoadBalancing.dll
Version: 3.x.y.z

Syntax

C#
public class CreateLoadBalancerResponse : AmazonWebServiceResponse

The CreateLoadBalancerResponse type exposes the following members

Constructors

Properties

NameTypeDescription
Public Property ContentLength System.Int64 Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property DNSName System.String

Gets and sets the property DNSName.

The DNS name of the load balancer.

Public Property HttpStatusCode System.Net.HttpStatusCode Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property ResponseMetadata Amazon.Runtime.ResponseMetadata Inherited from Amazon.Runtime.AmazonWebServiceResponse.

Examples

This example creates a load balancer with an HTTP listener in a VPC.

To create an HTTP load balancer in a VPC


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",
    SecurityGroups = new List<string> {
        "sg-a61988c3"
    },
    Subnets = new List<string> {
        "subnet-15aaab61"
    }
});

string dnsName = response.DNSName;

            

This example creates a load balancer with an HTTP listener in EC2-Classic.

To create an HTTP load balancer in EC2-Classic


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;

            

This example creates a load balancer with an HTTPS listener in a VPC.

To create an HTTPS load balancer in a VPC


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;

            

This example creates a load balancer with an HTTPS listener in EC2-Classic.

To create an HTTPS load balancer in EC2-Classic


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;

            

This example creates an internal load balancer with an HTTP listener in a VPC.

To create an internal load balancer


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;

            

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5