Class LoadBalancer
A load balancer with a single listener.
Inherited Members
Namespace: Amazon.CDK.AWS.ElasticLoadBalancing
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class LoadBalancer : Resource, IResource, IConnectable
Syntax (vb)
Public Class LoadBalancer
Inherits Resource
Implements IResource, IConnectable
Remarks
Routes to a fleet of of instances in a VPC.
ExampleMetadata: infused
Examples
Cluster cluster;
TaskDefinition taskDefinition;
Vpc vpc;
var service = new Ec2Service(this, "Service", new Ec2ServiceProps { Cluster = cluster, TaskDefinition = taskDefinition });
var lb = new LoadBalancer(this, "LB", new LoadBalancerProps { Vpc = vpc });
lb.AddListener(new LoadBalancerListener { ExternalPort = 80 });
lb.AddTarget(service.LoadBalancerTarget(new LoadBalancerTargetOptions {
ContainerName = "MyContainer",
ContainerPort = 80
}));
Synopsis
Constructors
LoadBalancer(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
LoadBalancer(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
LoadBalancer(Construct, String, ILoadBalancerProps) |
Properties
Connections | Control all connections from and to this load balancer. |
ListenerPorts | An object controlling specifically the connections for each listener added to this load balancer. |
LoadBalancerCanonicalHostedZoneName | |
LoadBalancerCanonicalHostedZoneNameId | |
LoadBalancerDnsName | |
LoadBalancerName | |
LoadBalancerSourceSecurityGroupGroupName | |
LoadBalancerSourceSecurityGroupOwnerAlias |
Methods
AddListener(ILoadBalancerListener) | Add a backend to the load balancer. |
AddTarget(ILoadBalancerTarget) |
Constructors
LoadBalancer(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected LoadBalancer(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
LoadBalancer(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected LoadBalancer(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
LoadBalancer(Construct, String, ILoadBalancerProps)
public LoadBalancer(Construct scope, string id, ILoadBalancerProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props ILoadBalancerProps
Properties
Connections
Control all connections from and to this load balancer.
public virtual Connections_ Connections { get; }
Property Value
ListenerPorts
An object controlling specifically the connections for each listener added to this load balancer.
public virtual ListenerPort[] ListenerPorts { get; }
Property Value
LoadBalancerCanonicalHostedZoneName
public virtual string LoadBalancerCanonicalHostedZoneName { get; }
Property Value
System.String
Remarks
Attribute: true
LoadBalancerCanonicalHostedZoneNameId
public virtual string LoadBalancerCanonicalHostedZoneNameId { get; }
Property Value
System.String
Remarks
Attribute: true
LoadBalancerDnsName
public virtual string LoadBalancerDnsName { get; }
Property Value
System.String
Remarks
Attribute: true
LoadBalancerName
public virtual string LoadBalancerName { get; }
Property Value
System.String
Remarks
Attribute: true
LoadBalancerSourceSecurityGroupGroupName
public virtual string LoadBalancerSourceSecurityGroupGroupName { get; }
Property Value
System.String
Remarks
Attribute: true
LoadBalancerSourceSecurityGroupOwnerAlias
public virtual string LoadBalancerSourceSecurityGroupOwnerAlias { get; }
Property Value
System.String
Remarks
Attribute: true
Methods
AddListener(ILoadBalancerListener)
Add a backend to the load balancer.
public virtual ListenerPort AddListener(ILoadBalancerListener listener)
Parameters
- listener ILoadBalancerListener
Returns
A ListenerPort object that controls connections to the listener port