CfnTaskSet

class aws_cdk.aws_ecs.CfnTaskSet(scope, id, *, cluster, service, task_definition, capacity_provider_strategy=None, external_id=None, launch_type=None, load_balancers=None, network_configuration=None, platform_version=None, scale=None, service_registries=None, tags=None)

Bases: CfnResource

Create a task set in the specified cluster and service.

This is used when a service uses the EXTERNAL deployment controller type. For more information, see Amazon ECS deployment types in the Amazon Elastic Container Service Developer Guide . .. epigraph:

On March 21, 2024, a change was made to resolve the task definition revision before authorization. When a task definition revision is not specified, authorization will occur using the latest revision of a task definition.

For information about the maximum number of task sets and other quotas, see Amazon ECS service quotas in the Amazon Elastic Container Service Developer Guide .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskset.html

CloudformationResource:

AWS::ECS::TaskSet

ExampleMetadata:

fixture=_generated

Example:

# 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 as ecs

cfn_task_set = ecs.CfnTaskSet(self, "MyCfnTaskSet",
    cluster="cluster",
    service="service",
    task_definition="taskDefinition",

    # the properties below are optional
    capacity_provider_strategy=[ecs.CfnTaskSet.CapacityProviderStrategyItemProperty(
        base=123,
        capacity_provider="capacityProvider",
        weight=123
    )],
    external_id="externalId",
    launch_type="launchType",
    load_balancers=[ecs.CfnTaskSet.LoadBalancerProperty(
        container_name="containerName",
        container_port=123,
        target_group_arn="targetGroupArn"
    )],
    network_configuration=ecs.CfnTaskSet.NetworkConfigurationProperty(
        aws_vpc_configuration=ecs.CfnTaskSet.AwsVpcConfigurationProperty(
            subnets=["subnets"],

            # the properties below are optional
            assign_public_ip="assignPublicIp",
            security_groups=["securityGroups"]
        )
    ),
    platform_version="platformVersion",
    scale=ecs.CfnTaskSet.ScaleProperty(
        unit="unit",
        value=123
    ),
    service_registries=[ecs.CfnTaskSet.ServiceRegistryProperty(
        container_name="containerName",
        container_port=123,
        port=123,
        registry_arn="registryArn"
    )],
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)
Parameters:
  • scope (Construct) – Scope in which this resource is defined.

  • id (str) – Construct identifier for this resource (unique in its scope).

  • cluster (str) – The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service to create the task set in.

  • service (str) – The short name or full Amazon Resource Name (ARN) of the service to create the task set in.

  • task_definition (str) – The task definition for the tasks in the task set to use. If a revision isn’t specified, the latest ACTIVE revision is used.

  • capacity_provider_strategy (Union[IResolvable, Sequence[Union[IResolvable, CapacityProviderStrategyItemProperty, Dict[str, Any]]], None]) – The capacity provider strategy that are associated with the task set.

  • external_id (Optional[str]) – An optional non-unique tag that identifies this task set in external systems. If the task set is associated with a service discovery registry, the tasks in this task set will have the ECS_TASK_SET_EXTERNAL_ID AWS Cloud Map attribute set to the provided value.

  • launch_type (Optional[str]) – The launch type that new tasks in the task set uses. For more information, see Amazon ECS launch types in the Amazon Elastic Container Service Developer Guide . If a launchType is specified, the capacityProviderStrategy parameter must be omitted.

  • load_balancers (Union[IResolvable, Sequence[Union[IResolvable, LoadBalancerProperty, Dict[str, Any]]], None]) – A load balancer object representing the load balancer to use with the task set. The supported load balancer types are either an Application Load Balancer or a Network Load Balancer.

  • network_configuration (Union[IResolvable, NetworkConfigurationProperty, Dict[str, Any], None]) – The network configuration for the task set.

  • platform_version (Optional[str]) – The platform version that the tasks in the task set uses. A platform version is specified only for tasks using the Fargate launch type. If one isn’t specified, the LATEST platform version is used.

  • scale (Union[IResolvable, ScaleProperty, Dict[str, Any], None]) – A floating-point percentage of your desired number of tasks to place and keep running in the task set.

  • service_registries (Union[IResolvable, Sequence[Union[IResolvable, ServiceRegistryProperty, Dict[str, Any]]], None]) – The details of the service discovery registries to assign to this task set. For more information, see Service discovery .

  • tags (Optional[Sequence[Union[CfnTag, Dict[str, Any]]]]) – The metadata that you apply to the task set to help you categorize and organize them. Each tag consists of a key and an optional value. You define both. The following basic restrictions apply to tags: - Maximum number of tags per resource - 50 - For each resource, each tag key must be unique, and each tag key can have only one value. - Maximum key length - 128 Unicode characters in UTF-8 - Maximum value length - 256 Unicode characters in UTF-8 - If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : /

