aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationTargetGroupProps

interface ApplicationTargetGroupProps

LanguageType name
.NETAmazon.CDK.AWS.ElasticLoadBalancingV2.ApplicationTargetGroupProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancingv2#ApplicationTargetGroupProps
Javasoftware.amazon.awscdk.services.elasticloadbalancingv2.ApplicationTargetGroupProps
Pythonaws_cdk.aws_elasticloadbalancingv2.ApplicationTargetGroupProps
TypeScript (source)aws-cdk-lib » aws_elasticloadbalancingv2 » ApplicationTargetGroupProps

Properties for defining an Application Target Group.

Example

declare const vpc: ec2.Vpc;

// Target group with duration-based stickiness with load-balancer generated cookie
const tg1 = new elbv2.ApplicationTargetGroup(this, 'TG1', {
  targetType: elbv2.TargetType.INSTANCE,
  port: 80,
  stickinessCookieDuration: Duration.minutes(5),
  vpc,
});

// Target group with application-based stickiness
const tg2 = new elbv2.ApplicationTargetGroup(this, 'TG2', {
  targetType: elbv2.TargetType.INSTANCE,
  port: 80,
  stickinessCookieDuration: Duration.minutes(5),
  stickinessCookieName: 'MyDeliciousCookie',
  vpc,
});

Properties

NameTypeDescription
deregistrationDelay?DurationThe amount of time for Elastic Load Balancing to wait before deregistering a target.
healthCheck?HealthCheckHealth check configuration.
loadBalancingAlgorithmType?TargetGroupLoadBalancingAlgorithmTypeThe load balancing algorithm to select targets for routing requests.
port?numberThe port on which the target receives traffic.
protocol?ApplicationProtocolThe protocol used for communication with the target.
protocolVersion?ApplicationProtocolVersionThe protocol version to use.
slowStart?DurationThe time period during which the load balancer sends a newly registered target a linearly increasing share of the traffic to the target group.
stickinessCookieDuration?DurationThe stickiness cookie expiration period.
stickinessCookieName?stringThe name of an application-based stickiness cookie.
targetGroupName?stringThe name of the target group.
targetType?TargetTypeThe type of targets registered to this TargetGroup, either IP or Instance.
targets?IApplicationLoadBalancerTarget[]The targets to add to this target group.
vpc?IVpcThe virtual private cloud (VPC).

deregistrationDelay?

Type: Duration (optional, default: 300)

The amount of time for Elastic Load Balancing to wait before deregistering a target.

The range is 0-3600 seconds.


healthCheck?

Type: HealthCheck (optional, default: The default value for each property in this configuration varies depending on the target.)

Health check configuration.

See also: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#aws-resource-elasticloadbalancingv2-targetgroup-properties


loadBalancingAlgorithmType?

Type: TargetGroupLoadBalancingAlgorithmType (optional, default: TargetGroupLoadBalancingAlgorithmType.ROUND_ROBIN)

The load balancing algorithm to select targets for routing requests.


port?

Type: number (optional, default: Determined from protocol if known)

The port on which the target receives traffic.

This is not applicable for Lambda targets.


protocol?

Type: ApplicationProtocol (optional, default: Determined from port if known)

The protocol used for communication with the target.

This is not applicable for Lambda targets.


protocolVersion?

Type: ApplicationProtocolVersion (optional, default: ApplicationProtocolVersion.HTTP1)

The protocol version to use.


slowStart?

Type: Duration (optional, default: 0)

The time period during which the load balancer sends a newly registered target a linearly increasing share of the traffic to the target group.

The range is 30-900 seconds (15 minutes).


stickinessCookieDuration?

Type: Duration (optional, default: Duration.days(1))

The stickiness cookie expiration period.

Setting this value enables load balancer stickiness.

After this period, the cookie is considered stale. The minimum value is 1 second and the maximum value is 7 days (604800 seconds).


stickinessCookieName?

Type: string (optional, default: If stickinessCookieDuration is set, a load-balancer generated cookie is used. Otherwise, no stickiness is defined.)

The name of an application-based stickiness cookie.

Names that start with the following prefixes are not allowed: AWSALB, AWSALBAPP, and AWSALBTG; they're reserved for use by the load balancer.

Note: stickinessCookieName parameter depends on the presence of stickinessCookieDuration parameter. If stickinessCookieDuration is not set, stickinessCookieName will be omitted.

See also: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/sticky-sessions.html


targetGroupName?

Type: string (optional, default: Automatically generated.)

The name of the target group.

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.


targetType?

Type: TargetType (optional, default: Determined automatically.)

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

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.


targets?

Type: IApplicationLoadBalancerTarget[] (optional, default: No targets.)

The targets to add to this target group.

Can be Instance, IPAddress, or any self-registering load balancing target. If you use either Instance or IPAddress as targets, all target must be of the same type.


vpc?

Type: IVpc (optional, default: undefined)

The virtual private cloud (VPC).

only if TargetType is Ip or InstanceId