Skip to content
v2.278.0

BaseTargetGroupProps Struct ​

Basic properties of both Application and Network Target Groups.

Example ​

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

declare const vpc: ec2.Vpc;
const baseTargetGroupProps: elbv2.BaseTargetGroupProps = {
  crossZoneEnabled: false,
  deregistrationDelay: cdk.Duration.minutes(30),
  healthCheck: {
    enabled: false,
    healthyGrpcCodes: 'healthyGrpcCodes',
    healthyHttpCodes: 'healthyHttpCodes',
    healthyThresholdCount: 123,
    interval: cdk.Duration.minutes(30),
    path: 'path',
    port: 'port',
    protocol: elbv2.Protocol.HTTP,
    timeout: cdk.Duration.minutes(30),
    unhealthyThresholdCount: 123,
  },
  ipAddressType: elbv2.TargetGroupIpAddressType.IPV4,
  targetGroupHealth: {
    dnsMinimumHealthyTargetCount: 123,
    dnsMinimumHealthyTargetPercentage: 123,
    routingMinimumHealthyTargetCount: 123,
    routingMinimumHealthyTargetPercentage: 123,
  },
  targetGroupName: 'targetGroupName',
  targetType: elbv2.TargetType.INSTANCE,
  vpc: vpc,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_elasticloadbalancingv2 as elbv2

# vpc: ec2.Vpc

base_target_group_props = elbv2.BaseTargetGroupProps(
    cross_zone_enabled=False,
    deregistration_delay=cdk.Duration.minutes(30),
    health_check=elbv2.HealthCheck(
        enabled=False,
        healthy_grpc_codes="healthyGrpcCodes",
        healthy_http_codes="healthyHttpCodes",
        healthy_threshold_count=123,
        interval=cdk.Duration.minutes(30),
        path="path",
        port="port",
        protocol=elbv2.Protocol.HTTP,
        timeout=cdk.Duration.minutes(30),
        unhealthy_threshold_count=123
    ),
    ip_address_type=elbv2.TargetGroupIpAddressType.IPV4,
    target_group_health=elbv2.TargetGroupHealth(
        dns_minimum_healthy_target_count=123,
        dns_minimum_healthy_target_percentage=123,
        routing_minimum_healthy_target_count=123,
        routing_minimum_healthy_target_percentage=123
    ),
    target_group_name="targetGroupName",
    target_type=elbv2.TargetType.INSTANCE,
    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.*;
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.elasticloadbalancingv2.*;

Vpc vpc;

BaseTargetGroupProps baseTargetGroupProps = BaseTargetGroupProps.builder()
        .crossZoneEnabled(false)
        .deregistrationDelay(Duration.minutes(30))
        .healthCheck(HealthCheck.builder()
                .enabled(false)
                .healthyGrpcCodes("healthyGrpcCodes")
                .healthyHttpCodes("healthyHttpCodes")
                .healthyThresholdCount(123)
                .interval(Duration.minutes(30))
                .path("path")
                .port("port")
                .protocol(Protocol.HTTP)
                .timeout(Duration.minutes(30))
                .unhealthyThresholdCount(123)
                .build())
        .ipAddressType(TargetGroupIpAddressType.IPV4)
        .targetGroupHealth(TargetGroupHealth.builder()
                .dnsMinimumHealthyTargetCount(123)
                .dnsMinimumHealthyTargetPercentage(123)
                .routingMinimumHealthyTargetCount(123)
                .routingMinimumHealthyTargetPercentage(123)
                .build())
        .targetGroupName("targetGroupName")
        .targetType(TargetType.INSTANCE)
        .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;
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.ElasticLoadBalancingV2;

Vpc vpc;

var baseTargetGroupProps = new BaseTargetGroupProps {
    CrossZoneEnabled = false,
    DeregistrationDelay = Duration.Minutes(30),
    HealthCheck = new HealthCheck {
        Enabled = false,
        HealthyGrpcCodes = "healthyGrpcCodes",
        HealthyHttpCodes = "healthyHttpCodes",
        HealthyThresholdCount = 123,
        Interval = Duration.Minutes(30),
        Path = "path",
        Port = "port",
        Protocol = Protocol.HTTP,
        Timeout = Duration.Minutes(30),
        UnhealthyThresholdCount = 123
    },
    IpAddressType = TargetGroupIpAddressType.IPV4,
    TargetGroupHealth = new TargetGroupHealth {
        DnsMinimumHealthyTargetCount = 123,
        DnsMinimumHealthyTargetPercentage = 123,
        RoutingMinimumHealthyTargetCount = 123,
        RoutingMinimumHealthyTargetPercentage = 123
    },
    TargetGroupName = "targetGroupName",
    TargetType = TargetType.INSTANCE,
    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"
import "github.com/aws/aws-cdk-go/awscdk"

var vpc Vpc

baseTargetGroupProps := &BaseTargetGroupProps{
	CrossZoneEnabled: jsii.Boolean(false),
	DeregistrationDelay: cdk.Duration_Minutes(jsii.Number(30)),
	HealthCheck: &HealthCheck{
		Enabled: jsii.Boolean(false),
		HealthyGrpcCodes: jsii.String("healthyGrpcCodes"),
		HealthyHttpCodes: jsii.String("healthyHttpCodes"),
		HealthyThresholdCount: jsii.Number(123),
		Interval: cdk.Duration_*Minutes(jsii.Number(30)),
		Path: jsii.String("path"),
		Port: jsii.String("port"),
		Protocol: awscdk.Aws_elasticloadbalancingv2.Protocol_HTTP,
		Timeout: cdk.Duration_*Minutes(jsii.Number(30)),
		UnhealthyThresholdCount: jsii.Number(123),
	},
	IpAddressType: awscdk.*Aws_elasticloadbalancingv2.TargetGroupIpAddressType_IPV4,
	TargetGroupHealth: &TargetGroupHealth{
		DnsMinimumHealthyTargetCount: jsii.Number(123),
		DnsMinimumHealthyTargetPercentage: jsii.Number(123),
		RoutingMinimumHealthyTargetCount: jsii.Number(123),
		RoutingMinimumHealthyTargetPercentage: jsii.Number(123),
	},
	TargetGroupName: jsii.String("targetGroupName"),
	TargetType: awscdk.*Aws_elasticloadbalancingv2.TargetType_INSTANCE,
	Vpc: vpc,
}

Properties ​

crossZoneEnabledoptionalbooleancross_zone_enabledoptionalboolcrossZoneEnabledoptionalBooleanCrossZoneEnabledoptionalboolCrossZoneEnabledoptional*bool #
Indicates whether cross zone load balancing is enabled.

Default: use load balancer configuration

deregistrationDelayoptionalDurationderegistration_delayoptionalDurationderegistrationDelayoptionalDurationDeregistrationDelayoptionalDurationDeregistrationDelayoptionalDuration = 300 #
The amount of time for Elastic Load Balancing to wait before deregistering a target.

The range is 0-3600 seconds.

healthCheckoptionalHealthCheckhealth_checkoptionalHealthCheckhealthCheckoptionalHealthCheckHealthCheckoptionalHealthCheckHealthCheckoptionalHealthCheck #
Health check configuration.

Default: The default value for each property in this configuration varies depending on the target.

ipAddressTypeoptionalTargetGroupIpAddressTypeip_address_typeoptionalTargetGroupIpAddressTypeipAddressTypeoptionalTargetGroupIpAddressTypeIpAddressTypeoptionalTargetGroupIpAddressTypeIpAddressTypeoptionalTargetGroupIpAddressType #
The type of IP addresses of the targets registered with the target group.

Default: undefined - ELB defaults to IPv4

targetGroupHealthoptionalTargetGroupHealthtarget_group_healthoptionalTargetGroupHealthtargetGroupHealthoptionalTargetGroupHealthTargetGroupHealthoptionalTargetGroupHealthTargetGroupHealthoptionalTargetGroupHealth #
Configuring target group health.

Default: use default configuration

targetGroupNameoptionalstringtarget_group_nameoptionalstrtargetGroupNameoptionalStringTargetGroupNameoptionalstringTargetGroupNameoptional*string #
The name of the target group.

Default: Automatically generated.

This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.

targetTypeoptionalTargetTypetarget_typeoptionalTargetTypetargetTypeoptionalTargetTypeTargetTypeoptionalTargetTypeTargetTypeoptionalTargetType #
The type of targets registered to this TargetGroup, either IP or Instance.

Default: Determined automatically.

All targets registered into the group must be of this type. If you register targets to the TargetGroup in the CDK app, the TargetType is determined automatically.

vpcoptionalIVpcvpcoptionalIVpcvpcoptionalIVpcVpcoptionalIVpcVpcoptionalIVpc = undefined #
The virtual private cloud (VPC).

only if TargetType is Ip or InstanceId