Table of Contents

Class CfnLoadBalancer

Namespace
Amazon.CDK.AWS.ElasticLoadBalancing
Assembly
Amazon.CDK.AWS.ElasticLoadBalancing.dll

A CloudFormation AWS::ElasticLoadBalancing::LoadBalancer.

public class CfnLoadBalancer : CfnResource, IInspectable
Inheritance
CfnLoadBalancer
Implements
IInspectable

Examples

// The code below shows an example of how to instantiate this type.
             // The values are placeholders you should change.
             using Amazon.CDK.AWS.ElasticLoadBalancing;

             var attributes;

             var cfnLoadBalancer = new CfnLoadBalancer(this, "MyCfnLoadBalancer", new CfnLoadBalancerProps {
                 Listeners = new [] { new ListenersProperty {
                     InstancePort = "instancePort",
                     LoadBalancerPort = "loadBalancerPort",
                     Protocol = "protocol",

                     // the properties below are optional
                     InstanceProtocol = "instanceProtocol",
                     PolicyNames = new [] { "policyNames" },
                     SslCertificateId = "sslCertificateId"
                 } },

                 // the properties below are optional
                 AccessLoggingPolicy = new AccessLoggingPolicyProperty {
                     Enabled = false,
                     S3BucketName = "s3BucketName",

                     // the properties below are optional
                     EmitInterval = 123,
                     S3BucketPrefix = "s3BucketPrefix"
                 },
                 AppCookieStickinessPolicy = new [] { new AppCookieStickinessPolicyProperty {
                     CookieName = "cookieName",
                     PolicyName = "policyName"
                 } },
                 AvailabilityZones = new [] { "availabilityZones" },
                 ConnectionDrainingPolicy = new ConnectionDrainingPolicyProperty {
                     Enabled = false,

                     // the properties below are optional
                     Timeout = 123
                 },
                 ConnectionSettings = new ConnectionSettingsProperty {
                     IdleTimeout = 123
                 },
                 CrossZone = false,
                 HealthCheck = new HealthCheckProperty {
                     HealthyThreshold = "healthyThreshold",
                     Interval = "interval",
                     Target = "target",
                     Timeout = "timeout",
                     UnhealthyThreshold = "unhealthyThreshold"
                 },
                 Instances = new [] { "instances" },
                 LbCookieStickinessPolicy = new [] { new LBCookieStickinessPolicyProperty {
                     CookieExpirationPeriod = "cookieExpirationPeriod",
                     PolicyName = "policyName"
                 } },
                 LoadBalancerName = "loadBalancerName",
                 Policies = new [] { new PoliciesProperty {
                     Attributes = new [] { attributes },
                     PolicyName = "policyName",
                     PolicyType = "policyType",

                     // the properties below are optional
                     InstancePorts = new [] { "instancePorts" },
                     LoadBalancerPorts = new [] { "loadBalancerPorts" }
                 } },
                 Scheme = "scheme",
                 SecurityGroups = new [] { "securityGroups" },
                 Subnets = new [] { "subnets" },
                 Tags = new [] { new CfnTag {
                     Key = "key",
                     Value = "value"
                 } }
             });

Remarks

Specifies a Classic Load Balancer.

You can specify the AvailabilityZones or Subnets property, but not both.

If this resource has a public IP address and is also in a VPC that is defined in the same template, you must use the DependsOn attribute to declare a dependency on the VPC-gateway attachment.

CloudformationResource: AWS::ElasticLoadBalancing::LoadBalancer

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html

ExampleMetadata: fixture=_generated

Constructors

CfnLoadBalancer(Construct, string, ICfnLoadBalancerProps)

Create a new AWS::ElasticLoadBalancing::LoadBalancer.

public CfnLoadBalancer(Construct scope, string id, ICfnLoadBalancerProps props)

Parameters

scope Construct
  • scope in which this resource is defined.
id string
  • scoped id of the resource.
props ICfnLoadBalancerProps
  • resource properties.

Properties

AccessLoggingPolicy

Information about where and how access logs are stored for the load balancer.

public virtual object? AccessLoggingPolicy { get; set; }

Property Value

object

Remarks

AppCookieStickinessPolicy

Information about a policy for application-controlled session stickiness.

public virtual object? AppCookieStickinessPolicy { get; set; }

Property Value

object

Remarks

AttrCanonicalHostedZoneName

The name of the Route 53 hosted zone that is associated with the load balancer.

public virtual string AttrCanonicalHostedZoneName { get; }

Property Value

string

Remarks

Internal-facing load balancers don't use this value, use DNSName instead.

CloudformationAttribute: CanonicalHostedZoneName

AttrCanonicalHostedZoneNameId

The ID of the Route 53 hosted zone name that is associated with the load balancer.

public virtual string AttrCanonicalHostedZoneNameId { get; }

Property Value

string

Remarks

CloudformationAttribute: CanonicalHostedZoneNameID

AttrDnsName

The DNS name for the load balancer.

public virtual string AttrDnsName { get; }

Property Value

