2019/06/06 - Amazon EC2 Container Service - 1 new 10 updated api methods
Changes This release of Amazon Elastic Container Service (Amazon ECS) introduces support for launching container instances using supported Amazon EC2 instance types that have increased elastic network interface density. Using these instance types and opting in to the awsvpcTrunking account setting provides increased elastic network interface (ENI) density on newly launched container instances which allows you to place more tasks on each container instance.
Note
This action is only used by the Amazon ECS agent, and it is not intended for use outside of the agent.
Sent to acknowledge that an attachment changed states.
See also: AWS API Documentation
Request Syntax
client.submit_attachment_state_changes( cluster='string', attachments=[ { 'attachmentArn': 'string', 'status': 'string' }, ] )
string
The short name or full ARN of the cluster that hosts the container instance the attachment belongs to.
list
[REQUIRED]
Any attachments associated with the state change request.
(dict) --
An object representing a change in state for a task attachment.
attachmentArn (string) -- [REQUIRED]
The Amazon Resource Name (ARN) of the attachment.
status (string) -- [REQUIRED]
The status of the attachment.
dict
Response Syntax
{ 'acknowledgment': 'string' }
Response Structure
(dict) --
acknowledgment (string) --
Acknowledgement of the state change.
{'name': ['awsvpcTrunking']}Response
{'setting': {'name': ['awsvpcTrunking']}}
Disables an account setting for a specified IAM user, IAM role, or the root user for an account.
See also: AWS API Documentation
Request Syntax
client.delete_account_setting( name='serviceLongArnFormat'|'taskLongArnFormat'|'containerInstanceLongArnFormat'|'awsvpcTrunking', principalArn='string' )
string
[REQUIRED]
The resource name for which to disable the account setting. If serviceLongArnFormat is specified, the ARN for your Amazon ECS services is affected. If taskLongArnFormat is specified, the ARN and resource ID for your Amazon ECS tasks is affected. If containerInstanceLongArnFormat is specified, the ARN and resource ID for your Amazon ECS container instances is affected. If awsvpcTrunking is specified, the ENI limit for your Amazon ECS container instances is affected.
string
The ARN of the principal, which can be an IAM user, IAM role, or the root user. If you specify the root user, it disables the account setting for all IAM users, IAM roles, and the root user of the account unless an IAM user or role explicitly overrides these settings. If this field is omitted, the setting is changed only for the authenticated user.
dict
Response Syntax
{ 'setting': { 'name': 'serviceLongArnFormat'|'taskLongArnFormat'|'containerInstanceLongArnFormat'|'awsvpcTrunking', 'value': 'string', 'principalArn': 'string' } }
Response Structure
(dict) --
setting (dict) --
The account setting for the specified principal ARN.
name (string) --
The account resource name.
value (string) --
The current account setting for the resource name. If enabled , the resource receives the new Amazon Resource Name (ARN) and resource identifier (ID) format. If disabled , the resource receives the old Amazon Resource Name (ARN) and resource identifier (ID) format.
principalArn (string) --
The ARN of the principal, which can be an IAM user, IAM role, or the root user. If this field is omitted, the authenticated user is assumed.
{'containerInstance': {'statusReason': 'string'}}
Deregisters an Amazon ECS container instance from the specified cluster. This instance is no longer available to run tasks.
If you intend to use the container instance for some other purpose after deregistration, you should stop all of the tasks running on the container instance before deregistration. That prevents any orphaned tasks from consuming resources.
Deregistering a container instance removes the instance from a cluster, but it does not terminate the EC2 instance. If you are finished using the instance, be sure to terminate it in the Amazon EC2 console to stop billing.
Note
If you terminate a running container instance, Amazon ECS automatically deregisters the instance from your cluster (stopped container instances or instances with disconnected agents are not automatically deregistered when terminated).
See also: AWS API Documentation
Request Syntax
client.deregister_container_instance( cluster='string', containerInstance='string', force=True|False )
string
The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instance to deregister. If you do not specify a cluster, the default cluster is assumed.
string
[REQUIRED]
The container instance ID or full ARN of the container instance to deregister. The ARN contains the arn:aws:ecs namespace, followed by the Region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance ID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_ID .
boolean
Forces the deregistration of the container instance. If you have tasks running on the container instance when you deregister it with the force option, these tasks remain running until you terminate the instance or the tasks stop through some other means, but they are orphaned (no longer monitored or accounted for by Amazon ECS). If an orphaned task on your container instance is part of an Amazon ECS service, then the service scheduler starts another copy of that task, on a different container instance if possible.
Any containers in orphaned service tasks that are registered with a Classic Load Balancer or an Application Load Balancer target group are deregistered. They begin connection draining according to the settings on the load balancer or target group.
dict
Response Syntax
{ 'containerInstance': { 'containerInstanceArn': 'string', 'ec2InstanceId': 'string', 'version': 123, 'versionInfo': { 'agentVersion': 'string', 'agentHash': 'string', 'dockerVersion': 'string' }, 'remainingResources': [ { 'name': 'string', 'type': 'string', 'doubleValue': 123.0, 'longValue': 123, 'integerValue': 123, 'stringSetValue': [ 'string', ] }, ], 'registeredResources': [ { 'name': 'string', 'type': 'string', 'doubleValue': 123.0, 'longValue': 123, 'integerValue': 123, 'stringSetValue': [ 'string', ] }, ], 'status': 'string', 'statusReason': 'string', 'agentConnected': True|False, 'runningTasksCount': 123, 'pendingTasksCount': 123, 'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED', 'attributes': [ { 'name': 'string', 'value': 'string', 'targetType': 'container-instance', 'targetId': 'string' }, ], 'registeredAt': datetime(2015, 1, 1), 'attachments': [ { 'id': 'string', 'type': 'string', 'status': 'string', 'details': [ { 'name': 'string', 'value': 'string' }, ] }, ], 'tags': [ { 'key': 'string', 'value': 'string' }, ] } }
Response Structure
(dict) --
containerInstance (dict) --
The container instance that was deregistered.
containerInstanceArn (string) --
The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the Region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance ID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_ID .
ec2InstanceId (string) --
The EC2 instance ID of the container instance.
version (integer) --
The version counter for the container instance. Every time a container instance experiences a change that triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS container instance state with CloudWatch Events, you can compare the version of a container instance reported by the Amazon ECS APIs with the version reported in CloudWatch Events for the container instance (inside the detail object) to verify that the version in your event stream is current.
versionInfo (dict) --
The version information for the Amazon ECS container agent and Docker daemon running on the container instance.
agentVersion (string) --
The version number of the Amazon ECS container agent.
agentHash (string) --
The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.
dockerVersion (string) --
The Docker version running on the container instance.
remainingResources (list) --
For CPU and memory resource types, this parameter describes the remaining CPU and memory that has not already been allocated to tasks and is therefore available for new tasks. For port resource types, this parameter describes the ports that were reserved by the Amazon ECS container agent (at instance registration time) and any task containers that have reserved port mappings on the host (with the host or bridge network mode). Any port that is not specified here is available for new tasks.
(dict) --
Describes the resources available for a container instance.
name (string) --
The name of the resource, such as CPU , MEMORY , PORTS , PORTS_UDP , or a user-defined resource.
type (string) --
The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .
doubleValue (float) --
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
longValue (integer) --
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
integerValue (integer) --
When the integerValue type is set, the value of the resource must be an integer.
stringSetValue (list) --
When the stringSetValue type is set, the value of the resource must be a string type.
(string) --
registeredResources (list) --
For CPU and memory resource types, this parameter describes the amount of each resource that was available on the container instance when the container agent registered it with Amazon ECS. This value represents the total amount of CPU and memory that can be allocated on this container instance to tasks. For port resource types, this parameter describes the ports that were reserved by the Amazon ECS container agent when it registered the container instance with Amazon ECS.
(dict) --
Describes the resources available for a container instance.
name (string) --
The name of the resource, such as CPU , MEMORY , PORTS , PORTS_UDP , or a user-defined resource.
type (string) --
The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .
doubleValue (float) --
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
longValue (integer) --
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
integerValue (integer) --
When the integerValue type is set, the value of the resource must be an integer.
stringSetValue (list) --
When the stringSetValue type is set, the value of the resource must be a string type.
(string) --
status (string) --
The status of the container instance. The valid values are REGISTERING , REGISTRATION_FAILED , ACTIVE , INACTIVE , DEREGISTERING , or DRAINING .
If your account has opted in to the awsvpcTrunking account setting, then any newly registered container instance will transition to a REGISTERING status while the trunk elastic network interface is provisioned for the instance. If the registration fails, the instance will transition to a REGISTRATION_FAILED status. You can describe the container instance and see the reason for failure in the statusReason parameter. Once the container instance is terminated, the instance transitions to a DEREGISTERING status while the trunk elastic network interface is deprovisioned. The instance then transitions to an INACTIVE status.
The ACTIVE status indicates that the container instance can accept tasks. The DRAINING indicates that new tasks are not placed on the container instance and any service tasks running on the container instance are removed if possible. For more information, see Container Instance Draining in the Amazon Elastic Container Service Developer Guide .
statusReason (string) --
The reason that the container instance reached its current status.
agentConnected (boolean) --
This parameter returns true if the agent is connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped return false . Only instances connected to an agent can accept placement requests.
runningTasksCount (integer) --
The number of tasks on the container instance that are in the RUNNING status.
pendingTasksCount (integer) --
The number of tasks on the container instance that are in the PENDING status.
agentUpdateStatus (string) --
The status of the most recent agent update. If an update has never been requested, this value is NULL .
attributes (list) --
The attributes set for the container instance, either by the Amazon ECS container agent at instance registration or manually with the PutAttributes operation.
(dict) --
An attribute is a name-value pair associated with an Amazon ECS object. Attributes enable you to extend the Amazon ECS data model by adding custom metadata to your resources. For more information, see Attributes in the Amazon Elastic Container Service Developer Guide .
name (string) --
The name of the attribute. Up to 128 letters (uppercase and lowercase), numbers, hyphens, underscores, and periods are allowed.
value (string) --
The value of the attribute. Up to 128 letters (uppercase and lowercase), numbers, hyphens, underscores, periods, at signs (@), forward slashes, colons, and spaces are allowed.
targetType (string) --
The type of the target with which to attach the attribute. This parameter is required if you use the short form ID for a resource instead of the full ARN.
targetId (string) --
The ID of the target. You can specify the short form ID for a resource or the full Amazon Resource Name (ARN).
registeredAt (datetime) --
The Unix timestamp for when the container instance was registered.
attachments (list) --
The resources attached to a container instance, such as elastic network interfaces.
(dict) --
An object representing a container instance or task attachment.
id (string) --
The unique identifier for the attachment.
type (string) --
The type of the attachment, such as ElasticNetworkInterface .
status (string) --
The status of the attachment. Valid values are PRECREATED , CREATED , ATTACHING , ATTACHED , DETACHING , DETACHED , and DELETED .
details (list) --
Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
tags (list) --
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, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
(dict) --
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
key (string) --
One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
value (string) --
The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).
{'containerInstances': {'statusReason': 'string'}}
Describes Amazon Elastic Container Service container instances. Returns metadata about registered and remaining resources on each container instance requested.
See also: AWS API Documentation
Request Syntax
client.describe_container_instances( cluster='string', containerInstances=[ 'string', ], include=[ 'TAGS', ] )
string
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.
list
[REQUIRED]
A list of up to 100 container instance IDs or full Amazon Resource Name (ARN) entries.
(string) --
list
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 this field is omitted, tags are not included in the response.
(string) --
dict
Response Syntax
{ 'containerInstances': [ { 'containerInstanceArn': 'string', 'ec2InstanceId': 'string', 'version': 123, 'versionInfo': { 'agentVersion': 'string', 'agentHash': 'string', 'dockerVersion': 'string' }, 'remainingResources': [ { 'name': 'string', 'type': 'string', 'doubleValue': 123.0, 'longValue': 123, 'integerValue': 123, 'stringSetValue': [ 'string', ] }, ], 'registeredResources': [ { 'name': 'string', 'type': 'string', 'doubleValue': 123.0, 'longValue': 123, 'integerValue': 123, 'stringSetValue': [ 'string', ] }, ], 'status': 'string', 'statusReason': 'string', 'agentConnected': True|False, 'runningTasksCount': 123, 'pendingTasksCount': 123, 'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED', 'attributes': [ { 'name': 'string', 'value': 'string', 'targetType': 'container-instance', 'targetId': 'string' }, ], 'registeredAt': datetime(2015, 1, 1), 'attachments': [ { 'id': 'string', 'type': 'string', 'status': 'string', 'details': [ { 'name': 'string', 'value': 'string' }, ] }, ], 'tags': [ { 'key': 'string', 'value': 'string' }, ] }, ], 'failures': [ { 'arn': 'string', 'reason': 'string' }, ] }
Response Structure
(dict) --
containerInstances (list) --
The list of container instances.
(dict) --
An EC2 instance that is running the Amazon ECS agent and has been registered with a cluster.
containerInstanceArn (string) --
The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the Region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance ID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_ID .
ec2InstanceId (string) --
The EC2 instance ID of the container instance.
version (integer) --
The version counter for the container instance. Every time a container instance experiences a change that triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS container instance state with CloudWatch Events, you can compare the version of a container instance reported by the Amazon ECS APIs with the version reported in CloudWatch Events for the container instance (inside the detail object) to verify that the version in your event stream is current.
versionInfo (dict) --
The version information for the Amazon ECS container agent and Docker daemon running on the container instance.
agentVersion (string) --
The version number of the Amazon ECS container agent.
agentHash (string) --
The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.
dockerVersion (string) --
The Docker version running on the container instance.
remainingResources (list) --
For CPU and memory resource types, this parameter describes the remaining CPU and memory that has not already been allocated to tasks and is therefore available for new tasks. For port resource types, this parameter describes the ports that were reserved by the Amazon ECS container agent (at instance registration time) and any task containers that have reserved port mappings on the host (with the host or bridge network mode). Any port that is not specified here is available for new tasks.
(dict) --
Describes the resources available for a container instance.
name (string) --
The name of the resource, such as CPU , MEMORY , PORTS , PORTS_UDP , or a user-defined resource.
type (string) --
The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .
doubleValue (float) --
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
longValue (integer) --
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
integerValue (integer) --
When the integerValue type is set, the value of the resource must be an integer.
stringSetValue (list) --
When the stringSetValue type is set, the value of the resource must be a string type.
(string) --
registeredResources (list) --
For CPU and memory resource types, this parameter describes the amount of each resource that was available on the container instance when the container agent registered it with Amazon ECS. This value represents the total amount of CPU and memory that can be allocated on this container instance to tasks. For port resource types, this parameter describes the ports that were reserved by the Amazon ECS container agent when it registered the container instance with Amazon ECS.
(dict) --
Describes the resources available for a container instance.
name (string) --
The name of the resource, such as CPU , MEMORY , PORTS , PORTS_UDP , or a user-defined resource.
type (string) --
The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .
doubleValue (float) --
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
longValue (integer) --
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
integerValue (integer) --
When the integerValue type is set, the value of the resource must be an integer.
stringSetValue (list) --
When the stringSetValue type is set, the value of the resource must be a string type.
(string) --
status (string) --
The status of the container instance. The valid values are REGISTERING , REGISTRATION_FAILED , ACTIVE , INACTIVE , DEREGISTERING , or DRAINING .
If your account has opted in to the awsvpcTrunking account setting, then any newly registered container instance will transition to a REGISTERING status while the trunk elastic network interface is provisioned for the instance. If the registration fails, the instance will transition to a REGISTRATION_FAILED status. You can describe the container instance and see the reason for failure in the statusReason parameter. Once the container instance is terminated, the instance transitions to a DEREGISTERING status while the trunk elastic network interface is deprovisioned. The instance then transitions to an INACTIVE status.
The ACTIVE status indicates that the container instance can accept tasks. The DRAINING indicates that new tasks are not placed on the container instance and any service tasks running on the container instance are removed if possible. For more information, see Container Instance Draining in the Amazon Elastic Container Service Developer Guide .
statusReason (string) --
The reason that the container instance reached its current status.
agentConnected (boolean) --
This parameter returns true if the agent is connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped return false . Only instances connected to an agent can accept placement requests.
runningTasksCount (integer) --
The number of tasks on the container instance that are in the RUNNING status.
pendingTasksCount (integer) --
The number of tasks on the container instance that are in the PENDING status.
agentUpdateStatus (string) --
The status of the most recent agent update. If an update has never been requested, this value is NULL .
attributes (list) --
The attributes set for the container instance, either by the Amazon ECS container agent at instance registration or manually with the PutAttributes operation.
(dict) --
An attribute is a name-value pair associated with an Amazon ECS object. Attributes enable you to extend the Amazon ECS data model by adding custom metadata to your resources. For more information, see Attributes in the Amazon Elastic Container Service Developer Guide .
name (string) --
The name of the attribute. Up to 128 letters (uppercase and lowercase), numbers, hyphens, underscores, and periods are allowed.
value (string) --
The value of the attribute. Up to 128 letters (uppercase and lowercase), numbers, hyphens, underscores, periods, at signs (@), forward slashes, colons, and spaces are allowed.
targetType (string) --
The type of the target with which to attach the attribute. This parameter is required if you use the short form ID for a resource instead of the full ARN.
targetId (string) --
The ID of the target. You can specify the short form ID for a resource or the full Amazon Resource Name (ARN).
registeredAt (datetime) --
The Unix timestamp for when the container instance was registered.
attachments (list) --
The resources attached to a container instance, such as elastic network interfaces.
(dict) --
An object representing a container instance or task attachment.
id (string) --
The unique identifier for the attachment.
type (string) --
The type of the attachment, such as ElasticNetworkInterface .
status (string) --
The status of the attachment. Valid values are PRECREATED , CREATED , ATTACHING , ATTACHED , DETACHING , DETACHED , and DELETED .
details (list) --
Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
tags (list) --
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, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
(dict) --
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
key (string) --
One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
value (string) --
The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).
failures (list) --
Any failures associated with the call.
(dict) --
A failed resource.
arn (string) --
The Amazon Resource Name (ARN) of the failed resource.
reason (string) --
The reason for the failure.
{'name': ['awsvpcTrunking']}Response
{'settings': {'name': ['awsvpcTrunking']}}
Lists the account settings for a specified principal.
See also: AWS API Documentation
Request Syntax
client.list_account_settings( name='serviceLongArnFormat'|'taskLongArnFormat'|'containerInstanceLongArnFormat'|'awsvpcTrunking', value='string', principalArn='string', effectiveSettings=True|False, nextToken='string', maxResults=123 )
string
The resource name you want to list the account settings for.
string
The value of the account settings with which to filter results. You must also specify an account setting name to use this parameter.
string
The ARN of the principal, which can be an IAM user, IAM role, or the root user. If this field is omitted, the account settings are listed only for the authenticated user.
boolean
Specifies whether to return the effective settings. If true , the account settings for the root user or the default setting for the principalArn are returned. If false , the account settings for the principalArn are returned if they are set. Otherwise, no account settings are returned.
string
The nextToken value returned from a previous paginated ListAccountSettings request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.
Note
This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.
integer
The maximum number of account setting results returned by ListAccountSettings in paginated output. When this parameter is used, ListAccountSettings only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListAccountSettings request with the returned nextToken value. This value can be between 1 and 10. If this parameter is not used, then ListAccountSettings returns up to 10 results and a nextToken value if applicable.
dict
Response Syntax
{ 'settings': [ { 'name': 'serviceLongArnFormat'|'taskLongArnFormat'|'containerInstanceLongArnFormat'|'awsvpcTrunking', 'value': 'string', 'principalArn': 'string' }, ], 'nextToken': 'string' }
Response Structure
(dict) --
settings (list) --
The account settings for the resource.
(dict) --
The current account setting for a resource.
name (string) --
The account resource name.
value (string) --
The current account setting for the resource name. If enabled , the resource receives the new Amazon Resource Name (ARN) and resource identifier (ID) format. If disabled , the resource receives the old Amazon Resource Name (ARN) and resource identifier (ID) format.
principalArn (string) --
The ARN of the principal, which can be an IAM user, IAM role, or the root user. If this field is omitted, the authenticated user is assumed.
nextToken (string) --
The nextToken value to include in a future ListAccountSettings request. When the results of a ListAccountSettings request exceed maxResults , this value can be used to retrieve the next page of results. This value is null when there are no more results to return.
{'status': ['REGISTERING', 'DEREGISTERING', 'REGISTRATION_FAILED']}
Returns a list of container instances in a specified cluster. You can filter the results of a ListContainerInstances operation with cluster query language statements inside the filter parameter. For more information, see Cluster Query Language in the Amazon Elastic Container Service Developer Guide .
See also: AWS API Documentation
Request Syntax
client.list_container_instances( cluster='string', filter='string', nextToken='string', maxResults=123, status='ACTIVE'|'DRAINING'|'REGISTERING'|'DEREGISTERING'|'REGISTRATION_FAILED' )
string
The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instances to list. If you do not specify a cluster, the default cluster is assumed.
string
You can filter the results of a ListContainerInstances operation with cluster query language statements. For more information, see Cluster Query Language in the Amazon Elastic Container Service Developer Guide .
string
The nextToken value returned from a previous paginated ListContainerInstances request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.
Note
This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.
integer
The maximum number of container instance results returned by ListContainerInstances in paginated output. When this parameter is used, ListContainerInstances only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListContainerInstances request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then ListContainerInstances returns up to 100 results and a nextToken value if applicable.
string
Filters the container instances by status. For example, if you specify the DRAINING status, the results include only container instances that have been set to DRAINING using UpdateContainerInstancesState . If you do not specify this parameter, the default is to include container instances set to all states other than INACTIVE .
dict
Response Syntax
{ 'containerInstanceArns': [ 'string', ], 'nextToken': 'string' }
Response Structure
(dict) --
containerInstanceArns (list) --
The list of container instances with full ARN entries for each container instance associated with the specified cluster.
(string) --
nextToken (string) --
The nextToken value to include in a future ListContainerInstances request. When the results of a ListContainerInstances request exceed maxResults , this value can be used to retrieve the next page of results. This value is null when there are no more results to return.
{'name': ['awsvpcTrunking']}Response
{'setting': {'name': ['awsvpcTrunking']}}
Modifies an account setting. For more information, see Account Settings in the Amazon Elastic Container Service Developer Guide .
When serviceLongArnFormat , taskLongArnFormat , or containerInstanceLongArnFormat are specified, the ARN and resource ID format of the resource type for a specified IAM user, IAM role, or the root user for an account is changed. If you change the account setting for the root user, the default settings for all of the IAM users and roles for which no individual account setting has been specified are reset. The opt-in and opt-out account setting can be specified for each Amazon ECS resource separately. The ARN and resource ID format of a resource will be defined by the opt-in status of the IAM user or role that created the resource. You must enable this setting to use Amazon ECS features such as resource tagging.
When awsvpcTrunking is specified, the elastic network interface (ENI) limit for any new container instances that support the feature is changed. If awsvpcTrunking is enabled, any new container instances that support the feature are launched have the increased ENI limits available to them. For more information, see Elastic Network Interface Trunking in the Amazon Elastic Container Service Developer Guide .
See also: AWS API Documentation
Request Syntax
client.put_account_setting( name='serviceLongArnFormat'|'taskLongArnFormat'|'containerInstanceLongArnFormat'|'awsvpcTrunking', value='string', principalArn='string' )
string
[REQUIRED]
The resource name for which to modify the account setting. If serviceLongArnFormat is specified, the ARN for your Amazon ECS services is affected. If taskLongArnFormat is specified, the ARN and resource ID for your Amazon ECS tasks is affected. If containerInstanceLongArnFormat is specified, the ARN and resource ID for your Amazon ECS container instances is affected. If awsvpcTrunking is specified, the ENI limit for your Amazon ECS container instances is affected.
string
[REQUIRED]
The account setting value for the specified principal ARN. Accepted values are enabled and disabled .
string
The ARN of the principal, which can be an IAM user, IAM role, or the root user. If you specify the root user, it modifies the account setting for all IAM users, IAM roles, and the root user of the account unless an IAM user or role explicitly overrides these settings. If this field is omitted, the setting is changed only for the authenticated user.
dict
Response Syntax
{ 'setting': { 'name': 'serviceLongArnFormat'|'taskLongArnFormat'|'containerInstanceLongArnFormat'|'awsvpcTrunking', 'value': 'string', 'principalArn': 'string' } }
Response Structure
(dict) --
setting (dict) --
The current account setting for a resource.
name (string) --
The account resource name.
value (string) --
The current account setting for the resource name. If enabled , the resource receives the new Amazon Resource Name (ARN) and resource identifier (ID) format. If disabled , the resource receives the old Amazon Resource Name (ARN) and resource identifier (ID) format.
principalArn (string) --
The ARN of the principal, which can be an IAM user, IAM role, or the root user. If this field is omitted, the authenticated user is assumed.
{'name': ['awsvpcTrunking']}Response
{'setting': {'name': ['awsvpcTrunking']}}
Modifies an account setting for all IAM users on an account for whom no individual account setting has been specified.
See also: AWS API Documentation
Request Syntax
client.put_account_setting_default( name='serviceLongArnFormat'|'taskLongArnFormat'|'containerInstanceLongArnFormat'|'awsvpcTrunking', value='string' )
string
[REQUIRED]
The resource name for which to modify the account setting. If serviceLongArnFormat is specified, the ARN for your Amazon ECS services is affected. If taskLongArnFormat is specified, the ARN and resource ID for your Amazon ECS tasks is affected. If containerInstanceLongArnFormat is specified, the ARN and resource ID for your Amazon ECS container instances is affected. If awsvpcTrunking is specified, the ENI limit for your Amazon ECS container instances is affected.
string
[REQUIRED]
The account setting value for the specified principal ARN. Accepted values are enabled and disabled .
dict
Response Syntax
{ 'setting': { 'name': 'serviceLongArnFormat'|'taskLongArnFormat'|'containerInstanceLongArnFormat'|'awsvpcTrunking', 'value': 'string', 'principalArn': 'string' } }
Response Structure
(dict) --
setting (dict) --
The current account setting for a resource.
name (string) --
The account resource name.
value (string) --
The current account setting for the resource name. If enabled , the resource receives the new Amazon Resource Name (ARN) and resource identifier (ID) format. If disabled , the resource receives the old Amazon Resource Name (ARN) and resource identifier (ID) format.
principalArn (string) --
The ARN of the principal, which can be an IAM user, IAM role, or the root user. If this field is omitted, the authenticated user is assumed.
{'containerInstance': {'statusReason': 'string'}}
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.
See also: AWS API Documentation
Request Syntax
client.register_container_instance( cluster='string', instanceIdentityDocument='string', instanceIdentityDocumentSignature='string', totalResources=[ { 'name': 'string', 'type': 'string', 'doubleValue': 123.0, 'longValue': 123, 'integerValue': 123, 'stringSetValue': [ 'string', ] }, ], versionInfo={ 'agentVersion': 'string', 'agentHash': 'string', 'dockerVersion': 'string' }, containerInstanceArn='string', attributes=[ { 'name': 'string', 'value': 'string', 'targetType': 'container-instance', 'targetId': 'string' }, ], platformDevices=[ { 'id': 'string', 'type': 'GPU' }, ], tags=[ { 'key': 'string', 'value': 'string' }, ] )
string
The short name or full Amazon Resource Name (ARN) of the cluster with which to register your container instance. If you do not specify a cluster, the default cluster is assumed.
string
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/
string
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/
list
The resources available on the instance.
(dict) --
Describes the resources available for a container instance.
name (string) --
The name of the resource, such as CPU , MEMORY , PORTS , PORTS_UDP , or a user-defined resource.
type (string) --
The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .
doubleValue (float) --
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
longValue (integer) --
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
integerValue (integer) --
When the integerValue type is set, the value of the resource must be an integer.
stringSetValue (list) --
When the stringSetValue type is set, the value of the resource must be a string type.
(string) --
dict
The version information for the Amazon ECS container agent and Docker daemon running on the container instance.
agentVersion (string) --
The version number of the Amazon ECS container agent.
agentHash (string) --
The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.
dockerVersion (string) --
The Docker version running on the container instance.
string
The ARN of the container instance (if it was previously registered).
list
The container instance attributes that this container instance supports.
(dict) --
An attribute is a name-value pair associated with an Amazon ECS object. Attributes enable you to extend the Amazon ECS data model by adding custom metadata to your resources. For more information, see Attributes in the Amazon Elastic Container Service Developer Guide .
name (string) -- [REQUIRED]
The name of the attribute. Up to 128 letters (uppercase and lowercase), numbers, hyphens, underscores, and periods are allowed.
value (string) --
The value of the attribute. Up to 128 letters (uppercase and lowercase), numbers, hyphens, underscores, periods, at signs (@), forward slashes, colons, and spaces are allowed.
targetType (string) --
The type of the target with which to attach the attribute. This parameter is required if you use the short form ID for a resource instead of the full ARN.
targetId (string) --
The ID of the target. You can specify the short form ID for a resource or the full Amazon Resource Name (ARN).
list
The devices that are available on the container instance. The only supported device type is a GPU.
(dict) --
The devices that are available on the container instance. The only supported device type is a GPU.
id (string) -- [REQUIRED]
The ID for the GPU(s) on the container instance. The available GPU IDs can also be obtained on the container instance in the /var/lib/ecs/gpu/nvidia_gpu_info.json file.
type (string) -- [REQUIRED]
The type of device that is available on the container instance. The only supported value is GPU .
list
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, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
(dict) --
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
key (string) --
One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
value (string) --
The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).
dict
Response Syntax
{ 'containerInstance': { 'containerInstanceArn': 'string', 'ec2InstanceId': 'string', 'version': 123, 'versionInfo': { 'agentVersion': 'string', 'agentHash': 'string', 'dockerVersion': 'string' }, 'remainingResources': [ { 'name': 'string', 'type': 'string', 'doubleValue': 123.0, 'longValue': 123, 'integerValue': 123, 'stringSetValue': [ 'string', ] }, ], 'registeredResources': [ { 'name': 'string', 'type': 'string', 'doubleValue': 123.0, 'longValue': 123, 'integerValue': 123, 'stringSetValue': [ 'string', ] }, ], 'status': 'string', 'statusReason': 'string', 'agentConnected': True|False, 'runningTasksCount': 123, 'pendingTasksCount': 123, 'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED', 'attributes': [ { 'name': 'string', 'value': 'string', 'targetType': 'container-instance', 'targetId': 'string' }, ], 'registeredAt': datetime(2015, 1, 1), 'attachments': [ { 'id': 'string', 'type': 'string', 'status': 'string', 'details': [ { 'name': 'string', 'value': 'string' }, ] }, ], 'tags': [ { 'key': 'string', 'value': 'string' }, ] } }
Response Structure
(dict) --
containerInstance (dict) --
The container instance that was registered.
containerInstanceArn (string) --
The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the Region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance ID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_ID .
ec2InstanceId (string) --
The EC2 instance ID of the container instance.
version (integer) --
The version counter for the container instance. Every time a container instance experiences a change that triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS container instance state with CloudWatch Events, you can compare the version of a container instance reported by the Amazon ECS APIs with the version reported in CloudWatch Events for the container instance (inside the detail object) to verify that the version in your event stream is current.
versionInfo (dict) --
The version information for the Amazon ECS container agent and Docker daemon running on the container instance.
agentVersion (string) --
The version number of the Amazon ECS container agent.
agentHash (string) --
The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.
dockerVersion (string) --
The Docker version running on the container instance.
remainingResources (list) --
For CPU and memory resource types, this parameter describes the remaining CPU and memory that has not already been allocated to tasks and is therefore available for new tasks. For port resource types, this parameter describes the ports that were reserved by the Amazon ECS container agent (at instance registration time) and any task containers that have reserved port mappings on the host (with the host or bridge network mode). Any port that is not specified here is available for new tasks.
(dict) --
Describes the resources available for a container instance.
name (string) --
The name of the resource, such as CPU , MEMORY , PORTS , PORTS_UDP , or a user-defined resource.
type (string) --
The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .
doubleValue (float) --
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
longValue (integer) --
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
integerValue (integer) --
When the integerValue type is set, the value of the resource must be an integer.
stringSetValue (list) --
When the stringSetValue type is set, the value of the resource must be a string type.
(string) --
registeredResources (list) --
For CPU and memory resource types, this parameter describes the amount of each resource that was available on the container instance when the container agent registered it with Amazon ECS. This value represents the total amount of CPU and memory that can be allocated on this container instance to tasks. For port resource types, this parameter describes the ports that were reserved by the Amazon ECS container agent when it registered the container instance with Amazon ECS.
(dict) --
Describes the resources available for a container instance.
name (string) --
The name of the resource, such as CPU , MEMORY , PORTS , PORTS_UDP , or a user-defined resource.
type (string) --
The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .
doubleValue (float) --
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
longValue (integer) --
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
integerValue (integer) --
When the integerValue type is set, the value of the resource must be an integer.
stringSetValue (list) --
When the stringSetValue type is set, the value of the resource must be a string type.
(string) --
status (string) --
The status of the container instance. The valid values are REGISTERING , REGISTRATION_FAILED , ACTIVE , INACTIVE , DEREGISTERING , or DRAINING .
If your account has opted in to the awsvpcTrunking account setting, then any newly registered container instance will transition to a REGISTERING status while the trunk elastic network interface is provisioned for the instance. If the registration fails, the instance will transition to a REGISTRATION_FAILED status. You can describe the container instance and see the reason for failure in the statusReason parameter. Once the container instance is terminated, the instance transitions to a DEREGISTERING status while the trunk elastic network interface is deprovisioned. The instance then transitions to an INACTIVE status.
The ACTIVE status indicates that the container instance can accept tasks. The DRAINING indicates that new tasks are not placed on the container instance and any service tasks running on the container instance are removed if possible. For more information, see Container Instance Draining in the Amazon Elastic Container Service Developer Guide .
statusReason (string) --
The reason that the container instance reached its current status.
agentConnected (boolean) --
This parameter returns true if the agent is connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped return false . Only instances connected to an agent can accept placement requests.
runningTasksCount (integer) --
The number of tasks on the container instance that are in the RUNNING status.
pendingTasksCount (integer) --
The number of tasks on the container instance that are in the PENDING status.
agentUpdateStatus (string) --
The status of the most recent agent update. If an update has never been requested, this value is NULL .
attributes (list) --
The attributes set for the container instance, either by the Amazon ECS container agent at instance registration or manually with the PutAttributes operation.
(dict) --
An attribute is a name-value pair associated with an Amazon ECS object. Attributes enable you to extend the Amazon ECS data model by adding custom metadata to your resources. For more information, see Attributes in the Amazon Elastic Container Service Developer Guide .
name (string) --
The name of the attribute. Up to 128 letters (uppercase and lowercase), numbers, hyphens, underscores, and periods are allowed.
value (string) --
The value of the attribute. Up to 128 letters (uppercase and lowercase), numbers, hyphens, underscores, periods, at signs (@), forward slashes, colons, and spaces are allowed.
targetType (string) --
The type of the target with which to attach the attribute. This parameter is required if you use the short form ID for a resource instead of the full ARN.
targetId (string) --
The ID of the target. You can specify the short form ID for a resource or the full Amazon Resource Name (ARN).
registeredAt (datetime) --
The Unix timestamp for when the container instance was registered.
attachments (list) --
The resources attached to a container instance, such as elastic network interfaces.
(dict) --
An object representing a container instance or task attachment.
id (string) --
The unique identifier for the attachment.
type (string) --
The type of the attachment, such as ElasticNetworkInterface .
status (string) --
The status of the attachment. Valid values are PRECREATED , CREATED , ATTACHING , ATTACHED , DETACHING , DETACHED , and DELETED .
details (list) --
Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
tags (list) --
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, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
(dict) --
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
key (string) --
One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
value (string) --
The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).
{'containerInstance': {'statusReason': 'string'}}
Updates the Amazon ECS container agent on a specified container instance. Updating the Amazon ECS container agent does not interrupt running tasks or services on the container instance. The process for updating the agent differs depending on whether your container instance was launched with the Amazon ECS-optimized AMI or another operating system.
UpdateContainerAgent requires the Amazon ECS-optimized AMI or Amazon Linux with the ecs-init service installed and running. For help updating the Amazon ECS container agent on other operating systems, see Manually Updating the Amazon ECS Container Agent in the Amazon Elastic Container Service Developer Guide .
See also: AWS API Documentation
Request Syntax
client.update_container_agent( cluster='string', containerInstance='string' )
string
The short name or full Amazon Resource Name (ARN) of the cluster that your container instance is running on. If you do not specify a cluster, the default cluster is assumed.
string
[REQUIRED]
The container instance ID or full ARN entries for the container instance on which you would like to update the Amazon ECS container agent.
dict
Response Syntax
{ 'containerInstance': { 'containerInstanceArn': 'string', 'ec2InstanceId': 'string', 'version': 123, 'versionInfo': { 'agentVersion': 'string', 'agentHash': 'string', 'dockerVersion': 'string' }, 'remainingResources': [ { 'name': 'string', 'type': 'string', 'doubleValue': 123.0, 'longValue': 123, 'integerValue': 123, 'stringSetValue': [ 'string', ] }, ], 'registeredResources': [ { 'name': 'string', 'type': 'string', 'doubleValue': 123.0, 'longValue': 123, 'integerValue': 123, 'stringSetValue': [ 'string', ] }, ], 'status': 'string', 'statusReason': 'string', 'agentConnected': True|False, 'runningTasksCount': 123, 'pendingTasksCount': 123, 'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED', 'attributes': [ { 'name': 'string', 'value': 'string', 'targetType': 'container-instance', 'targetId': 'string' }, ], 'registeredAt': datetime(2015, 1, 1), 'attachments': [ { 'id': 'string', 'type': 'string', 'status': 'string', 'details': [ { 'name': 'string', 'value': 'string' }, ] }, ], 'tags': [ { 'key': 'string', 'value': 'string' }, ] } }
Response Structure
(dict) --
containerInstance (dict) --
The container instance for which the container agent was updated.
containerInstanceArn (string) --
The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the Region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance ID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_ID .
ec2InstanceId (string) --
The EC2 instance ID of the container instance.
version (integer) --
The version counter for the container instance. Every time a container instance experiences a change that triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS container instance state with CloudWatch Events, you can compare the version of a container instance reported by the Amazon ECS APIs with the version reported in CloudWatch Events for the container instance (inside the detail object) to verify that the version in your event stream is current.
versionInfo (dict) --
The version information for the Amazon ECS container agent and Docker daemon running on the container instance.
agentVersion (string) --
The version number of the Amazon ECS container agent.
agentHash (string) --
The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.
dockerVersion (string) --
The Docker version running on the container instance.
remainingResources (list) --
For CPU and memory resource types, this parameter describes the remaining CPU and memory that has not already been allocated to tasks and is therefore available for new tasks. For port resource types, this parameter describes the ports that were reserved by the Amazon ECS container agent (at instance registration time) and any task containers that have reserved port mappings on the host (with the host or bridge network mode). Any port that is not specified here is available for new tasks.
(dict) --
Describes the resources available for a container instance.
name (string) --
The name of the resource, such as CPU , MEMORY , PORTS , PORTS_UDP , or a user-defined resource.
type (string) --
The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .
doubleValue (float) --
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
longValue (integer) --
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
integerValue (integer) --
When the integerValue type is set, the value of the resource must be an integer.
stringSetValue (list) --
When the stringSetValue type is set, the value of the resource must be a string type.
(string) --
registeredResources (list) --
For CPU and memory resource types, this parameter describes the amount of each resource that was available on the container instance when the container agent registered it with Amazon ECS. This value represents the total amount of CPU and memory that can be allocated on this container instance to tasks. For port resource types, this parameter describes the ports that were reserved by the Amazon ECS container agent when it registered the container instance with Amazon ECS.
(dict) --
Describes the resources available for a container instance.
name (string) --
The name of the resource, such as CPU , MEMORY , PORTS , PORTS_UDP , or a user-defined resource.
type (string) --
The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .
doubleValue (float) --
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
longValue (integer) --
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
integerValue (integer) --
When the integerValue type is set, the value of the resource must be an integer.
stringSetValue (list) --
When the stringSetValue type is set, the value of the resource must be a string type.
(string) --
status (string) --
The status of the container instance. The valid values are REGISTERING , REGISTRATION_FAILED , ACTIVE , INACTIVE , DEREGISTERING , or DRAINING .
If your account has opted in to the awsvpcTrunking account setting, then any newly registered container instance will transition to a REGISTERING status while the trunk elastic network interface is provisioned for the instance. If the registration fails, the instance will transition to a REGISTRATION_FAILED status. You can describe the container instance and see the reason for failure in the statusReason parameter. Once the container instance is terminated, the instance transitions to a DEREGISTERING status while the trunk elastic network interface is deprovisioned. The instance then transitions to an INACTIVE status.
The ACTIVE status indicates that the container instance can accept tasks. The DRAINING indicates that new tasks are not placed on the container instance and any service tasks running on the container instance are removed if possible. For more information, see Container Instance Draining in the Amazon Elastic Container Service Developer Guide .
statusReason (string) --
The reason that the container instance reached its current status.
agentConnected (boolean) --
This parameter returns true if the agent is connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped return false . Only instances connected to an agent can accept placement requests.
runningTasksCount (integer) --
The number of tasks on the container instance that are in the RUNNING status.
pendingTasksCount (integer) --
The number of tasks on the container instance that are in the PENDING status.
agentUpdateStatus (string) --
The status of the most recent agent update. If an update has never been requested, this value is NULL .
attributes (list) --
The attributes set for the container instance, either by the Amazon ECS container agent at instance registration or manually with the PutAttributes operation.
(dict) --
An attribute is a name-value pair associated with an Amazon ECS object. Attributes enable you to extend the Amazon ECS data model by adding custom metadata to your resources. For more information, see Attributes in the Amazon Elastic Container Service Developer Guide .
name (string) --
The name of the attribute. Up to 128 letters (uppercase and lowercase), numbers, hyphens, underscores, and periods are allowed.
value (string) --
The value of the attribute. Up to 128 letters (uppercase and lowercase), numbers, hyphens, underscores, periods, at signs (@), forward slashes, colons, and spaces are allowed.
targetType (string) --
The type of the target with which to attach the attribute. This parameter is required if you use the short form ID for a resource instead of the full ARN.
targetId (string) --
The ID of the target. You can specify the short form ID for a resource or the full Amazon Resource Name (ARN).
registeredAt (datetime) --
The Unix timestamp for when the container instance was registered.
attachments (list) --
The resources attached to a container instance, such as elastic network interfaces.
(dict) --
An object representing a container instance or task attachment.
id (string) --
The unique identifier for the attachment.
type (string) --
The type of the attachment, such as ElasticNetworkInterface .
status (string) --
The status of the attachment. Valid values are PRECREATED , CREATED , ATTACHING , ATTACHED , DETACHING , DETACHED , and DELETED .
details (list) --
Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
tags (list) --
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, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
(dict) --
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
key (string) --
One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
value (string) --
The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).
{'status': ['REGISTERING', 'DEREGISTERING', 'REGISTRATION_FAILED']}Response
{'containerInstances': {'statusReason': 'string'}}
Modifies the status of an Amazon ECS container instance.
Once a container instance has reached an ACTIVE state, you can change the status of a container instance to DRAINING to manually remove an instance from a cluster, for example to perform system updates, update the Docker daemon, or scale down the cluster size.
Warning
A container instance cannot be changed to DRAINING until it has reached an ACTIVE status. If the instance is in any other status, an error will be received.
When you set a container instance to DRAINING , Amazon ECS prevents new tasks from being scheduled for placement on the container instance and replacement service tasks are started on other container instances in the cluster if the resources are available. Service tasks on the container instance that are in the PENDING state are stopped immediately.
Service tasks on the container instance that are in the RUNNING state are stopped and replaced according to the service's deployment configuration parameters, minimumHealthyPercent and maximumPercent . You can change the deployment configuration of your service using UpdateService .
If minimumHealthyPercent is below 100%, the scheduler can ignore desiredCount temporarily during task replacement. For example, desiredCount is four tasks, a minimum of 50% allows the scheduler to stop two existing tasks before starting two new tasks. If the minimum is 100%, the service scheduler can't remove existing tasks until the replacement tasks are considered healthy. Tasks for services that do not use a load balancer are considered healthy if they are in the RUNNING state. Tasks for services that use a load balancer are considered healthy if they are in the RUNNING state and the container instance they are hosted on is reported as healthy by the load balancer.
The maximumPercent parameter represents an upper limit on the number of running tasks during task replacement, which enables you to define the replacement batch size. For example, if desiredCount is four tasks, a maximum of 200% starts four new tasks before stopping the four tasks to be drained, provided that the cluster resources required to do this are available. If the maximum is 100%, then replacement tasks can't start until the draining tasks have stopped.
Any PENDING or RUNNING tasks that do not belong to a service are not affected. You must wait for them to finish or stop them manually.
A container instance has completed draining when it has no more RUNNING tasks. You can verify this using ListTasks .
When a container instance has been drained, you can set a container instance to ACTIVE status and once it has reached that status the Amazon ECS scheduler can begin scheduling tasks on the instance again.
See also: AWS API Documentation
Request Syntax
client.update_container_instances_state( cluster='string', containerInstances=[ 'string', ], status='ACTIVE'|'DRAINING'|'REGISTERING'|'DEREGISTERING'|'REGISTRATION_FAILED' )
string
The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instance to update. If you do not specify a cluster, the default cluster is assumed.
list
[REQUIRED]
A list of container instance IDs or full ARN entries.
(string) --
string
[REQUIRED]
The container instance state with which to update the container instance. The only valid values for this action are ACTIVE and DRAINING . A container instance can only be updated to DRAINING status once it has reached an ACTIVE state. If a container instance is in REGISTERING , DEREGISTERING , or REGISTRATION_FAILED state you can describe the container instance but will be unable to update the container instance state.
dict
Response Syntax
{ 'containerInstances': [ { 'containerInstanceArn': 'string', 'ec2InstanceId': 'string', 'version': 123, 'versionInfo': { 'agentVersion': 'string', 'agentHash': 'string', 'dockerVersion': 'string' }, 'remainingResources': [ { 'name': 'string', 'type': 'string', 'doubleValue': 123.0, 'longValue': 123, 'integerValue': 123, 'stringSetValue': [ 'string', ] }, ], 'registeredResources': [ { 'name': 'string', 'type': 'string', 'doubleValue': 123.0, 'longValue': 123, 'integerValue': 123, 'stringSetValue': [ 'string', ] }, ], 'status': 'string', 'statusReason': 'string', 'agentConnected': True|False, 'runningTasksCount': 123, 'pendingTasksCount': 123, 'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED', 'attributes': [ { 'name': 'string', 'value': 'string', 'targetType': 'container-instance', 'targetId': 'string' }, ], 'registeredAt': datetime(2015, 1, 1), 'attachments': [ { 'id': 'string', 'type': 'string', 'status': 'string', 'details': [ { 'name': 'string', 'value': 'string' }, ] }, ], 'tags': [ { 'key': 'string', 'value': 'string' }, ] }, ], 'failures': [ { 'arn': 'string', 'reason': 'string' }, ] }
Response Structure
(dict) --
containerInstances (list) --
The list of container instances.
(dict) --
An EC2 instance that is running the Amazon ECS agent and has been registered with a cluster.
containerInstanceArn (string) --
The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the Region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance ID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_ID .
ec2InstanceId (string) --
The EC2 instance ID of the container instance.
version (integer) --
The version counter for the container instance. Every time a container instance experiences a change that triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS container instance state with CloudWatch Events, you can compare the version of a container instance reported by the Amazon ECS APIs with the version reported in CloudWatch Events for the container instance (inside the detail object) to verify that the version in your event stream is current.
versionInfo (dict) --
The version information for the Amazon ECS container agent and Docker daemon running on the container instance.
agentVersion (string) --
The version number of the Amazon ECS container agent.
agentHash (string) --
The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.
dockerVersion (string) --
The Docker version running on the container instance.
remainingResources (list) --
For CPU and memory resource types, this parameter describes the remaining CPU and memory that has not already been allocated to tasks and is therefore available for new tasks. For port resource types, this parameter describes the ports that were reserved by the Amazon ECS container agent (at instance registration time) and any task containers that have reserved port mappings on the host (with the host or bridge network mode). Any port that is not specified here is available for new tasks.
(dict) --
Describes the resources available for a container instance.
name (string) --
The name of the resource, such as CPU , MEMORY , PORTS , PORTS_UDP , or a user-defined resource.
type (string) --
The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .
doubleValue (float) --
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
longValue (integer) --
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
integerValue (integer) --
When the integerValue type is set, the value of the resource must be an integer.
stringSetValue (list) --
When the stringSetValue type is set, the value of the resource must be a string type.
(string) --
registeredResources (list) --
For CPU and memory resource types, this parameter describes the amount of each resource that was available on the container instance when the container agent registered it with Amazon ECS. This value represents the total amount of CPU and memory that can be allocated on this container instance to tasks. For port resource types, this parameter describes the ports that were reserved by the Amazon ECS container agent when it registered the container instance with Amazon ECS.
(dict) --
Describes the resources available for a container instance.
name (string) --
The name of the resource, such as CPU , MEMORY , PORTS , PORTS_UDP , or a user-defined resource.
type (string) --
The type of the resource, such as INTEGER , DOUBLE , LONG , or STRINGSET .
doubleValue (float) --
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
longValue (integer) --
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
integerValue (integer) --
When the integerValue type is set, the value of the resource must be an integer.
stringSetValue (list) --
When the stringSetValue type is set, the value of the resource must be a string type.
(string) --
status (string) --
The status of the container instance. The valid values are REGISTERING , REGISTRATION_FAILED , ACTIVE , INACTIVE , DEREGISTERING , or DRAINING .
If your account has opted in to the awsvpcTrunking account setting, then any newly registered container instance will transition to a REGISTERING status while the trunk elastic network interface is provisioned for the instance. If the registration fails, the instance will transition to a REGISTRATION_FAILED status. You can describe the container instance and see the reason for failure in the statusReason parameter. Once the container instance is terminated, the instance transitions to a DEREGISTERING status while the trunk elastic network interface is deprovisioned. The instance then transitions to an INACTIVE status.
The ACTIVE status indicates that the container instance can accept tasks. The DRAINING indicates that new tasks are not placed on the container instance and any service tasks running on the container instance are removed if possible. For more information, see Container Instance Draining in the Amazon Elastic Container Service Developer Guide .
statusReason (string) --
The reason that the container instance reached its current status.
agentConnected (boolean) --
This parameter returns true if the agent is connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped return false . Only instances connected to an agent can accept placement requests.
runningTasksCount (integer) --
The number of tasks on the container instance that are in the RUNNING status.
pendingTasksCount (integer) --
The number of tasks on the container instance that are in the PENDING status.
agentUpdateStatus (string) --
The status of the most recent agent update. If an update has never been requested, this value is NULL .
attributes (list) --
The attributes set for the container instance, either by the Amazon ECS container agent at instance registration or manually with the PutAttributes operation.
(dict) --
An attribute is a name-value pair associated with an Amazon ECS object. Attributes enable you to extend the Amazon ECS data model by adding custom metadata to your resources. For more information, see Attributes in the Amazon Elastic Container Service Developer Guide .
name (string) --
The name of the attribute. Up to 128 letters (uppercase and lowercase), numbers, hyphens, underscores, and periods are allowed.
value (string) --
The value of the attribute. Up to 128 letters (uppercase and lowercase), numbers, hyphens, underscores, periods, at signs (@), forward slashes, colons, and spaces are allowed.
targetType (string) --
The type of the target with which to attach the attribute. This parameter is required if you use the short form ID for a resource instead of the full ARN.
targetId (string) --
The ID of the target. You can specify the short form ID for a resource or the full Amazon Resource Name (ARN).
registeredAt (datetime) --
The Unix timestamp for when the container instance was registered.
attachments (list) --
The resources attached to a container instance, such as elastic network interfaces.
(dict) --
An object representing a container instance or task attachment.
id (string) --
The unique identifier for the attachment.
type (string) --
The type of the attachment, such as ElasticNetworkInterface .
status (string) --
The status of the attachment. Valid values are PRECREATED , CREATED , ATTACHING , ATTACHED , DETACHING , DETACHED , and DELETED .
details (list) --
Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
tags (list) --
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, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
(dict) --
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
key (string) --
One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
value (string) --
The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).
failures (list) --
Any failures associated with the call.
(dict) --
A failed resource.
arn (string) --
The Amazon Resource Name (ARN) of the failed resource.
reason (string) --
The reason for the failure.