Class ApplicationLoadBalancerProps
Properties for defining an Application Load Balancer.
Inheritance
Namespace: Amazon.CDK.AWS.ElasticLoadBalancingV2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ApplicationLoadBalancerProps : Object, IApplicationLoadBalancerProps, IBaseLoadBalancerProps
Syntax (vb)
Public Class ApplicationLoadBalancerProps
Inherits Object
Implements IApplicationLoadBalancerProps, IBaseLoadBalancerProps
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.AutoScaling;
AutoScalingGroup asg;
Vpc vpc;
// Create the load balancer in a VPC. 'internetFacing' is 'false'
// by default, which creates an internal load balancer.
var lb = new ApplicationLoadBalancer(this, "LB", new ApplicationLoadBalancerProps {
Vpc = vpc,
InternetFacing = true
});
// Add a listener and open up the load balancer's security group
// to the world.
var listener = lb.AddListener("Listener", new BaseApplicationListenerProps {
Port = 80,
// 'open: true' is the default, you can leave it out if you want. Set it
// to 'false' and use `listener.connections` if you want to be selective
// about who can access the load balancer.
Open = true
});
// Create an AutoScaling group and add it as a load balancing
// target to the listener.
listener.AddTargets("ApplicationFleet", new AddApplicationTargetsProps {
Port = 8080,
Targets = new [] { asg }
});
Synopsis
Constructors
ApplicationLoadBalancerProps() |
Properties
ClientKeepAlive | The client keep alive duration. |
CrossZoneEnabled | Indicates whether cross-zone load balancing is enabled. |
DeletionProtection | Indicates whether deletion protection is enabled. |
DenyAllIgwTraffic | Indicates whether the load balancer blocks traffic through the Internet Gateway (IGW). |
DesyncMitigationMode | Determines how the load balancer handles requests that might pose a security risk to your application. |
DropInvalidHeaderFields | Indicates whether HTTP headers with invalid header fields are removed by the load balancer (true) or routed to targets (false). |
Http2Enabled | Indicates whether HTTP/2 is enabled. |
IdleTimeout | The load balancer idle timeout, in seconds. |
InternetFacing | Whether the load balancer has an internet-routable address. |
IpAddressType | The type of IP addresses to use. |
LoadBalancerName | Name of the load balancer. |
PreserveHostHeader | Indicates whether the Application Load Balancer should preserve the host header in the HTTP request and send it to the target without any change. |
PreserveXffClientPort | Indicates whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer. |
SecurityGroup | Security group to associate with this load balancer. |
Vpc | The VPC network to place the load balancer in. |
VpcSubnets | Which subnets place the load balancer in. |
WafFailOpen | Indicates whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to AWS WAF. |
XAmznTlsVersionAndCipherSuiteHeaders | Indicates whether the two headers (x-amzn-tls-version and x-amzn-tls-cipher-suite), which contain information about the negotiated TLS version and cipher suite, are added to the client request before sending it to the target. |
XffHeaderProcessingMode | Enables you to modify, preserve, or remove the X-Forwarded-For header in the HTTP request before the Application Load Balancer sends the request to the target. |
Constructors
ApplicationLoadBalancerProps()
public ApplicationLoadBalancerProps()
Properties
ClientKeepAlive
The client keep alive duration.
public Duration ClientKeepAlive { get; set; }
Property Value
Remarks
The valid range is 60 to 604800 seconds (1 minute to 7 days).
Default: - Duration.seconds(3600)
CrossZoneEnabled
Indicates whether cross-zone load balancing is enabled.
public Nullable<bool> CrossZoneEnabled { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: - false for Network Load Balancers and true for Application Load Balancers.
DeletionProtection
Indicates whether deletion protection is enabled.
public Nullable<bool> DeletionProtection { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
DenyAllIgwTraffic
Indicates whether the load balancer blocks traffic through the Internet Gateway (IGW).
public Nullable<bool> DenyAllIgwTraffic { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: - false for internet-facing load balancers and true for internal load balancers
DesyncMitigationMode
Determines how the load balancer handles requests that might pose a security risk to your application.
public Nullable<DesyncMitigationMode> DesyncMitigationMode { get; set; }
Property Value
System.Nullable<DesyncMitigationMode>
Remarks
Default: DesyncMitigationMode.DEFENSIVE
DropInvalidHeaderFields
Indicates whether HTTP headers with invalid header fields are removed by the load balancer (true) or routed to targets (false).
public Nullable<bool> DropInvalidHeaderFields { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
Http2Enabled
Indicates whether HTTP/2 is enabled.
public Nullable<bool> Http2Enabled { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: true
IdleTimeout
The load balancer idle timeout, in seconds.
public Duration IdleTimeout { get; set; }
Property Value
Remarks
Default: 60
InternetFacing
Whether the load balancer has an internet-routable address.
public Nullable<bool> InternetFacing { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
IpAddressType
The type of IP addresses to use.
public Nullable<IpAddressType> IpAddressType { get; set; }
Property Value
System.Nullable<IpAddressType>
Remarks
Default: IpAddressType.IPV4
LoadBalancerName
Name of the load balancer.
public string LoadBalancerName { get; set; }
Property Value
System.String
Remarks
Default: - Automatically generated name.
PreserveHostHeader
Indicates whether the Application Load Balancer should preserve the host header in the HTTP request and send it to the target without any change.
public Nullable<bool> PreserveHostHeader { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
PreserveXffClientPort
Indicates whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer.
public Nullable<bool> PreserveXffClientPort { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
SecurityGroup
Security group to associate with this load balancer.
public ISecurityGroup SecurityGroup { get; set; }
Property Value
Remarks
Default: A security group is created
Vpc
VpcSubnets
Which subnets place the load balancer in.
public ISubnetSelection VpcSubnets { get; set; }
Property Value
Remarks
Default: - the Vpc default strategy.
WafFailOpen
Indicates whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to AWS WAF.
public Nullable<bool> WafFailOpen { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
XAmznTlsVersionAndCipherSuiteHeaders
Indicates whether the two headers (x-amzn-tls-version and x-amzn-tls-cipher-suite), which contain information about the negotiated TLS version and cipher suite, are added to the client request before sending it to the target.
public Nullable<bool> XAmznTlsVersionAndCipherSuiteHeaders { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
The x-amzn-tls-version header has information about the TLS protocol version negotiated with the client, and the x-amzn-tls-cipher-suite header has information about the cipher suite negotiated with the client.
Both headers are in OpenSSL format.
Default: false
XffHeaderProcessingMode
Enables you to modify, preserve, or remove the X-Forwarded-For header in the HTTP request before the Application Load Balancer sends the request to the target.
public Nullable<XffHeaderProcessingMode> XffHeaderProcessingMode { get; set; }
Property Value
System.Nullable<XffHeaderProcessingMode>
Remarks
Default: XffHeaderProcessingMode.APPEND