Table of Contents
ECS.
Client
¶A low-level client representing Amazon EC2 Container Service (ECS):
import boto3
client = boto3.client('ecs')
These are the available methods:
can_paginate()
create_cluster()
create_service()
delete_cluster()
delete_service()
deregister_container_instance()
deregister_task_definition()
describe_clusters()
describe_container_instances()
describe_services()
describe_task_definition()
describe_tasks()
discover_poll_endpoint()
generate_presigned_url()
get_paginator()
get_waiter()
list_clusters()
list_container_instances()
list_services()
list_task_definition_families()
list_task_definitions()
list_tasks()
register_container_instance()
register_task_definition()
run_task()
start_task()
stop_task()
submit_container_state_change()
submit_task_state_change()
update_container_agent()
update_service()
can_paginate
(operation_name)¶Check if an operation can be paginated.
Parameters: | operation_name (string) -- The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo , and you'd normally invoke the
operation as client.create_foo(**kwargs) , if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo") . |
---|---|
Returns: | True if the operation can be paginated,
False otherwise. |
create_cluster
(**kwargs)¶Creates a new Amazon ECS cluster. By default, your account will receive a default
cluster when you launch your first container instance. However, you can create your own cluster with a unique name with the CreateCluster
action.
Request Syntax
response = client.create_cluster(
clusterName='string'
)
Parameters: | clusterName (string) -- The name of your cluster. If you do not specify a name for your cluster, you will create a cluster named default . Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'cluster': {
'clusterArn': 'string',
'clusterName': 'string',
'status': 'string',
'registeredContainerInstancesCount': 123,
'runningTasksCount': 123,
'pendingTasksCount': 123,
'activeServicesCount': 123
}
}
Response Structure
|
create_service
(**kwargs)¶Runs and maintains a desired number of tasks from a specified task definition. If the number of tasks running in a service drops below desiredCount
, Amazon ECS will spawn another instantiation of the task in the specified cluster.
Request Syntax
response = client.create_service(
cluster='string',
serviceName='string',
taskDefinition='string',
loadBalancers=[
{
'loadBalancerName': 'string',
'containerName': 'string',
'containerPort': 123
},
],
desiredCount=123,
clientToken='string',
role='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'service': {
'serviceArn': 'string',
'serviceName': 'string',
'clusterArn': 'string',
'loadBalancers': [
{
'loadBalancerName': 'string',
'containerName': 'string',
'containerPort': 123
},
],
'status': 'string',
'desiredCount': 123,
'runningCount': 123,
'pendingCount': 123,
'taskDefinition': 'string',
'deployments': [
{
'id': 'string',
'status': 'string',
'taskDefinition': 'string',
'desiredCount': 123,
'pendingCount': 123,
'runningCount': 123,
'createdAt': datetime(2015, 1, 1),
'updatedAt': datetime(2015, 1, 1)
},
],
'roleArn': 'string',
'events': [
{
'id': 'string',
'createdAt': datetime(2015, 1, 1),
'message': 'string'
},
]
}
}
Response Structure
|
delete_cluster
(**kwargs)¶Deletes the specified cluster. You must deregister all container instances from this cluster before you may delete it. You can list the container instances in a cluster with ListContainerInstances and deregister them with DeregisterContainerInstance .
Request Syntax
response = client.delete_cluster(
cluster='string'
)
Parameters: | cluster (string) -- [REQUIRED] The short name or full Amazon Resource Name (ARN) of the cluster that you want to delete. |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'cluster': {
'clusterArn': 'string',
'clusterName': 'string',
'status': 'string',
'registeredContainerInstancesCount': 123,
'runningTasksCount': 123,
'pendingTasksCount': 123,
'activeServicesCount': 123
}
}
Response Structure
|
delete_service
(**kwargs)¶Deletes a specified service within a cluster.
Request Syntax
response = client.delete_service(
cluster='string',
service='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'service': {
'serviceArn': 'string',
'serviceName': 'string',
'clusterArn': 'string',
'loadBalancers': [
{
'loadBalancerName': 'string',
'containerName': 'string',
'containerPort': 123
},
],
'status': 'string',
'desiredCount': 123,
'runningCount': 123,
'pendingCount': 123,
'taskDefinition': 'string',
'deployments': [
{
'id': 'string',
'status': 'string',
'taskDefinition': 'string',
'desiredCount': 123,
'pendingCount': 123,
'runningCount': 123,
'createdAt': datetime(2015, 1, 1),
'updatedAt': datetime(2015, 1, 1)
},
],
'roleArn': 'string',
'events': [
{
'id': 'string',
'createdAt': datetime(2015, 1, 1),
'message': 'string'
},
]
}
}
Response Structure
|
deregister_container_instance
(**kwargs)¶Deregisters an Amazon ECS container instance from the specified cluster. This instance will no longer be 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 to avoid 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
When you terminate a container instance, it is automatically deregistered from your cluster.
Request Syntax
response = client.deregister_container_instance(
cluster='string',
containerInstance='string',
force=True|False
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'containerInstance': {
'containerInstanceArn': 'string',
'ec2InstanceId': 'string',
'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',
'agentConnected': True|False,
'runningTasksCount': 123,
'pendingTasksCount': 123,
'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED'
}
}
Response Structure
|
deregister_task_definition
(**kwargs)¶Deregisters the specified task definition by family and revision. Upon deregistration, the task definition is marked as INACTIVE
. Existing tasks and services that reference an INACTIVE
task definition continue to run without disruption. Existing services that reference an INACTIVE
task definition can still scale up or down by modifying the service's desired count.
You cannot use an INACTIVE
task definition to run new tasks or create new services, and you cannot update an existing service to reference an INACTIVE
task definition (although there may be up to a 10 minute window following deregistration where these restrictions have not yet taken effect).
Request Syntax
response = client.deregister_task_definition(
taskDefinition='string'
)
Parameters: | taskDefinition (string) -- [REQUIRED] The |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'taskDefinition': {
'taskDefinitionArn': 'string',
'containerDefinitions': [
{
'name': 'string',
'image': 'string',
'cpu': 123,
'memory': 123,
'links': [
'string',
],
'portMappings': [
{
'containerPort': 123,
'hostPort': 123,
'protocol': 'tcp'|'udp'
},
],
'essential': True|False,
'entryPoint': [
'string',
],
'command': [
'string',
],
'environment': [
{
'name': 'string',
'value': 'string'
},
],
'mountPoints': [
{
'sourceVolume': 'string',
'containerPath': 'string',
'readOnly': True|False
},
],
'volumesFrom': [
{
'sourceContainer': 'string',
'readOnly': True|False
},
]
},
],
'family': 'string',
'revision': 123,
'volumes': [
{
'name': 'string',
'host': {
'sourcePath': 'string'
}
},
],
'status': 'ACTIVE'|'INACTIVE'
}
}
Response Structure
|
describe_clusters
(**kwargs)¶Describes one or more of your clusters.
Request Syntax
response = client.describe_clusters(
clusters=[
'string',
]
)
Parameters: | clusters (list) -- A space-separated list of cluster names or full cluster Amazon Resource Name (ARN) entries. If you do not specify a cluster, the default cluster is assumed.
|
---|---|
Return type: | dict |
Returns: | Response Syntax{
'clusters': [
{
'clusterArn': 'string',
'clusterName': 'string',
'status': 'string',
'registeredContainerInstancesCount': 123,
'runningTasksCount': 123,
'pendingTasksCount': 123,
'activeServicesCount': 123
},
],
'failures': [
{
'arn': 'string',
'reason': 'string'
},
]
}
Response Structure
|
describe_container_instances
(**kwargs)¶Describes Amazon EC2 Container Service container instances. Returns metadata about registered and remaining resources on each container instance requested.
Request Syntax
response = client.describe_container_instances(
cluster='string',
containerInstances=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'containerInstances': [
{
'containerInstanceArn': 'string',
'ec2InstanceId': 'string',
'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',
'agentConnected': True|False,
'runningTasksCount': 123,
'pendingTasksCount': 123,
'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED'
},
],
'failures': [
{
'arn': 'string',
'reason': 'string'
},
]
}
Response Structure
|
describe_services
(**kwargs)¶Describes the specified services running in your cluster.
Request Syntax
response = client.describe_services(
cluster='string',
services=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'services': [
{
'serviceArn': 'string',
'serviceName': 'string',
'clusterArn': 'string',
'loadBalancers': [
{
'loadBalancerName': 'string',
'containerName': 'string',
'containerPort': 123
},
],
'status': 'string',
'desiredCount': 123,
'runningCount': 123,
'pendingCount': 123,
'taskDefinition': 'string',
'deployments': [
{
'id': 'string',
'status': 'string',
'taskDefinition': 'string',
'desiredCount': 123,
'pendingCount': 123,
'runningCount': 123,
'createdAt': datetime(2015, 1, 1),
'updatedAt': datetime(2015, 1, 1)
},
],
'roleArn': 'string',
'events': [
{
'id': 'string',
'createdAt': datetime(2015, 1, 1),
'message': 'string'
},
]
},
],
'failures': [
{
'arn': 'string',
'reason': 'string'
},
]
}
Response Structure
|
describe_task_definition
(**kwargs)¶Describes a task definition. You can specify a family
and revision
to find information on a specific task definition, or you can simply specify the family to find the latest ACTIVE
revision in that family.
Note
You can only describe INACTIVE
task definitions while an active task or service references them.
Request Syntax
response = client.describe_task_definition(
taskDefinition='string'
)
Parameters: | taskDefinition (string) -- [REQUIRED] The |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'taskDefinition': {
'taskDefinitionArn': 'string',
'containerDefinitions': [
{
'name': 'string',
'image': 'string',
'cpu': 123,
'memory': 123,
'links': [
'string',
],
'portMappings': [
{
'containerPort': 123,
'hostPort': 123,
'protocol': 'tcp'|'udp'
},
],
'essential': True|False,
'entryPoint': [
'string',
],
'command': [
'string',
],
'environment': [
{
'name': 'string',
'value': 'string'
},
],
'mountPoints': [
{
'sourceVolume': 'string',
'containerPath': 'string',
'readOnly': True|False
},
],
'volumesFrom': [
{
'sourceContainer': 'string',
'readOnly': True|False
},
]
},
],
'family': 'string',
'revision': 123,
'volumes': [
{
'name': 'string',
'host': {
'sourcePath': 'string'
}
},
],
'status': 'ACTIVE'|'INACTIVE'
}
}
Response Structure
|
describe_tasks
(**kwargs)¶Describes a specified task or tasks.
Request Syntax
response = client.describe_tasks(
cluster='string',
tasks=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'tasks': [
{
'taskArn': 'string',
'clusterArn': 'string',
'taskDefinitionArn': 'string',
'containerInstanceArn': 'string',
'overrides': {
'containerOverrides': [
{
'name': 'string',
'command': [
'string',
],
'environment': [
{
'name': 'string',
'value': 'string'
},
]
},
]
},
'lastStatus': 'string',
'desiredStatus': 'string',
'containers': [
{
'containerArn': 'string',
'taskArn': 'string',
'name': 'string',
'lastStatus': 'string',
'exitCode': 123,
'reason': 'string',
'networkBindings': [
{
'bindIP': 'string',
'containerPort': 123,
'hostPort': 123,
'protocol': 'tcp'|'udp'
},
]
},
],
'startedBy': 'string'
},
],
'failures': [
{
'arn': 'string',
'reason': 'string'
},
]
}
Response Structure
|
discover_poll_endpoint
(**kwargs)¶Note
This action is only used by the Amazon EC2 Container Service agent, and it is not intended for use outside of the agent.
Returns an endpoint for the Amazon EC2 Container Service agent to poll for updates.
Request Syntax
response = client.discover_poll_endpoint(
containerInstance='string',
cluster='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'endpoint': 'string',
'telemetryEndpoint': 'string'
}
Response Structure
|
generate_presigned_url
(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)¶Generate a presigned url given a client, its method, and arguments
Parameters: |
|
---|---|
Returns: | The presigned url |
get_paginator
(operation_name)¶Create a paginator for an operation.
Parameters: | operation_name (string) -- The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo , and you'd normally invoke the
operation as client.create_foo(**kwargs) , if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo") . |
---|---|
Raises OperationNotPageableError: | |
Raised if the operation is not
pageable. You can use the client.can_paginate method to
check if an operation is pageable. |
|
Return type: | L{botocore.paginate.Paginator} |
Returns: | A paginator object. |
get_waiter
(waiter_name)¶list_clusters
(**kwargs)¶Returns a list of existing clusters.
Request Syntax
response = client.list_clusters(
nextToken='string',
maxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'clusterArns': [
'string',
],
'nextToken': 'string'
}
Response Structure
|
list_container_instances
(**kwargs)¶Returns a list of container instances in a specified cluster.
Request Syntax
response = client.list_container_instances(
cluster='string',
nextToken='string',
maxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'containerInstanceArns': [
'string',
],
'nextToken': 'string'
}
Response Structure
|
list_services
(**kwargs)¶Lists the services that are running in a specified cluster.
Request Syntax
response = client.list_services(
cluster='string',
nextToken='string',
maxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'serviceArns': [
'string',
],
'nextToken': 'string'
}
Response Structure
|
list_task_definition_families
(**kwargs)¶Returns a list of task definition families that are registered to your account (which may include task definition families that no longer have any ACTIVE
task definitions). You can filter the results with the familyPrefix
parameter.
Request Syntax
response = client.list_task_definition_families(
familyPrefix='string',
nextToken='string',
maxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'families': [
'string',
],
'nextToken': 'string'
}
Response Structure
|
list_task_definitions
(**kwargs)¶Returns a list of task definitions that are registered to your account. You can filter the results by family name with the familyPrefix
parameter or by status with the status
parameter.
Request Syntax
response = client.list_task_definitions(
familyPrefix='string',
status='ACTIVE'|'INACTIVE',
sort='ASC'|'DESC',
nextToken='string',
maxResults=123
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'taskDefinitionArns': [
'string',
],
'nextToken': 'string'
}
Response Structure
|
list_tasks
(**kwargs)¶Returns a list of tasks for a specified cluster. You can filter the results by family name, by a particular container instance, or by the desired status of the task with the family
, containerInstance
, and desiredStatus
parameters.
Request Syntax
response = client.list_tasks(
cluster='string',
containerInstance='string',
family='string',
nextToken='string',
maxResults=123,
startedBy='string',
serviceName='string',
desiredStatus='RUNNING'|'PENDING'|'STOPPED'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'taskArns': [
'string',
],
'nextToken': 'string'
}
Response Structure
|
register_container_instance
(**kwargs)¶Note
This action is only used by the Amazon EC2 Container Service agent, and it is not intended for use outside of the agent.
Registers an Amazon EC2 instance into the specified cluster. This instance will become available to place containers on.
Request Syntax
response = 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'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'containerInstance': {
'containerInstanceArn': 'string',
'ec2InstanceId': 'string',
'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',
'agentConnected': True|False,
'runningTasksCount': 123,
'pendingTasksCount': 123,
'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED'
}
}
Response Structure
|
register_task_definition
(**kwargs)¶Registers a new task definition from the supplied family
and containerDefinitions
. Optionally, you can add data volumes to your containers with the volumes
parameter. For more information on task definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service Developer Guide .
Request Syntax
response = client.register_task_definition(
family='string',
containerDefinitions=[
{
'name': 'string',
'image': 'string',
'cpu': 123,
'memory': 123,
'links': [
'string',
],
'portMappings': [
{
'containerPort': 123,
'hostPort': 123,
'protocol': 'tcp'|'udp'
},
],
'essential': True|False,
'entryPoint': [
'string',
],
'command': [
'string',
],
'environment': [
{
'name': 'string',
'value': 'string'
},
],
'mountPoints': [
{
'sourceVolume': 'string',
'containerPath': 'string',
'readOnly': True|False
},
],
'volumesFrom': [
{
'sourceContainer': 'string',
'readOnly': True|False
},
]
},
],
volumes=[
{
'name': 'string',
'host': {
'sourcePath': 'string'
}
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'taskDefinition': {
'taskDefinitionArn': 'string',
'containerDefinitions': [
{
'name': 'string',
'image': 'string',
'cpu': 123,
'memory': 123,
'links': [
'string',
],
'portMappings': [
{
'containerPort': 123,
'hostPort': 123,
'protocol': 'tcp'|'udp'
},
],
'essential': True|False,
'entryPoint': [
'string',
],
'command': [
'string',
],
'environment': [
{
'name': 'string',
'value': 'string'
},
],
'mountPoints': [
{
'sourceVolume': 'string',
'containerPath': 'string',
'readOnly': True|False
},
],
'volumesFrom': [
{
'sourceContainer': 'string',
'readOnly': True|False
},
]
},
],
'family': 'string',
'revision': 123,
'volumes': [
{
'name': 'string',
'host': {
'sourcePath': 'string'
}
},
],
'status': 'ACTIVE'|'INACTIVE'
}
}
Response Structure
|
run_task
(**kwargs)¶Start a task using random placement and the default Amazon ECS scheduler. If you want to use your own scheduler or place a task on a specific container instance, use StartTask
instead.
Warning
The count
parameter is limited to 10 tasks per call.
Request Syntax
response = client.run_task(
cluster='string',
taskDefinition='string',
overrides={
'containerOverrides': [
{
'name': 'string',
'command': [
'string',
],
'environment': [
{
'name': 'string',
'value': 'string'
},
]
},
]
},
count=123,
startedBy='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'tasks': [
{
'taskArn': 'string',
'clusterArn': 'string',
'taskDefinitionArn': 'string',
'containerInstanceArn': 'string',
'overrides': {
'containerOverrides': [
{
'name': 'string',
'command': [
'string',
],
'environment': [
{
'name': 'string',
'value': 'string'
},
]
},
]
},
'lastStatus': 'string',
'desiredStatus': 'string',
'containers': [
{
'containerArn': 'string',
'taskArn': 'string',
'name': 'string',
'lastStatus': 'string',
'exitCode': 123,
'reason': 'string',
'networkBindings': [
{
'bindIP': 'string',
'containerPort': 123,
'hostPort': 123,
'protocol': 'tcp'|'udp'
},
]
},
],
'startedBy': 'string'
},
],
'failures': [
{
'arn': 'string',
'reason': 'string'
},
]
}
Response Structure
|
start_task
(**kwargs)¶Starts a new task from the specified task definition on the specified container instance or instances. If you want to use the default Amazon ECS scheduler to place your task, use RunTask
instead.
Warning
The list of container instances to start tasks on is limited to 10.
Request Syntax
response = client.start_task(
cluster='string',
taskDefinition='string',
overrides={
'containerOverrides': [
{
'name': 'string',
'command': [
'string',
],
'environment': [
{
'name': 'string',
'value': 'string'
},
]
},
]
},
containerInstances=[
'string',
],
startedBy='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'tasks': [
{
'taskArn': 'string',
'clusterArn': 'string',
'taskDefinitionArn': 'string',
'containerInstanceArn': 'string',
'overrides': {
'containerOverrides': [
{
'name': 'string',
'command': [
'string',
],
'environment': [
{
'name': 'string',
'value': 'string'
},
]
},
]
},
'lastStatus': 'string',
'desiredStatus': 'string',
'containers': [
{
'containerArn': 'string',
'taskArn': 'string',
'name': 'string',
'lastStatus': 'string',
'exitCode': 123,
'reason': 'string',
'networkBindings': [
{
'bindIP': 'string',
'containerPort': 123,
'hostPort': 123,
'protocol': 'tcp'|'udp'
},
]
},
],
'startedBy': 'string'
},
],
'failures': [
{
'arn': 'string',
'reason': 'string'
},
]
}
Response Structure
|
stop_task
(**kwargs)¶Stops a running task.
Request Syntax
response = client.stop_task(
cluster='string',
task='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'task': {
'taskArn': 'string',
'clusterArn': 'string',
'taskDefinitionArn': 'string',
'containerInstanceArn': 'string',
'overrides': {
'containerOverrides': [
{
'name': 'string',
'command': [
'string',
],
'environment': [
{
'name': 'string',
'value': 'string'
},
]
},
]
},
'lastStatus': 'string',
'desiredStatus': 'string',
'containers': [
{
'containerArn': 'string',
'taskArn': 'string',
'name': 'string',
'lastStatus': 'string',
'exitCode': 123,
'reason': 'string',
'networkBindings': [
{
'bindIP': 'string',
'containerPort': 123,
'hostPort': 123,
'protocol': 'tcp'|'udp'
},
]
},
],
'startedBy': 'string'
}
}
Response Structure
|
submit_container_state_change
(**kwargs)¶Note
This action is only used by the Amazon EC2 Container Service agent, and it is not intended for use outside of the agent.
Sent to acknowledge that a container changed states.
Request Syntax
response = client.submit_container_state_change(
cluster='string',
task='string',
containerName='string',
status='string',
exitCode=123,
reason='string',
networkBindings=[
{
'bindIP': 'string',
'containerPort': 123,
'hostPort': 123,
'protocol': 'tcp'|'udp'
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'acknowledgment': 'string'
}
Response Structure
|
submit_task_state_change
(**kwargs)¶Note
This action is only used by the Amazon EC2 Container Service agent, and it is not intended for use outside of the agent.
Sent to acknowledge that a task changed states.
Request Syntax
response = client.submit_task_state_change(
cluster='string',
task='string',
status='string',
reason='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'acknowledgment': 'string'
}
Response Structure
|
update_container_agent
(**kwargs)¶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 EC2 Container Service Developer Guide .
Request Syntax
response = client.update_container_agent(
cluster='string',
containerInstance='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'containerInstance': {
'containerInstanceArn': 'string',
'ec2InstanceId': 'string',
'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',
'agentConnected': True|False,
'runningTasksCount': 123,
'pendingTasksCount': 123,
'agentUpdateStatus': 'PENDING'|'STAGING'|'STAGED'|'UPDATING'|'UPDATED'|'FAILED'
}
}
Response Structure
|
update_service
(**kwargs)¶Modify the desired count or task definition used in a service.
You can add to or subtract from the number of instantiations of a task definition in a service by specifying the cluster that the service is running in and a new desiredCount
parameter.
You can use UpdateService
to modify your task definition and deploy a new version of your service, one task at a time. If you modify the task definition with UpdateService
, Amazon ECS spawns a task with the new version of the task definition and then stops an old task after the new version is running. Because UpdateService
starts a new version of the task before stopping an old version, your cluster must have capacity to support one more instantiation of the task when UpdateService
is run. If your cluster cannot support another instantiation of the task used in your service, you can reduce the desired count of your service by one before modifying the task definition.
Request Syntax
response = client.update_service(
cluster='string',
service='string',
desiredCount=123,
taskDefinition='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'service': {
'serviceArn': 'string',
'serviceName': 'string',
'clusterArn': 'string',
'loadBalancers': [
{
'loadBalancerName': 'string',
'containerName': 'string',
'containerPort': 123
},
],
'status': 'string',
'desiredCount': 123,
'runningCount': 123,
'pendingCount': 123,
'taskDefinition': 'string',
'deployments': [
{
'id': 'string',
'status': 'string',
'taskDefinition': 'string',
'desiredCount': 123,
'pendingCount': 123,
'runningCount': 123,
'createdAt': datetime(2015, 1, 1),
'updatedAt': datetime(2015, 1, 1)
},
],
'roleArn': 'string',
'events': [
{
'id': 'string',
'createdAt': datetime(2015, 1, 1),
'message': 'string'
},
]
}
}
Response Structure
|
The available paginators are:
ECS.Paginator.list_clusters
ECS.Paginator.list_container_instances
ECS.Paginator.list_services
ECS.Paginator.list_task_definition_families
ECS.Paginator.list_task_definitions
ECS.Paginator.list_tasks
ECS.Paginator.
list_clusters
¶paginator = client.get_paginator('list_clusters')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from ECS.Client.list_clusters()
.
Request Syntax
response_iterator = paginator.paginate(
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: | PaginationConfig (dict) -- A dictionary that provides parameters to control pagination.
|
---|---|
Return type: | dict |
Returns: | Response Syntax{
'clusterArns': [
'string',
],
'NextToken': 'string'
}
Response Structure
|
ECS.Paginator.
list_container_instances
¶paginator = client.get_paginator('list_container_instances')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from ECS.Client.list_container_instances()
.
Request Syntax
response_iterator = paginator.paginate(
cluster='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'containerInstanceArns': [
'string',
],
'NextToken': 'string'
}
Response Structure
|
ECS.Paginator.
list_services
¶paginator = client.get_paginator('list_services')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from ECS.Client.list_services()
.
Request Syntax
response_iterator = paginator.paginate(
cluster='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'serviceArns': [
'string',
],
'NextToken': 'string'
}
Response Structure
|
ECS.Paginator.
list_task_definition_families
¶paginator = client.get_paginator('list_task_definition_families')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from ECS.Client.list_task_definition_families()
.
Request Syntax
response_iterator = paginator.paginate(
familyPrefix='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'families': [
'string',
],
'NextToken': 'string'
}
Response Structure
|
ECS.Paginator.
list_task_definitions
¶paginator = client.get_paginator('list_task_definitions')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from ECS.Client.list_task_definitions()
.
Request Syntax
response_iterator = paginator.paginate(
familyPrefix='string',
status='ACTIVE'|'INACTIVE',
sort='ASC'|'DESC',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'taskDefinitionArns': [
'string',
],
'NextToken': 'string'
}
Response Structure
|
ECS.Paginator.
list_tasks
¶paginator = client.get_paginator('list_tasks')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from ECS.Client.list_tasks()
.
Request Syntax
response_iterator = paginator.paginate(
cluster='string',
containerInstance='string',
family='string',
startedBy='string',
serviceName='string',
desiredStatus='RUNNING'|'PENDING'|'STOPPED',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'taskArns': [
'string',
],
'NextToken': 'string'
}
Response Structure
|
The available waiters are:
ECS.Waiter.services_inactive
ECS.Waiter.services_stable
ECS.Waiter.tasks_running
ECS.Waiter.tasks_stopped
ECS.Waiter.
services_inactive
¶waiter = client.get_waiter('services_inactive')
wait
(**kwargs)¶This polls ECS.Client.describe_services()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
cluster='string',
services=[
'string',
]
)
Parameters: |
|
---|---|
Returns: | None |
ECS.Waiter.
services_stable
¶waiter = client.get_waiter('services_stable')
wait
(**kwargs)¶This polls ECS.Client.describe_services()
every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
Request Syntax
waiter.wait(
cluster='string',
services=[
'string',
]
)
Parameters: |
|
---|---|
Returns: | None |
ECS.Waiter.
tasks_running
¶waiter = client.get_waiter('tasks_running')
wait
(**kwargs)¶This polls ECS.Client.describe_tasks()
every 6 seconds until a successful state is reached. An error is returned after 100 failed checks.
Request Syntax
waiter.wait(
cluster='string',
tasks=[
'string',
]
)
Parameters: |
|
---|---|
Returns: | None |
ECS.Waiter.
tasks_stopped
¶waiter = client.get_waiter('tasks_stopped')
wait
(**kwargs)¶This polls ECS.Client.describe_tasks()
every 6 seconds until a successful state is reached. An error is returned after 100 failed checks.
Request Syntax
waiter.wait(
cluster='string',
tasks=[
'string',
]
)
Parameters: |
|
---|---|
Returns: | None |