Skip to content
v2.273.0

ApplicationMultipleTargetGroupsFargateService L3 construct ​

A Fargate service running on an ECS cluster fronted by an application load balancer.

Example ​

ts
import { Certificate } from 'aws-cdk-lib/aws-certificatemanager';
import { InstanceType } from 'aws-cdk-lib/aws-ec2';
import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs';
import { ApplicationProtocol, SslPolicy } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
import { PublicHostedZone } from 'aws-cdk-lib/aws-route53';
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 1 });
const loadBalancedFargateService = new ecsPatterns.ApplicationMultipleTargetGroupsFargateService(this, 'myService', {
  cluster: new ecs.Cluster(this, 'EcsCluster', { vpc }),
  memoryLimitMiB: 256,
  taskImageOptions: {
    image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
  },
  enableExecuteCommand: true,
  loadBalancers: [
    {
      name: 'lb',
      idleTimeout: Duration.seconds(400),
      domainName: 'api.example.com',
      domainZone: new PublicHostedZone(this, 'HostedZone', { zoneName: 'example.com' }),
      listeners: [
        {
          name: 'listener',
          protocol: ApplicationProtocol.HTTPS,
          certificate: Certificate.fromCertificateArn(this, 'Cert', 'helloworld'),
          sslPolicy: SslPolicy.TLS12_EXT,
        },
      ],
    },
    {
      name: 'lb2',
      idleTimeout: Duration.seconds(120),
      domainName: 'frontend.com',
      domainZone: new PublicHostedZone(this, 'HostedZone', { zoneName: 'frontend.com' }),
      listeners: [
        {
          name: 'listener2',
          protocol: ApplicationProtocol.HTTPS,
          certificate: Certificate.fromCertificateArn(this, 'Cert2', 'helloworld'),
          sslPolicy: SslPolicy.TLS12_EXT,
        },
      ],
    },
  ],
  targetGroups: [
    {
      containerPort: 80,
      listener: 'listener',
    },
    {
      containerPort: 90,
      pathPattern: 'a/b/c',
      priority: 10,
      listener: 'listener',
    },
    {
      containerPort: 443,
      listener: 'listener2',
    },
    {
      containerPort: 80,
      pathPattern: 'a/b/c',
      priority: 10,
      listener: 'listener2',
    },
  ],
});
python
from aws_cdk.aws_certificatemanager import Certificate
from aws_cdk.aws_ec2 import InstanceType
from aws_cdk.aws_ecs import Cluster, ContainerImage
from aws_cdk.aws_elasticloadbalancingv2 import ApplicationProtocol, SslPolicy
from aws_cdk.aws_route53 import PublicHostedZone

vpc = ec2.Vpc(self, "Vpc", max_azs=1)
load_balanced_fargate_service = ecs_patterns.ApplicationMultipleTargetGroupsFargateService(self, "myService",
    cluster=ecs.Cluster(self, "EcsCluster", vpc=vpc),
    memory_limit_mi_b=256,
    task_image_options=ecsPatterns.ApplicationLoadBalancedTaskImageProps(
        image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample")
    ),
    enable_execute_command=True,
    load_balancers=[ecsPatterns.ApplicationLoadBalancerProps(
        name="lb",
        idle_timeout=Duration.seconds(400),
        domain_name="api.example.com",
        domain_zone=PublicHostedZone(self, "HostedZone", zone_name="example.com"),
        listeners=[ecsPatterns.ApplicationListenerProps(
            name="listener",
            protocol=ApplicationProtocol.HTTPS,
            certificate=Certificate.from_certificate_arn(self, "Cert", "helloworld"),
            ssl_policy=SslPolicy.TLS12_EXT
        )
        ]
    ), ecsPatterns.ApplicationLoadBalancerProps(
        name="lb2",
        idle_timeout=Duration.seconds(120),
        domain_name="frontend.com",
        domain_zone=PublicHostedZone(self, "HostedZone", zone_name="frontend.com"),
        listeners=[ecsPatterns.ApplicationListenerProps(
            name="listener2",
            protocol=ApplicationProtocol.HTTPS,
            certificate=Certificate.from_certificate_arn(self, "Cert2", "helloworld"),
            ssl_policy=SslPolicy.TLS12_EXT
        )
        ]
    )
    ],
    target_groups=[ecsPatterns.ApplicationTargetProps(
        container_port=80,
        listener="listener"
    ), ecsPatterns.ApplicationTargetProps(
        container_port=90,
        path_pattern="a/b/c",
        priority=10,
        listener="listener"
    ), ecsPatterns.ApplicationTargetProps(
        container_port=443,
        listener="listener2"
    ), ecsPatterns.ApplicationTargetProps(
        container_port=80,
        path_pattern="a/b/c",
        priority=10,
        listener="listener2"
    )
    ]
)
java
import software.amazon.awscdk.services.certificatemanager.Certificate;
import software.amazon.awscdk.services.ec2.InstanceType;
import software.amazon.awscdk.services.ecs.Cluster;
import software.amazon.awscdk.services.ecs.ContainerImage;
import software.amazon.awscdk.services.elasticloadbalancingv2.ApplicationProtocol;
import software.amazon.awscdk.services.elasticloadbalancingv2.SslPolicy;
import software.amazon.awscdk.services.route53.PublicHostedZone;

