Skip to content

describe_container_instances async

describe_container_instances(
    container_instances: StringList,
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
    cluster: Optional[String] = None,
    include: Optional[ContainerInstanceFieldList] = None,
) -> DescribeContainerInstancesResponse

Describes one or more container instances. Returns metadata about each container instance requested.

Parameters:

  • cluster (Optional[String], default: None ) –

    The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instances to describe. If you do not specify a cluster, the default cluster is assumed. This parameter is required if the container instance or container instances you are describing were launched in any cluster other than the default cluster.

  • container_instances (StringList) –

    A list of up to 100 container instance IDs or full Amazon Resource Name (ARN) entries.

  • include (Optional[ContainerInstanceFieldList], default: None ) –

    Specifies whether you want to see the resource tags for the container instance. If TAGS is specified, the tags are included in the response. If CONTAINER_INSTANCE_HEALTH is specified, the container instance health is included in the response. If this field is omitted, tags and container instance health status aren't included in the response.

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.

  • ServerException –

    These errors are usually caused by a server issue.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To describe container instance This example provides a description of the specified container instance in your default region, using the container instance UUID as an identifier.

>>> await client.describe_container_instances(cluster='default', container_instances=['f2756532-8f13-4d53-87c9-aed50dc94cd7'])
Source code in docs_src/capo_ecs/_services/async_ecs.py
async def describe_container_instances(
    self,
    container_instances: "capo_ecs.types.string_list.StringList",
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
    cluster: Optional["capo_ecs.types.string.String"] = None,
    include: Optional[
        "capo_ecs.types.container_instance_field_list.ContainerInstanceFieldList"
    ] = None,
) -> "capo_ecs.types.describe_container_instances_response.DescribeContainerInstancesResponse":
    """<p>Describes one or more container instances. Returns metadata about each container instance requested.</p>

    Args:
        cluster: <p>The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instances to describe. If you do not specify a cluster, the default cluster is assumed. This parameter is required if the container instance or container instances you are describing were launched in any cluster other than the default cluster.</p>
        container_instances: <p>A list of up to 100 container instance IDs or full Amazon Resource Name (ARN) entries.</p>
        include: <p>Specifies whether you want to see the resource tags for the container instance. If <code>TAGS</code> is specified, the tags are included in the response. If <code>CONTAINER_INSTANCE_HEALTH</code> is specified, the container instance health is included in the response. If this field is omitted, tags and container instance health status aren't included in the response.</p>

    Raises:
        capo_ecs.errors.access_denied_exception.AccessDeniedException: <p>You don't have authorization to perform the requested action.</p>
        capo_ecs.errors.client_exception.ClientException: <p>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.</p>
        capo_ecs.errors.cluster_not_found_exception.ClusterNotFoundException: <p>The specified cluster wasn't found. You can view your available clusters with <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListClusters.html">ListClusters</a>. Amazon ECS clusters are Region specific.</p>
        capo_ecs.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter isn't valid. Review the available parameters for the API request.</p> <p>For more information about service event errors, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages-list.html">Amazon ECS service event messages</a>. </p>
        capo_ecs.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
        capo_ecs.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To describe container instance
        This example provides a description of the specified container instance in your default region, using the container instance UUID as an identifier.

        >>> await client.describe_container_instances(cluster='default', container_instances=['f2756532-8f13-4d53-87c9-aed50dc94cd7'])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecs.types.describe_container_instances_request.DescribeContainerInstancesRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecs.types.describe_container_instances_response.DescribeContainerInstancesResponse"
    ]:
        import capo_ecs._operations.amazon_ec2_container_service_v20141113.describe_container_instances

        (
            output,
            http_response,
        ) = await capo_ecs._operations.amazon_ec2_container_service_v20141113.describe_container_instances.async_describe_container_instances(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeContainerInstances")
    )
    input_: capo_ecs.types.describe_container_instances_request.DescribeContainerInstancesRequest = {
        "container_instances": container_instances
    }
    if cluster is not None:
        input_["cluster"] = cluster
    if include is not None:
        input_["include"] = include

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output