create_task_set
async
¶
create_task_set(
service: String,
cluster: String,
task_definition: String,
*,
config_overrides: Optional[AsyncECSClientConfig] = None,
external_id: Optional[String] = None,
network_configuration: Optional[NetworkConfiguration] = None,
load_balancers: Optional[LoadBalancers] = None,
service_registries: Optional[ServiceRegistries] = None,
launch_type: Optional[LaunchType] = None,
capacity_provider_strategy: Optional[CapacityProviderStrategy] = None,
platform_version: Optional[String] = None,
scale: Optional[Scale] = None,
client_token: Optional[String] = None,
tags: Optional[Tags] = None,
) -> CreateTaskSetResponse
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.
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.
Parameters:
-
service(String) –The short name or full Amazon Resource Name (ARN) of the service to create the task set in.
-
cluster(String) –The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service to create the task set in.
-
external_id(Optional[String], default:None) –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_IDCloud Map attribute set to the provided value. -
task_definition(String) –The task definition for the tasks in the task set to use. If a revision isn't specified, the latest
ACTIVErevision is used. -
network_configuration(Optional[NetworkConfiguration], default:None) –An object representing the network configuration for a task set.
-
load_balancers(Optional[LoadBalancers], default: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.
-
service_registries(Optional[ServiceRegistries], default:None) –The details of the service discovery registries to assign to this task set. For more information, see Service discovery.
-
launch_type(Optional[LaunchType], default:None) –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
launchTypeis specified, thecapacityProviderStrategyparameter must be omitted. -
capacity_provider_strategy(Optional[CapacityProviderStrategy], default:None) –The capacity provider strategy to use for the task set.
A capacity provider strategy consists of one or more capacity providers along with the
baseandweightto assign to them. A capacity provider must be associated with the cluster to be used in a capacity provider strategy. The PutClusterCapacityProviders API is used to associate a capacity provider with a cluster. Only capacity providers with anACTIVEorUPDATINGstatus can be used.If a
capacityProviderStrategyis specified, thelaunchTypeparameter must be omitted. If nocapacityProviderStrategyorlaunchTypeis specified, thedefaultCapacityProviderStrategyfor the cluster is used.If specifying a capacity provider that uses an Auto Scaling group, the capacity provider must already be created. New capacity providers can be created with the CreateCapacityProviderProviderAPI operation.
To use a Fargate capacity provider, specify either the
FARGATEorFARGATE_SPOTcapacity providers. The Fargate capacity providers are available to all accounts and only need to be associated with a cluster to be used.The PutClusterCapacityProviders API operation is used to update the list of available capacity providers for a cluster after the cluster is created.
-
platform_version(Optional[String], default:None) –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
LATESTplatform version is used. -
scale(Optional[Scale], default:None) –A floating-point percentage of the desired number of tasks to place and keep running in the task set.
-
client_token(Optional[String], default:None) –An identifier that you provide to ensure the idempotency of the request. It must be unique and is case sensitive. Up to 36 ASCII characters in the range of 33-126 (inclusive) are allowed.
-
tags(Optional[Tags], default:None) –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. When a service is deleted, the tags are deleted.
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: + - = . _ : / @.
-
Tag keys and values are case-sensitive.
-
Do not use
aws:,AWS:, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.
-
Raises:
-
AccessDeniedException–You don't have authorization to perform the requested action.
-
ClientException–These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.
-
ClusterNotFoundException–The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific.
-
InvalidParameterException–The specified parameter isn't valid. Review the available parameters for the API request.
For more information about service event errors, see Amazon ECS service event messages.
-
LimitExceededException–The limit for the resource was exceeded.
-
NamespaceNotFoundException–The specified namespace wasn't found.
-
PlatformTaskDefinitionIncompatibilityException–The specified platform version doesn't satisfy the required capabilities of the task definition.
-
PlatformUnknownException–The specified platform version doesn't exist.
-
ServerException–These errors are usually caused by a server issue.
-
ServiceNotActiveException–The specified service isn't active. You can't update a service that's inactive. If you have previously deleted a service, you can re-create it with CreateService.
-
ServiceNotFoundException–The specified service wasn't found. You can view your available services with ListServices. Amazon ECS services are cluster specific and Region specific.
-
UnsupportedFeatureException–The specified task isn't supported in this Region.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To create a task set This example creates a task set in a service that uses the EXTERNAL deployment controller.
>>> await client.create_task_set(service='MyService', cluster='MyCluster', task_definition='MyTaskDefinition:2', network_configuration={'awsvpcConfiguration': {'subnets': ['subnet-12344321'], 'securityGroups': ['sg-12344321']}})
Source code in docs_src/capo_ecs/_services/async_ecs.py
6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 | |