Skip to content
v2.276.0

NetworkTargetProps Struct ​

Properties to define a network load balancer target group.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs_patterns as ecs_patterns } from 'aws-cdk-lib';
const networkTargetProps: ecs_patterns.NetworkTargetProps = {
  containerPort: 123,

  // the properties below are optional
  listener: 'listener',
};
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_ecs_patterns as ecs_patterns

network_target_props = ecs_patterns.NetworkTargetProps(
    container_port=123,

    # the properties below are optional
    listener="listener"
)
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.ecs.patterns.*;

NetworkTargetProps networkTargetProps = NetworkTargetProps.builder()
        .containerPort(123)

        // the properties below are optional
        .listener("listener")
        .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.ECS.Patterns;

var networkTargetProps = new NetworkTargetProps {
    ContainerPort = 123,

    // the properties below are optional
    Listener = "listener"
};
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"

networkTargetProps := &NetworkTargetProps{
	ContainerPort: jsii.Number(123),

	// the properties below are optional
	Listener: jsii.String("listener"),
}

Properties ​

containerPortnumbercontainer_portint | floatcontainerPortNumberContainerPortdoubleContainerPort*float64required#
The port number of the container.

Only applicable when using application/network load balancers.

listeneroptionalstringlisteneroptionalstrlisteneroptionalStringListeneroptionalstringListeneroptional*string#
Name of the listener the target group attached to.

Default: default listener (first added listener)