RegisterContainerInstance - Amazon Elastic Container Service

RegisterContainerInstance

Note

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.

Request Syntax

{ "attributes": [ { "name": "string", "targetId": "string", "targetType": "string", "value": "string" } ], "cluster": "string", "containerInstanceArn": "string", "instanceIdentityDocument": "string", "instanceIdentityDocumentSignature": "string", "platformDevices": [ { "id": "string", "type": "string" } ], "tags": [ { "key": "string", "value": "string" } ], "totalResources": [ { "doubleValue": number, "integerValue": number, "longValue": number, "name": "string", "stringSetValue": [ "string" ], "type": "string" } ], "versionInfo": { "agentHash": "string", "agentVersion": "string", "dockerVersion": "string" } }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

attributes

The container instance attributes that this container instance supports.

Type: Array of Attribute objects

Required: No

cluster

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.

Type: String

Required: No

containerInstanceArn

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

Type: String

Required: No

instanceIdentityDocument

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/

Type: String

Required: No

instanceIdentityDocumentSignature

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/

Type: String

Required: No

platformDevices

The devices that are available on the container instance. The only supported device type is a GPU.

Type: Array of PlatformDevice objects

Required: No

tags

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

Type: Array of Tag objects

Array Members: Minimum number of 0 items. Maximum number of 50 items.

Required: No

totalResources

The resources available on the instance.

Type: Array of Resource objects

Required: No

versionInfo

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

Type: VersionInfo object

Required: No

Response Syntax

{ "containerInstance": { "agentConnected": boolean, "agentUpdateStatus": "string", "attachments": [ { "details": [ { "name": "string", "value": "string" } ], "id": "string", "status": "string", "type": "string" } ], "attributes": [ { "name": "string", "targetId": "string", "targetType": "string", "value": "string" } ], "capacityProviderName": "string", "containerInstanceArn": "string", "ec2InstanceId": "string", "healthStatus": { "details": [ { "lastStatusChange": number, "lastUpdated": number, "status": "string", "type": "string" } ], "overallStatus": "string" }, "pendingTasksCount": number, "registeredAt": number, "registeredResources": [ { "doubleValue": number, "integerValue": number, "longValue": number, "name": "string", "stringSetValue": [ "string" ], "type": "string" } ], "remainingResources": [ { "doubleValue": number, "integerValue": number, "longValue": number, "name": "string", "stringSetValue": [ "string" ], "type": "string" } ], "runningTasksCount": number, "status": "string", "statusReason": "string", "tags": [ { "key": "string", "value": "string" } ], "version": number, "versionInfo": { "agentHash": "string", "agentVersion": "string", "dockerVersion": "string" } } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

containerInstance

The container instance that was registered.

Type: ContainerInstance object

Errors

For information about the errors that are common to all actions, see Common Errors.

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.

The following list includes additional causes for the error:

  • The RunTask could not be processed because you use managed scaling and there is a capacity error because the quota of tasks in the PROVISIONING per cluster has been reached. For information about the service quotas, see Amazon ECS service quotas.

HTTP Status Code: 400

InvalidParameterException

The specified parameter isn't valid. Review the available parameters for the API request.

HTTP Status Code: 400

ServerException

These errors are usually caused by a server issue.

HTTP Status Code: 500

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: