create_task_set
¶
create_task_set(
service: String,
cluster: String,
task_definition: String,
*,
config_overrides: Optional[ECSClientConfig] = 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.
>>> 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/ecs.py
7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 | |