Skip to content

ECSClient#

Index > ECS > ECSClient

Auto-generated documentation for ECS type annotations stubs module mypy-boto3-ecs.

ECSClient#

Type annotations and code completion for boto3.client("ecs"). boto3 documentation

# ECSClient usage example

from boto3.session import Session
from mypy_boto3_ecs.client import ECSClient

def get_ecs_client() -> ECSClient:
    return Session().client("ecs")

Exceptions#

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("ecs").exceptions structure.

# Exceptions.exceptions usage example

client = boto3.client("ecs")

try:
    do_something(client)
except (
    client.exceptions.AccessDeniedException,
    client.exceptions.AttributeLimitExceededException,
    client.exceptions.BlockedException,
    client.exceptions.ClientError,
    client.exceptions.ClientException,
    client.exceptions.ClusterContainsContainerInstancesException,
    client.exceptions.ClusterContainsServicesException,
    client.exceptions.ClusterContainsTasksException,
    client.exceptions.ClusterNotFoundException,
    client.exceptions.InvalidParameterException,
    client.exceptions.LimitExceededException,
    client.exceptions.MissingVersionException,
    client.exceptions.NamespaceNotFoundException,
    client.exceptions.NoUpdateAvailableException,
    client.exceptions.PlatformTaskDefinitionIncompatibilityException,
    client.exceptions.PlatformUnknownException,
    client.exceptions.ResourceInUseException,
    client.exceptions.ResourceNotFoundException,
    client.exceptions.ServerException,
    client.exceptions.ServiceNotActiveException,
    client.exceptions.ServiceNotFoundException,
    client.exceptions.TargetNotConnectedException,
    client.exceptions.TargetNotFoundException,
    client.exceptions.TaskSetNotFoundException,
    client.exceptions.UnsupportedFeatureException,
    client.exceptions.UpdateInProgressException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_ecs.client import Exceptions

def handle_error(exc: Exceptions.AccessDeniedException) -> None:
    ...

Methods#

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("ecs").can_paginate method. boto3 documentation

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

close#

Closes underlying endpoint connections.

Type annotations and code completion for boto3.client("ecs").close method. boto3 documentation

# close method definition

def close(
    self,
) -> None:
    ...

create_capacity_provider#

Creates a new capacity provider.

Type annotations and code completion for boto3.client("ecs").create_capacity_provider method. boto3 documentation

# create_capacity_provider method definition

def create_capacity_provider(
    self,
    *,
    name: str,
    autoScalingGroupProvider: AutoScalingGroupProviderTypeDef,  # (1)
    tags: Sequence[TagTypeDef] = ...,  # (2)
) -> CreateCapacityProviderResponseTypeDef:  # (3)
    ...
  1. See AutoScalingGroupProviderTypeDef
  2. See TagTypeDef
  3. See CreateCapacityProviderResponseTypeDef
# create_capacity_provider method usage example with argument unpacking

kwargs: CreateCapacityProviderRequestRequestTypeDef = {  # (1)
    "name": ...,
    "autoScalingGroupProvider": ...,
}

parent.create_capacity_provider(**kwargs)
  1. See CreateCapacityProviderRequestRequestTypeDef

create_cluster#

Creates a new Amazon ECS cluster.

Type annotations and code completion for boto3.client("ecs").create_cluster method. boto3 documentation

# create_cluster method definition

def create_cluster(
    self,
    *,
    clusterName: str = ...,
    tags: Sequence[TagTypeDef] = ...,  # (1)
    settings: Sequence[ClusterSettingTypeDef] = ...,  # (2)
    configuration: ClusterConfigurationTypeDef = ...,  # (3)
    capacityProviders: Sequence[str] = ...,
    defaultCapacityProviderStrategy: Sequence[CapacityProviderStrategyItemTypeDef] = ...,  # (4)
    serviceConnectDefaults: ClusterServiceConnectDefaultsRequestTypeDef = ...,  # (5)
) -> CreateClusterResponseTypeDef:  # (6)
    ...
  1. See TagTypeDef
  2. See ClusterSettingTypeDef
  3. See ClusterConfigurationTypeDef
  4. See CapacityProviderStrategyItemTypeDef
  5. See ClusterServiceConnectDefaultsRequestTypeDef
  6. See CreateClusterResponseTypeDef
# create_cluster method usage example with argument unpacking

kwargs: CreateClusterRequestRequestTypeDef = {  # (1)
    "clusterName": ...,
}

parent.create_cluster(**kwargs)
  1. See CreateClusterRequestRequestTypeDef

create_service#

Runs and maintains your desired number of tasks from a specified task definition.

Type annotations and code completion for boto3.client("ecs").create_service method. boto3 documentation

# create_service method definition

def create_service(
    self,
    *,
    serviceName: str,
    cluster: str = ...,
    taskDefinition: str = ...,
    loadBalancers: Sequence[LoadBalancerTypeDef] = ...,  # (1)
    serviceRegistries: Sequence[ServiceRegistryTypeDef] = ...,  # (2)
    desiredCount: int = ...,
    clientToken: str = ...,
    launchType: LaunchTypeType = ...,  # (3)
    capacityProviderStrategy: Sequence[CapacityProviderStrategyItemTypeDef] = ...,  # (4)
    platformVersion: str = ...,
    role: str = ...,
    deploymentConfiguration: DeploymentConfigurationTypeDef = ...,  # (5)
    placementConstraints: Sequence[PlacementConstraintTypeDef] = ...,  # (6)
    placementStrategy: Sequence[PlacementStrategyTypeDef] = ...,  # (7)
    networkConfiguration: NetworkConfigurationTypeDef = ...,  # (8)
    healthCheckGracePeriodSeconds: int = ...,
    schedulingStrategy: SchedulingStrategyType = ...,  # (9)
    deploymentController: DeploymentControllerTypeDef = ...,  # (10)
    tags: Sequence[TagTypeDef] = ...,  # (11)
    enableECSManagedTags: bool = ...,
    propagateTags: PropagateTagsType = ...,  # (12)
    enableExecuteCommand: bool = ...,
    serviceConnectConfiguration: ServiceConnectConfigurationTypeDef = ...,  # (13)
) -> CreateServiceResponseTypeDef:  # (14)
    ...
  1. See LoadBalancerTypeDef
  2. See ServiceRegistryTypeDef
  3. See LaunchTypeType
  4. See CapacityProviderStrategyItemTypeDef
  5. See DeploymentConfigurationTypeDef
  6. See PlacementConstraintTypeDef
  7. See PlacementStrategyTypeDef
  8. See NetworkConfigurationTypeDef
  9. See SchedulingStrategyType
  10. See DeploymentControllerTypeDef
  11. See TagTypeDef
  12. See PropagateTagsType
  13. See ServiceConnectConfigurationTypeDef
  14. See CreateServiceResponseTypeDef
# create_service method usage example with argument unpacking

kwargs: CreateServiceRequestRequestTypeDef = {  # (1)
    "serviceName": ...,
}

parent.create_service(**kwargs)
  1. See CreateServiceRequestRequestTypeDef

create_task_set#

Create a task set in the specified cluster and service.

Type annotations and code completion for boto3.client("ecs").create_task_set method. boto3 documentation

# create_task_set method definition

def create_task_set(
    self,
    *,
    service: str,
    cluster: str,
    taskDefinition: str,
    externalId: str = ...,
    networkConfiguration: NetworkConfigurationTypeDef = ...,  # (1)
    loadBalancers: Sequence[LoadBalancerTypeDef] = ...,  # (2)
    serviceRegistries: Sequence[ServiceRegistryTypeDef] = ...,  # (3)
    launchType: LaunchTypeType = ...,  # (4)
    capacityProviderStrategy: Sequence[CapacityProviderStrategyItemTypeDef] = ...,  # (5)
    platformVersion: str = ...,
    scale: ScaleTypeDef = ...,  # (6)
    clientToken: str = ...,
    tags: Sequence[TagTypeDef] = ...,  # (7)
) -> CreateTaskSetResponseTypeDef:  # (8)
    ...
  1. See NetworkConfigurationTypeDef
  2. See LoadBalancerTypeDef
  3. See ServiceRegistryTypeDef
  4. See LaunchTypeType
  5. See CapacityProviderStrategyItemTypeDef
  6. See ScaleTypeDef
  7. See TagTypeDef
  8. See CreateTaskSetResponseTypeDef
# create_task_set method usage example with argument unpacking

kwargs: CreateTaskSetRequestRequestTypeDef = {  # (1)
    "service": ...,
    "cluster": ...,
    "taskDefinition": ...,
}

parent.create_task_set(**kwargs)
  1. See CreateTaskSetRequestRequestTypeDef

delete_account_setting#

Disables an account setting for a specified user, role, or the root user for an account.

Type annotations and code completion for boto3.client("ecs").delete_account_setting method. boto3 documentation

# delete_account_setting method definition

def delete_account_setting(
    self,
    *,
    name: SettingNameType,  # (1)
    principalArn: str = ...,
) -> DeleteAccountSettingResponseTypeDef:  # (2)
    ...
  1. See SettingNameType
  2. See DeleteAccountSettingResponseTypeDef
# delete_account_setting method usage example with argument unpacking

kwargs: DeleteAccountSettingRequestRequestTypeDef = {  # (1)
    "name": ...,
}

parent.delete_account_setting(**kwargs)
  1. See DeleteAccountSettingRequestRequestTypeDef

delete_attributes#

Deletes one or more custom attributes from an Amazon ECS resource.

Type annotations and code completion for boto3.client("ecs").delete_attributes method. boto3 documentation

# delete_attributes method definition

def delete_attributes(
    self,
    *,
    attributes: Sequence[AttributeTypeDef],  # (1)
    cluster: str = ...,
) -> DeleteAttributesResponseTypeDef:  # (2)
    ...
  1. See AttributeTypeDef
  2. See DeleteAttributesResponseTypeDef
# delete_attributes method usage example with argument unpacking

kwargs: DeleteAttributesRequestRequestTypeDef = {  # (1)
    "attributes": ...,
}

parent.delete_attributes(**kwargs)
  1. See DeleteAttributesRequestRequestTypeDef

delete_capacity_provider#

Deletes the specified capacity provider.

Type annotations and code completion for boto3.client("ecs").delete_capacity_provider method. boto3 documentation

# delete_capacity_provider method definition

def delete_capacity_provider(
    self,
    *,
    capacityProvider: str,
) -> DeleteCapacityProviderResponseTypeDef:  # (1)
    ...
  1. See DeleteCapacityProviderResponseTypeDef
# delete_capacity_provider method usage example with argument unpacking

kwargs: DeleteCapacityProviderRequestRequestTypeDef = {  # (1)
    "capacityProvider": ...,
}

parent.delete_capacity_provider(**kwargs)
  1. See DeleteCapacityProviderRequestRequestTypeDef

delete_cluster#

Deletes the specified cluster.

Type annotations and code completion for boto3.client("ecs").delete_cluster method. boto3 documentation

# delete_cluster method definition

def delete_cluster(
    self,
    *,
    cluster: str,
) -> DeleteClusterResponseTypeDef:  # (1)
    ...
  1. See DeleteClusterResponseTypeDef
# delete_cluster method usage example with argument unpacking

kwargs: DeleteClusterRequestRequestTypeDef = {  # (1)
    "cluster": ...,
}

parent.delete_cluster(**kwargs)
  1. See DeleteClusterRequestRequestTypeDef

delete_service#

Deletes a specified service within a cluster.

Type annotations and code completion for boto3.client("ecs").delete_service method. boto3 documentation

# delete_service method definition

def delete_service(
    self,
    *,
    service: str,
    cluster: str = ...,
    force: bool = ...,
) -> DeleteServiceResponseTypeDef:  # (1)
    ...
  1. See DeleteServiceResponseTypeDef
# delete_service method usage example with argument unpacking

kwargs: DeleteServiceRequestRequestTypeDef = {  # (1)
    "service": ...,
}

parent.delete_service(**kwargs)
  1. See DeleteServiceRequestRequestTypeDef

delete_task_definitions#

Deletes one or more task definitions.

Type annotations and code completion for boto3.client("ecs").delete_task_definitions method. boto3 documentation

# delete_task_definitions method definition

def delete_task_definitions(
    self,
    *,
    taskDefinitions: Sequence[str],
) -> DeleteTaskDefinitionsResponseTypeDef:  # (1)
    ...
  1. See DeleteTaskDefinitionsResponseTypeDef
# delete_task_definitions method usage example with argument unpacking

kwargs: DeleteTaskDefinitionsRequestRequestTypeDef = {  # (1)
    "taskDefinitions": ...,
}

parent.delete_task_definitions(**kwargs)
  1. See DeleteTaskDefinitionsRequestRequestTypeDef

delete_task_set#

Deletes a specified task set within a service.

Type annotations and code completion for boto3.client("ecs").delete_task_set method. boto3 documentation

# delete_task_set method definition

def delete_task_set(
    self,
    *,
    cluster: str,
    service: str,
    taskSet: str,
    force: bool = ...,
) -> DeleteTaskSetResponseTypeDef:  # (1)
    ...
  1. See DeleteTaskSetResponseTypeDef
# delete_task_set method usage example with argument unpacking

kwargs: DeleteTaskSetRequestRequestTypeDef = {  # (1)
    "cluster": ...,
    "service": ...,
    "taskSet": ...,
}

parent.delete_task_set(**kwargs)
  1. See DeleteTaskSetRequestRequestTypeDef

deregister_container_instance#

Deregisters an Amazon ECS container instance from the specified cluster.

Type annotations and code completion for boto3.client("ecs").deregister_container_instance method. boto3 documentation

# deregister_container_instance method definition

def deregister_container_instance(
    self,
    *,
    containerInstance: str,
    cluster: str = ...,
    force: bool = ...,
) -> DeregisterContainerInstanceResponseTypeDef:  # (1)
    ...
  1. See DeregisterContainerInstanceResponseTypeDef
# deregister_container_instance method usage example with argument unpacking

kwargs: DeregisterContainerInstanceRequestRequestTypeDef = {  # (1)
    "containerInstance": ...,
}

parent.deregister_container_instance(**kwargs)
  1. See DeregisterContainerInstanceRequestRequestTypeDef

deregister_task_definition#

Deregisters the specified task definition by family and revision.

Type annotations and code completion for boto3.client("ecs").deregister_task_definition method. boto3 documentation

# deregister_task_definition method definition

def deregister_task_definition(
    self,
    *,
    taskDefinition: str,
) -> DeregisterTaskDefinitionResponseTypeDef:  # (1)
    ...
  1. See DeregisterTaskDefinitionResponseTypeDef
# deregister_task_definition method usage example with argument unpacking

kwargs: DeregisterTaskDefinitionRequestRequestTypeDef = {  # (1)
    "taskDefinition": ...,
}

parent.deregister_task_definition(**kwargs)
  1. See DeregisterTaskDefinitionRequestRequestTypeDef

describe_capacity_providers#

Describes one or more of your capacity providers.

Type annotations and code completion for boto3.client("ecs").describe_capacity_providers method. boto3 documentation

# describe_capacity_providers method definition

def describe_capacity_providers(
    self,
    *,
    capacityProviders: Sequence[str] = ...,
    include: Sequence[CapacityProviderFieldType] = ...,  # (1)
    maxResults: int = ...,
    nextToken: str = ...,
) -> DescribeCapacityProvidersResponseTypeDef:  # (2)
    ...
  1. See CapacityProviderFieldType
  2. See DescribeCapacityProvidersResponseTypeDef
# describe_capacity_providers method usage example with argument unpacking

kwargs: DescribeCapacityProvidersRequestRequestTypeDef = {  # (1)
    "capacityProviders": ...,
}

parent.describe_capacity_providers(**kwargs)
  1. See DescribeCapacityProvidersRequestRequestTypeDef

describe_clusters#

Describes one or more of your clusters.

Type annotations and code completion for boto3.client("ecs").describe_clusters method. boto3 documentation

# describe_clusters method definition

def describe_clusters(
    self,
    *,
    clusters: Sequence[str] = ...,
    include: Sequence[ClusterFieldType] = ...,  # (1)
) -> DescribeClustersResponseTypeDef:  # (2)
    ...
  1. See ClusterFieldType
  2. See DescribeClustersResponseTypeDef
# describe_clusters method usage example with argument unpacking

kwargs: DescribeClustersRequestRequestTypeDef = {  # (1)
    "clusters": ...,
}

parent.describe_clusters(**kwargs)
  1. See DescribeClustersRequestRequestTypeDef

describe_container_instances#

Describes one or more container instances.

Type annotations and code completion for boto3.client("ecs").describe_container_instances method. boto3 documentation

# describe_container_instances method definition

def describe_container_instances(
    self,
    *,
    containerInstances: Sequence[str],
    cluster: str = ...,
    include: Sequence[ContainerInstanceFieldType] = ...,  # (1)
) -> DescribeContainerInstancesResponseTypeDef:  # (2)
    ...
  1. See ContainerInstanceFieldType
  2. See DescribeContainerInstancesResponseTypeDef
# describe_container_instances method usage example with argument unpacking

kwargs: DescribeContainerInstancesRequestRequestTypeDef = {  # (1)
    "containerInstances": ...,
}

parent.describe_container_instances(**kwargs)
  1. See DescribeContainerInstancesRequestRequestTypeDef

describe_services#

Describes the specified services running in your cluster.

Type annotations and code completion for boto3.client("ecs").describe_services method. boto3 documentation

# describe_services method definition

def describe_services(
    self,
    *,
    services: Sequence[str],
    cluster: str = ...,
    include: Sequence[ServiceFieldType] = ...,  # (1)
) -> DescribeServicesResponseTypeDef:  # (2)
    ...
  1. See ServiceFieldType
  2. See DescribeServicesResponseTypeDef
# describe_services method usage example with argument unpacking

kwargs: DescribeServicesRequestRequestTypeDef = {  # (1)
    "services": ...,
}

parent.describe_services(**kwargs)
  1. See DescribeServicesRequestRequestTypeDef

describe_task_definition#

Describes a task definition.

Type annotations and code completion for boto3.client("ecs").describe_task_definition method. boto3 documentation

# describe_task_definition method definition

def describe_task_definition(
    self,
    *,
    taskDefinition: str,
    include: Sequence[TaskDefinitionFieldType] = ...,  # (1)
) -> DescribeTaskDefinitionResponseTypeDef:  # (2)
    ...
  1. See TaskDefinitionFieldType
  2. See DescribeTaskDefinitionResponseTypeDef
# describe_task_definition method usage example with argument unpacking

kwargs: DescribeTaskDefinitionRequestRequestTypeDef = {  # (1)
    "taskDefinition": ...,
}

parent.describe_task_definition(**kwargs)
  1. See DescribeTaskDefinitionRequestRequestTypeDef

describe_task_sets#

Describes the task sets in the specified cluster and service.

Type annotations and code completion for boto3.client("ecs").describe_task_sets method. boto3 documentation

# describe_task_sets method definition

def describe_task_sets(
    self,
    *,
    cluster: str,
    service: str,
    taskSets: Sequence[str] = ...,
    include: Sequence[TaskSetFieldType] = ...,  # (1)
) -> DescribeTaskSetsResponseTypeDef:  # (2)
    ...
  1. See TaskSetFieldType
  2. See DescribeTaskSetsResponseTypeDef
# describe_task_sets method usage example with argument unpacking

kwargs: DescribeTaskSetsRequestRequestTypeDef = {  # (1)
    "cluster": ...,
    "service": ...,
}

parent.describe_task_sets(**kwargs)
  1. See DescribeTaskSetsRequestRequestTypeDef

describe_tasks#

Describes a specified task or tasks.

Type annotations and code completion for boto3.client("ecs").describe_tasks method. boto3 documentation

# describe_tasks method definition

def describe_tasks(
    self,
    *,
    tasks: Sequence[str],
    cluster: str = ...,
    include: Sequence[TaskFieldType] = ...,  # (1)
) -> DescribeTasksResponseTypeDef:  # (2)
    ...
  1. See TaskFieldType
  2. See DescribeTasksResponseTypeDef
# describe_tasks method usage example with argument unpacking

kwargs: DescribeTasksRequestRequestTypeDef = {  # (1)
    "tasks": ...,
}

parent.describe_tasks(**kwargs)
  1. See DescribeTasksRequestRequestTypeDef

discover_poll_endpoint#

.

Type annotations and code completion for boto3.client("ecs").discover_poll_endpoint method. boto3 documentation

# discover_poll_endpoint method definition

def discover_poll_endpoint(
    self,
    *,
    containerInstance: str = ...,
    cluster: str = ...,
) -> DiscoverPollEndpointResponseTypeDef:  # (1)
    ...
  1. See DiscoverPollEndpointResponseTypeDef
# discover_poll_endpoint method usage example with argument unpacking

kwargs: DiscoverPollEndpointRequestRequestTypeDef = {  # (1)
    "containerInstance": ...,
}

parent.discover_poll_endpoint(**kwargs)
  1. See DiscoverPollEndpointRequestRequestTypeDef

execute_command#

Runs a command remotely on a container within a task.

Type annotations and code completion for boto3.client("ecs").execute_command method. boto3 documentation

# execute_command method definition

def execute_command(
    self,
    *,
    command: str,
    interactive: bool,
    task: str,
    cluster: str = ...,
    container: str = ...,
) -> ExecuteCommandResponseTypeDef:  # (1)
    ...
  1. See ExecuteCommandResponseTypeDef
# execute_command method usage example with argument unpacking

kwargs: ExecuteCommandRequestRequestTypeDef = {  # (1)
    "command": ...,
    "interactive": ...,
    "task": ...,
}

parent.execute_command(**kwargs)
  1. See ExecuteCommandRequestRequestTypeDef

generate_presigned_url#

Generate a presigned url given a client, its method, and arguments.

Type annotations and code completion for boto3.client("ecs").generate_presigned_url method. boto3 documentation

# generate_presigned_url method definition

def generate_presigned_url(
    self,
    ClientMethod: str,
    Params: Mapping[str, Any] = ...,
    ExpiresIn: int = 3600,
    HttpMethod: str = ...,
) -> str:
    ...

get_task_protection#

Retrieves the protection status of tasks in an Amazon ECS service.

Type annotations and code completion for boto3.client("ecs").get_task_protection method. boto3 documentation

# get_task_protection method definition

def get_task_protection(
    self,
    *,
    cluster: str,
    tasks: Sequence[str] = ...,
) -> GetTaskProtectionResponseTypeDef:  # (1)
    ...
  1. See GetTaskProtectionResponseTypeDef
# get_task_protection method usage example with argument unpacking

kwargs: GetTaskProtectionRequestRequestTypeDef = {  # (1)
    "cluster": ...,
}

parent.get_task_protection(**kwargs)
  1. See