Methods

add_deletion_override(path)

Syntactic sugar for addOverride(path, undefined).

Parameters:

path (str) – The path of the value to delete.

Return type:

None

add_dependency(target)

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

Parameters:

target (CfnResource) –

Return type:

None

add_depends_on(target)

(deprecated) Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

Parameters:

target (CfnResource) –

Deprecated:

use addDependency

Stability:

deprecated

Return type:

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters:
  • key (str) –

  • value (Any) –

See:

Return type:

None

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

add_override(path, value)

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use addPropertyOverride or prefix path with “Properties.” (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example:

cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")

would add the overrides Example:

"Properties": {
  "GlobalSecondaryIndexes": [
    {
      "Projection": {
        "NonKeyAttributes": [ "myattribute" ]
        ...
      }
      ...
    },
    {
      "ProjectionType": "INCLUDE"
      ...
    },
  ]
  ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters:
  • path (str) –

    • The path of the property, you can use dot notation to override values in complex types. Any intermediate keys will be created as needed.

  • value (Any) –

    • The value. Could be primitive or complex.

Return type:

None

add_property_deletion_override(property_path)

Adds an override that deletes the value of a property from the resource definition.

Parameters:

property_path (str) – The path to the property.

Return type:

None

add_property_override(property_path, value)

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

Parameters:
  • property_path (str) – The path of the property.

  • value (Any) – The value.

Return type:

None

apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)

Sets the deletion policy of the resource based on the removal policy specified.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:

Parameters:
  • policy (Optional[RemovalPolicy]) –

  • apply_to_update_replace_policy (Optional[bool]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: true

  • default (Optional[RemovalPolicy]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resource, please consult that specific resource’s documentation.

See:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options

Return type:

None

get_att(attribute_name, type_hint=None)

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

Parameters:
  • attribute_name (str) – The name of the attribute.

  • type_hint (Optional[ResolutionTypeHint]) –

Return type:

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters:

key (str) –

See:

Return type:

Any

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters:

inspector (TreeInspector) – tree inspector to collect and process attributes.

Return type:

None

obtain_dependencies()

Retrieves an array of resources this resource depends on.

This assembles dependencies on resources across stacks (including nested stacks) automatically.

Return type:

List[Union[Stack, CfnResource]]

obtain_resource_dependencies()

Get a shallow copy of dependencies between this resource and other resources in the same stack.

Return type:

List[CfnResource]

override_logical_id(new_logical_id)

Overrides the auto-generated logical ID with a specific ID.

Parameters:

new_logical_id (str) – The new logical ID to use for this stack element.

Return type:

None

remove_dependency(target)

Indicates that this resource no longer depends on another resource.

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

Parameters:

target (CfnResource) –

Return type:

None

replace_dependency(target, new_target)

Replaces one dependency with another.

Parameters:
Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Returns:

a string representation of this resource

Attributes

CFN_RESOURCE_TYPE_NAME = 'AWS::ECS::TaskSet'
attr_id

The ID of the task set.

CloudformationAttribute:

Id

capacity_provider_strategy

The capacity provider strategy that are associated with the task set.

cdk_tag_manager

Tag Manager which manages the tags for this resource.

cfn_options

Options for this resource, such as condition, update policy etc.

cfn_resource_type

AWS resource type.

cluster

The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service to create the task set in.

creation_stack

return:

the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.

external_id

An optional non-unique tag that identifies this task set in external systems.

launch_type

The launch type that new tasks in the task set uses.

load_balancers

A load balancer object representing the load balancer to use with the task set.

logical_id

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Returns:

the logical ID as a stringified token. This value will only get resolved during synthesis.

network_configuration

The network configuration for the task set.

node

The tree node.

platform_version

The platform version that the tasks in the task set uses.

ref

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

scale

A floating-point percentage of your desired number of tasks to place and keep running in the task set.

service

The short name or full Amazon Resource Name (ARN) of the service to create the task set in.

service_registries

The details of the service discovery registries to assign to this task set.

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

tags

The metadata that you apply to the task set to help you categorize and organize them.

task_definition

The task definition for the tasks in the task set to use.

Static Methods

classmethod is_cfn_element(x)

Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

Parameters:

x (Any) –

Return type:

bool

Returns:

The construct as a stack element or undefined if it is not a stack element.

classmethod is_cfn_resource(x)

Check whether the given object is a CfnResource.

Parameters:

x (Any) –

Return type:

bool

classmethod is_construct(x)

Checks if x is a construct.

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:

x (Any) – Any object.

Return type:

bool

Returns:

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

AwsVpcConfigurationProperty

class CfnTaskSet.AwsVpcConfigurationProperty(*, subnets, assign_public_ip=None, security_groups=None)

Bases: object

An object representing the networking details for a task or service.

For example awsVpcConfiguration={subnets=["subnet-12344321"],securityGroups=["sg-12344321"]} .

Parameters:
  • subnets (Sequence[str]) – The IDs of the subnets associated with the task or service. There’s a limit of 16 subnets that can be specified per awsvpcConfiguration . .. epigraph:: All specified subnets must be from the same VPC.

  • assign_public_ip (Optional[str]) – Whether the task’s elastic network interface receives a public IP address. The default value is DISABLED .

  • security_groups (Optional[Sequence[str]]) – The IDs of the security groups associated with the task or service. If you don’t specify a security group, the default security group for the VPC is used. There’s a limit of 5 security groups that can be specified per awsvpcConfiguration . .. epigraph:: All specified security groups must be from the same VPC.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-awsvpcconfiguration.html

ExampleMetadata:

fixture=_generated

Example:

# 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 as ecs

aws_vpc_configuration_property = ecs.CfnTaskSet.AwsVpcConfigurationProperty(
    subnets=["subnets"],

    # the properties below are optional
    assign_public_ip="assignPublicIp",
    security_groups=["securityGroups"]
)

Attributes

assign_public_ip

Whether the task’s elastic network interface receives a public IP address.

The default value is DISABLED .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-awsvpcconfiguration.html#cfn-ecs-taskset-awsvpcconfiguration-assignpublicip

security_groups

The IDs of the security groups associated with the task or service.

If you don’t specify a security group, the default security group for the VPC is used. There’s a limit of 5 security groups that can be specified per awsvpcConfiguration . .. epigraph:

All specified security groups must be from the same VPC.
See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-awsvpcconfiguration.html#cfn-ecs-taskset-awsvpcconfiguration-securitygroups

subnets

The IDs of the subnets associated with the task or service.

There’s a limit of 16 subnets that can be specified per awsvpcConfiguration . .. epigraph:

All specified subnets must be from the same VPC.
See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-awsvpcconfiguration.html#cfn-ecs-taskset-awsvpcconfiguration-subnets

CapacityProviderStrategyItemProperty

class CfnTaskSet.CapacityProviderStrategyItemProperty(*, base=None, capacity_provider=None, weight=None)

Bases: object

The details of a capacity provider strategy.

A capacity provider strategy can be set when using the RunTask or CreateCluster APIs or as the default capacity provider strategy for a cluster with the CreateCluster API.

Only capacity providers that are already associated with a cluster and have an ACTIVE or UPDATING status can be used in a capacity provider strategy. The PutClusterCapacityProviders API is used to associate a capacity provider with a cluster.

If specifying a capacity provider that uses an Auto Scaling group, the capacity provider must already be created. New Auto Scaling group capacity providers can be created with the CreateClusterCapacityProvider API operation.

To use a AWS Fargate capacity provider, specify either the FARGATE or FARGATE_SPOT capacity providers. The AWS Fargate capacity providers are available to all accounts and only need to be associated with a cluster to be used in a capacity provider strategy.

With FARGATE_SPOT , you can run interruption tolerant tasks at a rate that’s discounted compared to the FARGATE price. FARGATE_SPOT runs tasks on spare compute capacity. When AWS needs the capacity back, your tasks are interrupted with a two-minute warning. FARGATE_SPOT supports Linux tasks with the X86_64 architecture on platform version 1.3.0 or later. FARGATE_SPOT supports Linux tasks with the ARM64 architecture on platform version 1.4.0 or later.

A capacity provider strategy may contain a maximum of 6 capacity providers.

Parameters:
  • base (Union[int, float, None]) – The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. If no value is specified, the default value of 0 is used.

  • capacity_provider (Optional[str]) – The short name of the capacity provider.

  • weight (Union[int, float, None]) – The weight value designates the relative percentage of the total number of tasks launched that should use the specified capacity provider. The weight value is taken into consideration after the base value, if defined, is satisfied. If no weight value is specified, the default value of 0 is used. When multiple capacity providers are specified within a capacity provider strategy, at least one of the capacity providers must have a weight value greater than zero and any capacity providers with a weight of 0 can’t be used to place tasks. If you specify multiple capacity providers in a strategy that all have a weight of 0 , any RunTask or CreateService actions using the capacity provider strategy will fail. An example scenario for using weights is defining a strategy that contains two capacity providers and both have a weight of 1 , then when the base is satisfied, the tasks will be split evenly across the two capacity providers. Using that same logic, if you specify a weight of 1 for capacityProviderA and a weight of 4 for capacityProviderB , then for every one task that’s run using capacityProviderA , four tasks would use capacityProviderB .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-capacityproviderstrategyitem.html

ExampleMetadata:

fixture=_generated

Example:

# 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 as ecs

capacity_provider_strategy_item_property = ecs.CfnTaskSet.CapacityProviderStrategyItemProperty(
    base=123,
    capacity_provider="capacityProvider",
    weight=123
)

Attributes

base

The base value designates how many tasks, at a minimum, to run on the specified capacity provider.

Only one capacity provider in a capacity provider strategy can have a base defined. If no value is specified, the default value of 0 is used.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-capacityproviderstrategyitem.html#cfn-ecs-taskset-capacityproviderstrategyitem-base

capacity_provider

The short name of the capacity provider.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-capacityproviderstrategyitem.html#cfn-ecs-taskset-capacityproviderstrategyitem-capacityprovider

weight

The weight value designates the relative percentage of the total number of tasks launched that should use the specified capacity provider.

The weight value is taken into consideration after the base value, if defined, is satisfied.

If no weight value is specified, the default value of 0 is used. When multiple capacity providers are specified within a capacity provider strategy, at least one of the capacity providers must have a weight value greater than zero and any capacity providers with a weight of 0 can’t be used to place tasks. If you specify multiple capacity providers in a strategy that all have a weight of 0 , any RunTask or CreateService actions using the capacity provider strategy will fail.

An example scenario for using weights is defining a strategy that contains two capacity providers and both have a weight of 1 , then when the base is satisfied, the tasks will be split evenly across the two capacity providers. Using that same logic, if you specify a weight of 1 for capacityProviderA and a weight of 4 for capacityProviderB , then for every one task that’s run using capacityProviderA , four tasks would use capacityProviderB .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-capacityproviderstrategyitem.html#cfn-ecs-taskset-capacityproviderstrategyitem-weight

LoadBalancerProperty

class CfnTaskSet.LoadBalancerProperty(*, container_name=None, container_port=None, target_group_arn=None)

Bases: object

The load balancer configuration to use with a service or task set.

When you add, update, or remove a load balancer configuration, Amazon ECS starts a new deployment with the updated Elastic Load Balancing configuration. This causes tasks to register to and deregister from load balancers.

We recommend that you verify this on a test environment before you update the Elastic Load Balancing configuration.

A service-linked role is required for services that use multiple target groups. For more information, see Using service-linked roles in the Amazon Elastic Container Service Developer Guide .

Parameters:
  • container_name (Optional[str]) – The name of the container (as it appears in a container definition) to associate with the load balancer. You need to specify the container name when configuring the target group for an Amazon ECS load balancer.

  • container_port (Union[int, float, None]) – The port on the container to associate with the load balancer. This port must correspond to a containerPort in the task definition the tasks in the service are using. For tasks that use the EC2 launch type, the container instance they’re launched on must allow ingress traffic on the hostPort of the port mapping.

  • target_group_arn (Optional[str]) – The full Amazon Resource Name (ARN) of the Elastic Load Balancing target group or groups associated with a service or task set. A target group ARN is only specified when using an Application Load Balancer or Network Load Balancer. For services using the ECS deployment controller, you can specify one or multiple target groups. For more information, see Registering multiple target groups with a service in the Amazon Elastic Container Service Developer Guide . For services using the CODE_DEPLOY deployment controller, you’re required to define two target groups for the load balancer. For more information, see Blue/green deployment with CodeDeploy in the Amazon Elastic Container Service Developer Guide . .. epigraph:: If your service’s task definition uses the awsvpc network mode, you must choose ip as the target type, not instance . Do this when creating your target groups because tasks that use the awsvpc network mode are associated with an elastic network interface, not an Amazon EC2 instance. This network mode is required for the Fargate launch type.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-loadbalancer.html

ExampleMetadata:

fixture=_generated

Example:

# 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 as ecs

load_balancer_property = ecs.CfnTaskSet.LoadBalancerProperty(
    container_name="containerName",
    container_port=123,
    target_group_arn="targetGroupArn"
)

Attributes

container_name

The name of the container (as it appears in a container definition) to associate with the load balancer.

You need to specify the container name when configuring the target group for an Amazon ECS load balancer.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-loadbalancer.html#cfn-ecs-taskset-loadbalancer-containername

container_port

The port on the container to associate with the load balancer.

This port must correspond to a containerPort in the task definition the tasks in the service are using. For tasks that use the EC2 launch type, the container instance they’re launched on must allow ingress traffic on the hostPort of the port mapping.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-loadbalancer.html#cfn-ecs-taskset-loadbalancer-containerport

target_group_arn

The full Amazon Resource Name (ARN) of the Elastic Load Balancing target group or groups associated with a service or task set.

A target group ARN is only specified when using an Application Load Balancer or Network Load Balancer.

For services using the ECS deployment controller, you can specify one or multiple target groups. For more information, see Registering multiple target groups with a service in the Amazon Elastic Container Service Developer Guide .

For services using the CODE_DEPLOY deployment controller, you’re required to define two target groups for the load balancer. For more information, see Blue/green deployment with CodeDeploy in the Amazon Elastic Container Service Developer Guide . .. epigraph:

If your service's task definition uses the ``awsvpc`` network mode, you must choose ``ip`` as the target type, not ``instance`` . Do this when creating your target groups because tasks that use the ``awsvpc`` network mode are associated with an elastic network interface, not an Amazon EC2 instance. This network mode is required for the Fargate launch type.
See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-loadbalancer.html#cfn-ecs-taskset-loadbalancer-targetgrouparn

NetworkConfigurationProperty

class CfnTaskSet.NetworkConfigurationProperty(*, aws_vpc_configuration=None)

Bases: object

The network configuration for a task or service.

Parameters:

aws_vpc_configuration (Union[IResolvable, AwsVpcConfigurationProperty, Dict[str, Any], None]) – The VPC subnets and security groups that are associated with a task. .. epigraph:: All specified subnets and security groups must be from the same VPC.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-networkconfiguration.html

ExampleMetadata:

fixture=_generated

Example:

# 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 as ecs

network_configuration_property = ecs.CfnTaskSet.NetworkConfigurationProperty(
    aws_vpc_configuration=ecs.CfnTaskSet.AwsVpcConfigurationProperty(
        subnets=["subnets"],

        # the properties below are optional
        assign_public_ip="assignPublicIp",
        security_groups=["securityGroups"]
    )
)

Attributes

aws_vpc_configuration

The VPC subnets and security groups that are associated with a task.

All specified subnets and security groups must be from the same VPC.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-networkconfiguration.html#cfn-ecs-taskset-networkconfiguration-awsvpcconfiguration

ScaleProperty

class CfnTaskSet.ScaleProperty(*, unit=None, value=None)

Bases: object

A floating-point percentage of the desired number of tasks to place and keep running in the task set.

Parameters:
  • unit (Optional[str]) – The unit of measure for the scale value.

  • value (Union[int, float, None]) – The value, specified as a percent total of a service’s desiredCount , to scale the task set. Accepted values are numbers between 0 and 100.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-scale.html

ExampleMetadata:

fixture=_generated

Example:

# 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 as ecs

scale_property = ecs.CfnTaskSet.ScaleProperty(
    unit="unit",
    value=123
)

Attributes

unit

The unit of measure for the scale value.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-scale.html#cfn-ecs-taskset-scale-unit

value

The value, specified as a percent total of a service’s desiredCount , to scale the task set.

Accepted values are numbers between 0 and 100.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-scale.html#cfn-ecs-taskset-scale-value

ServiceRegistryProperty

class CfnTaskSet.ServiceRegistryProperty(*, container_name=None, container_port=None, port=None, registry_arn=None)

Bases: object

The details for the service registry.

Each service may be associated with one service registry. Multiple service registries for each service are not supported.

When you add, update, or remove the service registries configuration, Amazon ECS starts a new deployment. New tasks are registered and deregistered to the updated service registry configuration.

Parameters:
  • container_name (Optional[str]) – The container name value to be used for your service discovery service. It’s already specified in the task definition. If the task definition that your service task specifies uses the bridge or host network mode, you must specify a containerName and containerPort combination from the task definition. If the task definition that your service task specifies uses the awsvpc network mode and a type SRV DNS record is used, you must specify either a containerName and containerPort combination or a port value. However, you can’t specify both.

  • container_port (Union[int, float, None]) – The port value to be used for your service discovery service. It’s already specified in the task definition. If the task definition your service task specifies uses the bridge or host network mode, you must specify a containerName and containerPort combination from the task definition. If the task definition your service task specifies uses the awsvpc network mode and a type SRV DNS record is used, you must specify either a containerName and containerPort combination or a port value. However, you can’t specify both.

  • port (Union[int, float, None]) – The port value used if your service discovery service specified an SRV record. This field might be used if both the awsvpc network mode and SRV records are used.

  • registry_arn (Optional[str]) – The Amazon Resource Name (ARN) of the service registry. The currently supported service registry is AWS Cloud Map . For more information, see CreateService .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-serviceregistry.html

ExampleMetadata:

fixture=_generated

Example:

# 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 as ecs

service_registry_property = ecs.CfnTaskSet.ServiceRegistryProperty(
    container_name="containerName",
    container_port=123,
    port=123,
    registry_arn="registryArn"
)

Attributes

container_name

The container name value to be used for your service discovery service.

It’s already specified in the task definition. If the task definition that your service task specifies uses the bridge or host network mode, you must specify a containerName and containerPort combination from the task definition. If the task definition that your service task specifies uses the awsvpc network mode and a type SRV DNS record is used, you must specify either a containerName and containerPort combination or a port value. However, you can’t specify both.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-serviceregistry.html#cfn-ecs-taskset-serviceregistry-containername

container_port

The port value to be used for your service discovery service.

It’s already specified in the task definition. If the task definition your service task specifies uses the bridge or host network mode, you must specify a containerName and containerPort combination from the task definition. If the task definition your service task specifies uses the awsvpc network mode and a type SRV DNS record is used, you must specify either a containerName and containerPort combination or a port value. However, you can’t specify both.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-serviceregistry.html#cfn-ecs-taskset-serviceregistry-containerport

port

The port value used if your service discovery service specified an SRV record.

This field might be used if both the awsvpc network mode and SRV records are used.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-serviceregistry.html#cfn-ecs-taskset-serviceregistry-port

registry_arn

The Amazon Resource Name (ARN) of the service registry.

The currently supported service registry is AWS Cloud Map . For more information, see CreateService .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskset-serviceregistry.html#cfn-ecs-taskset-serviceregistry-registryarn