Vpc vpc = Vpc.Builder.create(this, "Vpc").maxAzs(1).build();
ApplicationMultipleTargetGroupsFargateService loadBalancedFargateService = ApplicationMultipleTargetGroupsFargateService.Builder.create(this, "myService")
        .cluster(Cluster.Builder.create(this, "EcsCluster").vpc(vpc).build())
        .memoryLimitMiB(256)
        .taskImageOptions(ApplicationLoadBalancedTaskImageProps.builder()
                .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
                .build())
        .enableExecuteCommand(true)
        .loadBalancers(List.of(ApplicationLoadBalancerProps.builder()
                .name("lb")
                .idleTimeout(Duration.seconds(400))
                .domainName("api.example.com")
                .domainZone(PublicHostedZone.Builder.create(this, "HostedZone").zoneName("example.com").build())
                .listeners(List.of(ApplicationListenerProps.builder()
                        .name("listener")
                        .protocol(ApplicationProtocol.HTTPS)
                        .certificate(Certificate.fromCertificateArn(this, "Cert", "helloworld"))
                        .sslPolicy(SslPolicy.TLS12_EXT)
                        .build()))
                .build(), ApplicationLoadBalancerProps.builder()
                .name("lb2")
                .idleTimeout(Duration.seconds(120))
                .domainName("frontend.com")
                .domainZone(PublicHostedZone.Builder.create(this, "HostedZone").zoneName("frontend.com").build())
                .listeners(List.of(ApplicationListenerProps.builder()
                        .name("listener2")
                        .protocol(ApplicationProtocol.HTTPS)
                        .certificate(Certificate.fromCertificateArn(this, "Cert2", "helloworld"))
                        .sslPolicy(SslPolicy.TLS12_EXT)
                        .build()))
                .build()))
        .targetGroups(List.of(ApplicationTargetProps.builder()
                .containerPort(80)
                .listener("listener")
                .build(), ApplicationTargetProps.builder()
                .containerPort(90)
                .pathPattern("a/b/c")
                .priority(10)
                .listener("listener")
                .build(), ApplicationTargetProps.builder()
                .containerPort(443)
                .listener("listener2")
                .build(), ApplicationTargetProps.builder()
                .containerPort(80)
                .pathPattern("a/b/c")
                .priority(10)
                .listener("listener2")
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.CertificateManager;
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.ECS;
using Amazon.CDK.AWS.ElasticLoadBalancingV2;
using Amazon.CDK.AWS.Route53;

var vpc = new Vpc(this, "Vpc", new VpcProps { MaxAzs = 1 });
var loadBalancedFargateService = new ApplicationMultipleTargetGroupsFargateService(this, "myService", new ApplicationMultipleTargetGroupsFargateServiceProps {
    Cluster = new Cluster(this, "EcsCluster", new ClusterProps { Vpc = vpc }),
    MemoryLimitMiB = 256,
    TaskImageOptions = new ApplicationLoadBalancedTaskImageProps {
        Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample")
    },
    EnableExecuteCommand = true,
    LoadBalancers = new [] { new ApplicationLoadBalancerProps {
        Name = "lb",
        IdleTimeout = Duration.Seconds(400),
        DomainName = "api.example.com",
        DomainZone = new PublicHostedZone(this, "HostedZone", new PublicHostedZoneProps { ZoneName = "example.com" }),
        Listeners = new [] { new ApplicationListenerProps {
            Name = "listener",
            Protocol = ApplicationProtocol.HTTPS,
            Certificate = Certificate.FromCertificateArn(this, "Cert", "helloworld"),
            SslPolicy = SslPolicy.TLS12_EXT
        } }
    }, new ApplicationLoadBalancerProps {
        Name = "lb2",
        IdleTimeout = Duration.Seconds(120),
        DomainName = "frontend.com",
        DomainZone = new PublicHostedZone(this, "HostedZone", new PublicHostedZoneProps { ZoneName = "frontend.com" }),
        Listeners = new [] { new ApplicationListenerProps {
            Name = "listener2",
            Protocol = ApplicationProtocol.HTTPS,
            Certificate = Certificate.FromCertificateArn(this, "Cert2", "helloworld"),
            SslPolicy = SslPolicy.TLS12_EXT
        } }
    } },
    TargetGroups = new [] { new ApplicationTargetProps {
        ContainerPort = 80,
        Listener = "listener"
    }, new ApplicationTargetProps {
        ContainerPort = 90,
        PathPattern = "a/b/c",
        Priority = 10,
        Listener = "listener"
    }, new ApplicationTargetProps {
        ContainerPort = 443,
        Listener = "listener2"
    }, new ApplicationTargetProps {
        ContainerPort = 80,
        PathPattern = "a/b/c",
        Priority = 10,
        Listener = "listener2"
    } }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

vpc := ec2.NewVpc(this, jsii.String("Vpc"), &VpcProps{
	MaxAzs: jsii.Number(1),
})
loadBalancedFargateService := ecsPatterns.NewApplicationMultipleTargetGroupsFargateService(this, jsii.String("myService"), &ApplicationMultipleTargetGroupsFargateServiceProps{
	Cluster: ecs.NewCluster(this, jsii.String("EcsCluster"), &ClusterProps{
		Vpc: *Vpc,
	}),
	MemoryLimitMiB: jsii.Number(256),
	TaskImageOptions: &ApplicationLoadBalancedTaskImageProps{
		Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")),
	},
	EnableExecuteCommand: jsii.Boolean(true),
	LoadBalancers: []ApplicationLoadBalancerProps{
		&ApplicationLoadBalancerProps{
			Name: jsii.String("lb"),
			IdleTimeout: awscdk.Duration_Seconds(jsii.Number(400)),
			DomainName: jsii.String("api.example.com"),
			DomainZone: awscdk.NewPublicHostedZone(this, jsii.String("HostedZone"), &PublicHostedZoneProps{
				ZoneName: jsii.String("example.com"),
			}),
			Listeners: []ApplicationListenerProps{
				&ApplicationListenerProps{
					Name: jsii.String("listener"),
					Protocol: awscdk.ApplicationProtocol_HTTPS,
					Certificate: awscdk.Certificate_FromCertificateArn(this, jsii.String("Cert"), jsii.String("helloworld")),
					SslPolicy: awscdk.SslPolicy_TLS12_EXT,
				},
			},
		},
		&ApplicationLoadBalancerProps{
			Name: jsii.String("lb2"),
			IdleTimeout: awscdk.Duration_*Seconds(jsii.Number(120)),
			DomainName: jsii.String("frontend.com"),
			DomainZone: awscdk.NewPublicHostedZone(this, jsii.String("HostedZone"), &PublicHostedZoneProps{
				ZoneName: jsii.String("frontend.com"),
			}),
			Listeners: []ApplicationListenerProps{
				&ApplicationListenerProps{
					Name: jsii.String("listener2"),
					Protocol: awscdk.ApplicationProtocol_HTTPS,
					Certificate: awscdk.Certificate_*FromCertificateArn(this, jsii.String("Cert2"), jsii.String("helloworld")),
					SslPolicy: awscdk.SslPolicy_TLS12_EXT,
				},
			},
		},
	},
	TargetGroups: []ApplicationTargetProps{
		&ApplicationTargetProps{
			ContainerPort: jsii.Number(80),
			Listener: jsii.String("listener"),
		},
		&ApplicationTargetProps{
			ContainerPort: jsii.Number(90),
			PathPattern: jsii.String("a/b/c"),
			Priority: jsii.Number(10),
			Listener: jsii.String("listener"),
		},
		&ApplicationTargetProps{
			ContainerPort: jsii.Number(443),
			Listener: jsii.String("listener2"),
		},
		&ApplicationTargetProps{
			ContainerPort: jsii.Number(80),
			PathPattern: jsii.String("a/b/c"),
			Priority: jsii.Number(10),
			Listener: jsii.String("listener2"),
		},
	},
})

Initializer ​

ts
new ApplicationMultipleTargetGroupsFargateService(scope: Construct, id: string, props?: ApplicationMultipleTargetGroupsFargateServiceProps)
python
ApplicationMultipleTargetGroupsFargateService(scope: Construct, id: str, props: typing.Optional[ApplicationMultipleTargetGroupsFargateServiceProps] = None)
java
new ApplicationMultipleTargetGroupsFargateService(Construct scope, String id, ApplicationMultipleTargetGroupsFargateServiceProps props)
csharp
new ApplicationMultipleTargetGroupsFargateService(Construct scope, string id, ApplicationMultipleTargetGroupsFargateServiceProps? props = null)
go
NewApplicationMultipleTargetGroupsFargateService(Scope Construct, Id *string, Props ApplicationMultipleTargetGroupsFargateServiceProps)

Construct Props ​

assignPublicIpbooleanassign_public_ipboolassignPublicIpBooleanAssignPublicIpboolAssignPublicIp*bool= false#
Determines whether the service will be assigned a public IP address.
circuitBreakerDeploymentCircuitBreakercircuit_breakerDeploymentCircuitBreakercircuitBreakerDeploymentCircuitBreakerCircuitBreakerDeploymentCircuitBreakerCircuitBreakerDeploymentCircuitBreaker= disabled#
Whether to enable the deployment circuit breaker.

If this property is defined, circuit breaker will be implicitly enabled.

cloudMapOptionsCloudMapOptionscloud_map_optionsCloudMapOptionscloudMapOptionsCloudMapOptionsCloudMapOptionsCloudMapOptionsCloudMapOptionsCloudMapOptions= AWS Cloud Map service discovery …#
The options for configuring an Amazon ECS service to use service discovery.
default

Default: AWS Cloud Map service discovery is not enabled.

clusterIClusterclusterIClusterclusterIClusterClusterIClusterClusterICluster= create a new cluster; if both cl…#
The name of the cluster that hosts the service.

If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc.

default

Default: create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you.

cpunumbercpuint | floatcpuNumberCpudoubleCpu*float64= 256#
The number of cpu units used by the task.
notes

Valid values, which determines your range of valid values for the memory parameter:

256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB

512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB

1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB

2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments

4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments

8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments

16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments

This default is set in the underlying FargateTaskDefinition construct.

desiredCountnumberdesired_countint | floatdesiredCountNumberDesiredCountdoubleDesiredCount*float64= The default is 1 for all new ser…#
The desired number of instantiations of the task definition to keep running on the service.
default

Default: The default is 1 for all new services and uses the existing service's desired count when updating an existing service.

enableECSManagedTagsbooleanenable_ecs_managed_tagsboolenableECSManagedTagsBooleanEnableECSManagedTagsboolEnableECSManagedTags*bool= false#
Specifies whether to enable Amazon ECS managed tags for the tasks within the service.

For more information, see Tagging Your Amazon ECS Resources

enableExecuteCommandbooleanenable_execute_commandboolenableExecuteCommandBooleanEnableExecuteCommandboolEnableExecuteCommand*bool= false#
Whether ECS Exec should be enabled.
ephemeralStorageGiBnumberephemeral_storage_gi_bint | floatephemeralStorageGiBNumberEphemeralStorageGiBdoubleEphemeralStorageGiB*float64= Undefined, in which case, the ta…#
The amount (in GiB) of ephemeral storage to be allocated to the task.

The minimum supported value is 21 GiB and the maximum supported value is 200 GiB.

Only supported in Fargate platform version 1.4.0 or later.

default

Default: Undefined, in which case, the task will receive 20GiB ephemeral storage.

healthCheckGracePeriodDurationhealth_check_grace_periodDurationhealthCheckGracePeriodDurationHealthCheckGracePeriodDurationHealthCheckGracePeriodDuration= defaults to 60 seconds if at lea…#
The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started.
default

Default: defaults to 60 seconds if at least one load balancer is in-use and it is not already set

loadBalancersApplicationLoadBalancerProps[]load_balancerstyping.List[ApplicationLoadBalancerProps]loadBalancersList<ApplicationLoadBalancerProps>LoadBalancersApplicationLoadBalancerProps[]LoadBalancers*[]ApplicationLoadBalancerProps= a new load balancer with a liste…#
The application load balancer that will serve traffic to the service.
default

Default: a new load balancer with a listener will be created.

memoryLimitMiBnumbermemory_limit_mi_bint | floatmemoryLimitMiBNumberMemoryLimitMiBdoubleMemoryLimitMiB*float64= 512#
The amount (in MiB) of memory used by the task.
notes

This field is required and you must use one of the following values, which determines your range of valid values for the cpu parameter:

512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)

1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)

2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU)

Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU)

Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)

Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU)

Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU)

