Skip to content

register_container_instance async

register_container_instance(
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
    cluster: Optional[String] = None,
    instance_identity_document: Optional[String] = None,
    instance_identity_document_signature: Optional[String] = None,
    total_resources: Optional[Resources] = None,
    version_info: Optional[VersionInfo] = None,
    container_instance_arn: Optional[String] = None,
    attributes: Optional[Attributes] = None,
    platform_devices: Optional[PlatformDevices] = None,
    tags: Optional[Tags] = None,
) -> RegisterContainerInstanceResponse

This action is only used by the Amazon ECS agent, and it is not intended for use outside of the agent.

Registers an EC2 instance into the specified cluster. This instance becomes available to place containers on.

Parameters:

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

    The short name or full Amazon Resource Name (ARN) of the cluster to register your container instance with. If you do not specify a cluster, the default cluster is assumed.

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

    The instance identity document for the EC2 instance to register. This document can be found by running the following command from the instance: curl http://169.254.169.254/latest/dynamic/instance-identity/document/

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

    The instance identity document signature for the EC2 instance to register. This signature can be found by running the following command from the instance: curl http://169.254.169.254/latest/dynamic/instance-identity/signature/

  • total_resources (Optional[Resources], default: None ) –

    The resources available on the instance.

  • version_info (Optional[VersionInfo], default: None ) –

    The version information for the Amazon ECS container agent and Docker daemon that runs on the container instance.

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

    The ARN of the container instance (if it was previously registered).

  • attributes (Optional[Attributes], default: None ) –

    The container instance attributes that this container instance supports.

  • platform_devices (Optional[PlatformDevices], default: None ) –

    The devices that are available on the container instance. The supported device types are GPUs and Neuron devices.

  • tags (Optional[Tags], default: None ) –

    The metadata that you apply to the container instance to help you categorize and organize them. Each tag consists of a key and an optional value. You define both.

    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.

  • ServerException –

    These errors are usually caused by a server issue.

  • UnknownServiceError –

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

Source code in docs_src/capo_ecs/_services/async_ecs.py
async def register_container_instance(
    self,
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
    cluster: Optional["capo_ecs.types.string.String"] = None,
    instance_identity_document: Optional["capo_ecs.types.string.String"] = None,
    instance_identity_document_signature: Optional[
        "capo_ecs.types.string.String"
    ] = None,
    total_resources: Optional["capo_ecs.types.resources.Resources"] = None,
    version_info: Optional["capo_ecs.types.version_info.VersionInfo"] = None,
    container_instance_arn: Optional["capo_ecs.types.string.String"] = None,
    attributes: Optional["capo_ecs.types.attributes.Attributes"] = None,
    platform_devices: Optional[
        "capo_ecs.types.platform_devices.PlatformDevices"
    ] = None,
    tags: Optional["capo_ecs.types.tags.Tags"] = None,
) -> "capo_ecs.types.register_container_instance_response.RegisterContainerInstanceResponse":
    """<note> <p>This action is only used by the Amazon ECS agent, and it is not intended for use outside of the agent.</p> </note> <p>Registers an EC2 instance into the specified cluster. This instance becomes available to place containers on.</p>

    Args:
        cluster: <p>The short name or full Amazon Resource Name (ARN) of the cluster to register your container instance with. If you do not specify a cluster, the default cluster is assumed.</p>
        instance_identity_document: <p>The instance identity document for the EC2 instance to register. This document can be found by running the following command from the instance: <code>curl http://169.254.169.254/latest/dynamic/instance-identity/document/</code> </p>
        instance_identity_document_signature: <p>The instance identity document signature for the EC2 instance to register. This signature can be found by running the following command from the instance: <code>curl http://169.254.169.254/latest/dynamic/instance-identity/signature/</code> </p>
        total_resources: <p>The resources available on the instance.</p>
        version_info: <p>The version information for the Amazon ECS container agent and Docker daemon that runs on the container instance.</p>
        container_instance_arn: <p>The ARN of the container instance (if it was previously registered).</p>
        attributes: <p>The container instance attributes that this container instance supports.</p>
        platform_devices: <p>The devices that are available on the container instance. The supported device types are GPUs and Neuron devices.</p>
        tags: <p>The metadata that you apply to the container instance to help you categorize and organize them. Each tag consists of a key and an optional value. You define both.</p> <p>The following basic restrictions apply to tags:</p> <ul> <li> <p>Maximum number of tags per resource - 50</p> </li> <li> <p>For each resource, each tag key must be unique, and each tag key can have only one value.</p> </li> <li> <p>Maximum key length - 128 Unicode characters in UTF-8</p> </li> <li> <p>Maximum value length - 256 Unicode characters in UTF-8</p> </li> <li> <p>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: + - = . _ : / @.</p> </li> <li> <p>Tag keys and values are case-sensitive.</p> </li> <li> <p>Do not use <code>aws:</code>, <code>AWS:</code>, 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.</p> </li> </ul>

    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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecs.types.register_container_instance_request.RegisterContainerInstanceRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecs.types.register_container_instance_response.RegisterContainerInstanceResponse"
    ]:
        import capo_ecs._operations.amazon_ec2_container_service_v20141113.register_container_instance

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RegisterContainerInstance")
    )
    input_: capo_ecs.types.register_container_instance_request.RegisterContainerInstanceRequest = {}
    if cluster is not None:
        input_["cluster"] = cluster
    if instance_identity_document is not None:
        input_["instance_identity_document"] = instance_identity_document
    if instance_identity_document_signature is not None:
        input_["instance_identity_document_signature"] = (
            instance_identity_document_signature
        )
    if total_resources is not None:
        input_["total_resources"] = total_resources
    if version_info is not None:
        input_["version_info"] = version_info
    if container_instance_arn is not None:
        input_["container_instance_arn"] = container_instance_arn
    if attributes is not None:
        input_["attributes"] = attributes
    if platform_devices is not None:
        input_["platform_devices"] = platform_devices
    if tags is not None:
        input_["tags"] = tags

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