Class LoadBalancerProps
Construction properties for a LoadBalancer.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.ElasticLoadBalancing
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class LoadBalancerProps : Object, ILoadBalancerProps
Syntax (vb)
Public Class LoadBalancerProps
Inherits Object
Implements ILoadBalancerProps
Remarks
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
LoadBalancerProps() |
Properties
AccessLoggingPolicy | Enable Loadbalancer access logs Can be used to avoid manual work as aws console Required S3 bucket name , enabled flag Can add interval for pushing log Can set bucket prefix in order to provide folder name inside bucket. |
CrossZone | Whether cross zone load balancing is enabled. |
HealthCheck | Health check settings for the load balancing targets. |
InternetFacing | Whether this is an internet-facing Load Balancer. |
Listeners | What listeners to set up for the load balancer. |
SubnetSelection | Which subnets to deploy the load balancer. |
Targets | What targets to load balance to. |
Vpc | VPC network of the fleet instances. |
Constructors
LoadBalancerProps()
public LoadBalancerProps()
Properties
AccessLoggingPolicy
Enable Loadbalancer access logs Can be used to avoid manual work as aws console Required S3 bucket name , enabled flag Can add interval for pushing log Can set bucket prefix in order to provide folder name inside bucket.
public CfnLoadBalancer.IAccessLoggingPolicyProperty AccessLoggingPolicy { get; set; }
Property Value
CfnLoadBalancer.IAccessLoggingPolicyProperty
Remarks
Default: - disabled
CrossZone
Whether cross zone load balancing is enabled.
public Nullable<bool> CrossZone { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
This controls whether the load balancer evenly distributes requests across each availability zone
Default: true
HealthCheck
Health check settings for the load balancing targets.
public IHealthCheck HealthCheck { get; set; }
Property Value
Remarks
Not required but recommended.
Default: - None.
InternetFacing
Whether this is an internet-facing Load Balancer.
public Nullable<bool> InternetFacing { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
This controls whether the LB has a public IP address assigned. It does not open up the Load Balancer's security groups to public internet access.
Default: false
Listeners
What listeners to set up for the load balancer.
public ILoadBalancerListener[] Listeners { get; set; }
Property Value
Remarks
Can also be added by .addListener()
Default: -
SubnetSelection
Which subnets to deploy the load balancer.
public ISubnetSelection SubnetSelection { get; set; }
Property Value
Remarks
Can be used to define a specific set of subnets to deploy the load balancer to. Useful multiple public or private subnets are covering the same availability zone.
Default: - Public subnets if internetFacing, Private subnets otherwise
Targets
What targets to load balance to.
public ILoadBalancerTarget[] Targets { get; set; }
Property Value
Remarks
Can also be added by .addTarget()
Default: - None.