Skip to content
v2.277.0

ApplicationLoadBalancerAttributes Struct ​

Properties to reference an existing load balancer.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_elasticloadbalancingv2 as elbv2 } from 'aws-cdk-lib';

declare const vpc: ec2.Vpc;
const applicationLoadBalancerAttributes: elbv2.ApplicationLoadBalancerAttributes = {
  loadBalancerArn: 'loadBalancerArn',
  securityGroupId: 'securityGroupId',

  // the properties below are optional
  loadBalancerCanonicalHostedZoneId: 'loadBalancerCanonicalHostedZoneId',
  loadBalancerDnsName: 'loadBalancerDnsName',
  securityGroupAllowsAllOutbound: false,
  vpc: vpc,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_elasticloadbalancingv2 as elbv2

# vpc: ec2.Vpc

application_load_balancer_attributes = elbv2.ApplicationLoadBalancerAttributes(
    load_balancer_arn="loadBalancerArn",
    security_group_id="securityGroupId",

    # the properties below are optional
    load_balancer_canonical_hosted_zone_id="loadBalancerCanonicalHostedZoneId",
    load_balancer_dns_name="loadBalancerDnsName",
    security_group_allows_all_outbound=False,
    vpc=vpc
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.elasticloadbalancingv2.*;

Vpc vpc;

ApplicationLoadBalancerAttributes applicationLoadBalancerAttributes = ApplicationLoadBalancerAttributes.builder()
        .loadBalancerArn("loadBalancerArn")
        .securityGroupId("securityGroupId")

        // the properties below are optional
        .loadBalancerCanonicalHostedZoneId("loadBalancerCanonicalHostedZoneId")
        .loadBalancerDnsName("loadBalancerDnsName")
        .securityGroupAllowsAllOutbound(false)
        .vpc(vpc)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.ElasticLoadBalancingV2;

Vpc vpc;

var applicationLoadBalancerAttributes = new ApplicationLoadBalancerAttributes {
    LoadBalancerArn = "loadBalancerArn",
    SecurityGroupId = "securityGroupId",

    // the properties below are optional
    LoadBalancerCanonicalHostedZoneId = "loadBalancerCanonicalHostedZoneId",
    LoadBalancerDnsName = "loadBalancerDnsName",
    SecurityGroupAllowsAllOutbound = false,
    Vpc = vpc
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var vpc Vpc

applicationLoadBalancerAttributes := &ApplicationLoadBalancerAttributes{
	LoadBalancerArn: jsii.String("loadBalancerArn"),
	SecurityGroupId: jsii.String("securityGroupId"),

	// the properties below are optional
	LoadBalancerCanonicalHostedZoneId: jsii.String("loadBalancerCanonicalHostedZoneId"),
	LoadBalancerDnsName: jsii.String("loadBalancerDnsName"),
	SecurityGroupAllowsAllOutbound: jsii.Boolean(false),
	Vpc: vpc,
}

Properties ​

loadBalancerArnstringload_balancer_arnstrloadBalancerArnStringLoadBalancerArnstringLoadBalancerArn*stringrequired#
ARN of the load balancer.
loadBalancerCanonicalHostedZoneIdoptionalstringload_balancer_canonical_hosted_zone_idoptionalstrloadBalancerCanonicalHostedZoneIdoptionalStringLoadBalancerCanonicalHostedZoneIdoptionalstringLoadBalancerCanonicalHostedZoneIdoptional*string#
The canonical hosted zone ID of this load balancer.

Default: When not provided, LB cannot be used as Route53 Alias target.

loadBalancerDnsNameoptionalstringload_balancer_dns_nameoptionalstrloadBalancerDnsNameoptionalStringLoadBalancerDnsNameoptionalstringLoadBalancerDnsNameoptional*string#
The DNS name of this load balancer.

Default: When not provided, LB cannot be used as Route53 Alias target.

securityGroupAllowsAllOutboundoptionalbooleansecurity_group_allows_all_outboundoptionalboolsecurityGroupAllowsAllOutboundoptionalBooleanSecurityGroupAllowsAllOutboundoptionalboolSecurityGroupAllowsAllOutboundoptional*bool= true#
Whether the security group allows all outbound traffic or not.

Unless set to false, no egress rules will be added to the security group.

securityGroupIdstringsecurity_group_idstrsecurityGroupIdStringSecurityGroupIdstringSecurityGroupId*stringrequired#
ID of the load balancer's security group.
vpcoptionalIVpcvpcoptionalIVpcvpcoptionalIVpcVpcoptionalIVpcVpcoptionalIVpc#
The VPC this load balancer has been created in, if available.

Default: If the Load Balancer was imported and a VPC was not specified, the VPC is not available.