This default is set in the underlying FargateTaskDefinition construct.

platformVersionFargatePlatformVersionplatform_versionFargatePlatformVersionplatformVersionFargatePlatformVersionPlatformVersionFargatePlatformVersionPlatformVersionFargatePlatformVersion= Latest#
The platform version on which to run your service.
notes

If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.

propagateTagsPropagatedTagSourcepropagate_tagsPropagatedTagSourcepropagateTagsPropagatedTagSourcePropagateTagsPropagatedTagSourcePropagateTagsPropagatedTagSource= none#
Specifies whether to propagate the tags from the task definition or the service to the tasks in the service.

Tags can only be propagated to the tasks within the service during service creation.

runtimePlatformRuntimePlatformruntime_platformRuntimePlatformruntimePlatformRuntimePlatformRuntimePlatformRuntimePlatformRuntimePlatformRuntimePlatform= If the property is undefined, `o…#
The runtime platform of the task definition.
default

Default: If the property is undefined, operatingSystemFamily is LINUX and cpuArchitecture is X86_64

serviceNamestringservice_namestrserviceNameStringServiceNamestringServiceName*string= CloudFormation-generated name.#
The name of the service.
targetGroupsApplicationTargetProps[]target_groupstyping.List[ApplicationTargetProps]targetGroupsList<ApplicationTargetProps>TargetGroupsApplicationTargetProps[]TargetGroups*[]ApplicationTargetProps= default portMapping registered a…#
Properties to specify ALB target groups.
default

Default: default portMapping registered as target group and attached to the first defined listener

taskDefinitionFargateTaskDefinitiontask_definitionFargateTaskDefinitiontaskDefinitionFargateTaskDefinitionTaskDefinitionFargateTaskDefinitionTaskDefinitionFargateTaskDefinition= none#
The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both.

[disable-awslint:ref-via-interface]

The properties required to create a new task definition.

Only one of TaskDefinition or TaskImageOptions must be specified.

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpc= uses the VPC defined in the clus…#
The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed.

If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster.

default

Default: uses the VPC defined in the cluster or creates a new VPC.

Properties ​

assignPublicIpbooleanassign_public_ipboolassignPublicIpBooleanAssignPublicIpboolAssignPublicIp*boolrequired#
Determines whether the service will be assigned a public IP address.
clusterIClusterclusterIClusterclusterIClusterClusterIClusterClusterIClusterrequired#
The cluster that hosts the service.
internalDesiredCountnumberinternal_desired_countint | floatinternalDesiredCountNumberInternalDesiredCountdoubleInternalDesiredCount*float64#
The desired number of instantiations of the task definition to keep running on the service.

The default is 1 for all new services and uses the existing services desired count when updating an existing service, if one is not provided.

- Use `listeners` instead.
listenersApplicationListener[]listenerstyping.List[ApplicationListener]listenersList<ApplicationListener>ListenersApplicationListener[]Listeners*[]ApplicationListenerrequired#
The listeners of the service.
loadBalancerApplicationLoadBalancerload_balancerApplicationLoadBalancerloadBalancerApplicationLoadBalancerLoadBalancerApplicationLoadBalancerLoadBalancerApplicationLoadBalancerrequireddeprecated#
- Use `loadBalancers` instead.
loadBalancersApplicationLoadBalancer[]load_balancerstyping.List[ApplicationLoadBalancer]loadBalancersList<ApplicationLoadBalancer>LoadBalancersApplicationLoadBalancer[]LoadBalancers*[]ApplicationLoadBalancerrequired#
The load balancers of the service.
nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
The Fargate service in this construct.
targetGroupApplicationTargetGrouptarget_groupApplicationTargetGrouptargetGroupApplicationTargetGroupTargetGroupApplicationTargetGroupTargetGroupApplicationTargetGrouprequireddeprecated#
- Use `targetGroups` instead.
targetGroupsApplicationTargetGroup[]target_groupstyping.List[ApplicationTargetGroup]targetGroupsList<ApplicationTargetGroup>TargetGroupsApplicationTargetGroup[]TargetGroups*[]ApplicationTargetGrouprequired#
The target groups of the service.
taskDefinitionFargateTaskDefinitiontask_definitionFargateTaskDefinitiontaskDefinitionFargateTaskDefinitionTaskDefinitionFargateTaskDefinitionTaskDefinitionFargateTaskDefinitionrequired#
The Fargate task definition in this construct.

Methods ​

isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining