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
7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 | |