string

Remarks

CloudformationAttribute: DNSName

AttrSourceSecurityGroupGroupName

The name of the security group that you can use as part of your inbound rules for your load balancer's back-end instances.

public virtual string AttrSourceSecurityGroupGroupName { get; }

Property Value

string

Remarks

CloudformationAttribute: SourceSecurityGroup.GroupName

AttrSourceSecurityGroupOwnerAlias

The owner of the source security group.

public virtual string AttrSourceSecurityGroupOwnerAlias { get; }

Property Value

string

Remarks

CloudformationAttribute: SourceSecurityGroup.OwnerAlias

AvailabilityZones

The Availability Zones for the load balancer. For load balancers in a VPC, specify Subnets instead.

public virtual string[]? AvailabilityZones { get; set; }

Property Value

string[]

Remarks

Update requires replacement if you did not previously specify an Availability Zone or if you are removing all Availability Zones. Otherwise, update requires no interruption.

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-availabilityzones

CFN_RESOURCE_TYPE_NAME

The CloudFormation resource type name for this resource class.

public static string CFN_RESOURCE_TYPE_NAME { get; }

Property Value

string

CfnProperties

protected override IDictionary<string, object> CfnProperties { get; }

Property Value

IDictionary<string, object>

ConnectionDrainingPolicy

If enabled, the load balancer allows existing requests to complete before the load balancer shifts traffic away from a deregistered or unhealthy instance.

public virtual object? ConnectionDrainingPolicy { get; set; }

Property Value

object

Remarks

ConnectionSettings

If enabled, the load balancer allows the connections to remain idle (no data is sent over the connection) for the specified duration.

public virtual object? ConnectionSettings { get; set; }

Property Value

object

Remarks

By default, Elastic Load Balancing maintains a 60-second idle connection timeout for both front-end and back-end connections of your load balancer. For more information, see Configure Idle Connection Timeout in the Classic Load Balancers Guide .

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-connectionsettings

CrossZone

If enabled, the load balancer routes the request traffic evenly across all instances regardless of the Availability Zones.

public virtual object? CrossZone { get; set; }

Property Value

object

Remarks

HealthCheck

The health check settings to use when evaluating the health of your EC2 instances.

public virtual object? HealthCheck { get; set; }

Property Value

object

Remarks

Update requires replacement if you did not previously specify health check settings or if you are removing the health check settings. Otherwise, update requires no interruption.

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-healthcheck

Instances

The IDs of the instances for the load balancer.

public virtual string[]? Instances { get; set; }

Property Value

string[]

Remarks

LbCookieStickinessPolicy

Information about a policy for duration-based session stickiness.

public virtual object? LbCookieStickinessPolicy { get; set; }

Property Value

object

Remarks

Listeners

The listeners for the load balancer. You can specify at most one listener per port.

public virtual object Listeners { get; set; }

Property Value

object

Remarks

If you update the properties for a listener, AWS CloudFormation deletes the existing listener and creates a new one with the specified properties. While the new listener is being created, clients cannot connect to the load balancer.

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-listeners

LoadBalancerName

The name of the load balancer.

public virtual string? LoadBalancerName { get; set; }

Property Value

string

Remarks

This name must be unique within your set of load balancers for the region.

If you don't specify a name, AWS CloudFormation generates a unique physical ID for the load balancer. For more information, see Name Type . If you specify a name, you cannot perform updates that require replacement of this resource, but you can perform other updates. To replace the resource, specify a new name.

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-elbname

Policies

The policies defined for your Classic Load Balancer.

public virtual object? Policies { get; set; }

Property Value

object

Remarks

Scheme

The type of load balancer. Valid only for load balancers in a VPC.

public virtual string? Scheme { get; set; }

Property Value

string

Remarks

If Scheme is internet-facing , the load balancer has a public DNS name that resolves to a public IP address.

If Scheme is internal , the load balancer has a public DNS name that resolves to a private IP address.

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-scheme

SecurityGroups

The security groups for the load balancer.

public virtual string[]? SecurityGroups { get; set; }

Property Value

string[]

Remarks

Subnets

The IDs of the subnets for the load balancer. You can specify at most one subnet per Availability Zone.

public virtual string[]? Subnets { get; set; }

Property Value

string[]

Remarks

Update requires replacement if you did not previously specify a subnet or if you are removing all subnets. Otherwise, update requires no interruption. To update to a different subnet in the current Availability Zone, you must first update to a subnet in a different Availability Zone, then update to the new subnet in the original Availability Zone.

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-subnets

Tags

The tags associated with a load balancer.

public virtual TagManager Tags { get; }

Property Value

TagManager

Remarks

Methods

Inspect(TreeInspector)

Examines the CloudFormation resource and discloses attributes.

public virtual void Inspect(TreeInspector inspector)

Parameters

inspector TreeInspector
  • tree inspector to collect and process attributes.

RenderProperties(IDictionary<string, object>)

protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)

Parameters

props IDictionary<string, object>

Returns

IDictionary<string, object>