Note

You are viewing the documentation for an older version of boto (boto2).

Boto3, the next version of Boto, is now stable and recommended for general use. It can be used side-by-side with Boto in the same project, so it is easy to start using Boto3 in your existing projects as well as new projects. Going forward, API updates and all new feature work will be focused on Boto3.

For more information, see the documentation for boto3.

EC2 Container Service

boto.ec2containerservice

boto.ec2containerservice.connect_to_region(region_name, **kw_params)
boto.ec2containerservice.regions()

Get all available regions for the Amazon EC2 Container Service.

Return type:list
Returns:A list of boto.regioninfo.RegionInfo

boto.ec2containerservice.layer1

class boto.ec2containerservice.layer1.EC2ContainerServiceConnection(**kwargs)

Amazon EC2 Container Service (Amazon ECS) is a highly scalable, fast, container management service that makes it easy to run, stop, and manage Docker containers on a cluster of Amazon EC2 instances. Amazon ECS lets you launch and stop container-enabled applications with simple API calls, allows you to get the state of your cluster from a centralized service, and gives you access to many familiar Amazon EC2 features like security groups, Amazon EBS volumes, and IAM roles.

You can use Amazon ECS to schedule the placement of containers across your cluster based on your resource needs, isolation policies, and availability requirements. Amazon EC2 Container Service eliminates the need for you to operate your own cluster management and configuration management systems or worry about scaling your management infrastructure.

APIVersion = '2014-11-13'
DefaultRegionEndpoint = 'ecs.us-east-1.amazonaws.com'
DefaultRegionName = 'us-east-1'
ResponseError

alias of JSONResponseError

create_cluster(cluster_name=None)

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.

During the preview, each account is limited to two clusters.

Parameters:cluster_name (string) – The name of your cluster. If you do not specify a name for your cluster, you will create a cluster named default.
delete_cluster(cluster)

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.

Parameters:cluster (string) – The cluster you want to delete.
deregister_container_instance(container_instance, cluster=None, force=None)

Deregisters an Amazon ECS container instance from the specified cluster. This instance will no longer be available to run tasks.

Parameters:
  • cluster (string) – The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instance you want to deregister. If you do not specify a cluster, the default cluster is assumed.
  • container_instance (string) – The container instance UUID or full Amazon Resource Name (ARN) of the container instance you want 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 UUID. For example, arn:aws:ecs: region : aws_account_id :container-instance/ container_instance_UUID .
  • force (boolean) – Force the deregistration of the container instance. You can use the force parameter if you have several tasks running on a container instance and you don’t want to run StopTask for each task before deregistering the container instance.
deregister_task_definition(task_definition)

Deregisters the specified task definition. You will no longer be able to run tasks from this definition after deregistration.

Parameters:task_definition (string) – The family and revision ( family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to deregister.
describe_clusters(clusters=None)

Describes one or more of your clusters.

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.
describe_container_instances(container_instances, cluster=None)

Describes Amazon EC2 Container Service container instances. Returns metadata about registered and remaining resources on each container instance requested.

Parameters:
  • cluster (string) – The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instances you want to describe. If you do not specify a cluster, the default cluster is assumed.
  • container_instances (list) – A space-separated list of container instance UUIDs or full Amazon Resource Name (ARN) entries.
describe_task_definition(task_definition)

Describes a task definition.

Parameters:task_definition (string) – The family and revision ( family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to describe.
describe_tasks(tasks, cluster=None)

Describes a specified task or tasks.

Parameters:
  • cluster (string) – The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task you want to describe. If you do not specify a cluster, the default cluster is assumed.
  • tasks (list) – A space-separated list of task UUIDs or full Amazon Resource Name (ARN) entries.
discover_poll_endpoint(container_instance=None)

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.

Parameters:container_instance (string) – The container instance UUID or full 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 UUID. For example, arn:aws:ecs: region : aws_account_id :container- instance/ container_instance_UUID .
list_clusters(next_token=None, max_results=None)

Returns a list of existing clusters.

Parameters:
  • next_token (string) – The nextToken value returned from a previous paginated ListClusters 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. This value is null when there are no more results to return.
  • max_results (integer) – The maximum number of cluster results returned by ListClusters in paginated output. When this parameter is used, ListClusters 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 ListClusters request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then ListClusters returns up to 100 results and a nextToken value if applicable.
list_container_instances(cluster=None, next_token=None, max_results=None)

Returns a list of container instances in a specified cluster.

Parameters:
  • cluster (string) – The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instances you want to list. If you do not specify a cluster, the default cluster is assumed..
  • next_token (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. This value is null when there are no more results to return.
  • max_results (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.
list_task_definitions(family_prefix=None, next_token=None, max_results=None)

Returns a list of task definitions that are registered to your account. You can filter the results by family name with the familyPrefix parameter.

Parameters:
  • family_prefix (string) – The name of the family that you want to filter the ListTaskDefinitions results with. Specifying a familyPrefix will limit the listed task definitions to definitions that belong to that family.
  • next_token (string) – The nextToken value returned from a previous paginated ListTaskDefinitions 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. This value is null when there are no more results to return.
  • max_results (integer) – The maximum number of task definition results returned by ListTaskDefinitions in paginated output. When this parameter is used, ListTaskDefinitions 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 ListTaskDefinitions request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then ListTaskDefinitions returns up to 100 results and a nextToken value if applicable.
list_tasks(cluster=None, container_instance=None, family=None, next_token=None, max_results=None)

Returns a list of tasks for a specified cluster. You can filter the results by family name or by a particular container instance with the family and containerInstance parameters.

Parameters:
  • cluster (string) – The short name or full Amazon Resource Name (ARN) of the cluster that hosts the tasks you want to list. If you do not specify a cluster, the default cluster is assumed..
  • container_instance (string) – The container instance UUID or full Amazon Resource Name (ARN) of the container instance that you want to filter the ListTasks results with. Specifying a containerInstance will limit the results to tasks that belong to that container instance.
  • family (string) – The name of the family that you want to filter the ListTasks results with. Specifying a family will limit the results to tasks that belong to that family.
  • next_token (string) – The nextToken value returned from a previous paginated ListTasks 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. This value is null when there are no more results to return.
  • max_results (integer) – The maximum number of task results returned by ListTasks in paginated output. When this parameter is used, ListTasks 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 ListTasks request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then ListTasks returns up to 100 results and a nextToken value if applicable.
register_container_instance(cluster=None, instance_identity_document=None, instance_identity_document_signature=None, total_resources=None)

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.

Parameters:
  • cluster (string) – The short name or full Amazon Resource Name (ARN) of the cluster that you want to register your container instance with. If you do not specify a cluster, the default cluster is assumed..
  • instance_identity_document (string) –
  • instance_identity_document_signature (string) –
  • total_resources (list) –
register_task_definition(family, container_definitions)

Registers a new task definition from the supplied family and containerDefinitions.

Parameters:
  • family (string) – You can specify a family for a task definition, which allows you to track multiple versions of the same task definition. You can think of the family as a name for your task definition.
  • container_definitions (list) – A list of container definitions in JSON format that describe the different containers that make up your task.
run_task(task_definition, cluster=None, overrides=None, count=None)

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.

Parameters:
  • cluster (string) – The short name or full Amazon Resource Name (ARN) of the cluster that you want to run your task on. If you do not specify a cluster, the default cluster is assumed..
  • task_definition (string) – The family and revision ( family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to run.
  • overrides (dict) –
  • count (integer) – The number of instances of the specified task that you would like to place on your cluster.
start_task(task_definition, container_instances, cluster=None, overrides=None)

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.

Parameters:
  • cluster (string) – The short name or full Amazon Resource Name (ARN) of the cluster that you want to start your task on. If you do not specify a cluster, the default cluster is assumed..
  • task_definition (string) – The family and revision ( family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to start.
  • overrides (dict) –
  • container_instances (list) – The container instance UUIDs or full Amazon Resource Name (ARN) entries for the container instances on which you would like to place your task.
stop_task(task, cluster=None)

Stops a running task.

Parameters:
  • cluster (string) – The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task you want to stop. If you do not specify a cluster, the default cluster is assumed..
  • task (string) – The task UUIDs or full Amazon Resource Name (ARN) entry of the task you would like to stop.
submit_container_state_change(cluster=None, task=None, container_name=None, status=None, exit_code=None, reason=None, network_bindings=None)

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.

Parameters:
  • cluster (string) – The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container.
  • task (string) – The task UUID or full Amazon Resource Name (ARN) of the task that hosts the container.
  • container_name (string) – The name of the container.
  • status (string) – The status of the state change request.
  • exit_code (integer) – The exit code returned for the state change request.
  • reason (string) – The reason for the state change request.
  • network_bindings (list) – The network bindings of the container.
submit_task_state_change(cluster=None, task=None, status=None, reason=None)

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.

Parameters:
  • cluster (string) – The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task.
  • task (string) – The task UUID or full Amazon Resource Name (ARN) of the task in the state change request.
  • status (string) – The status of the state change request.
  • reason (string) – The reason for the state change request.

boto.ec2containerservice.exceptions

exception boto.ec2containerservice.exceptions.ClientException(status, reason, body=None, *args)
exception boto.ec2containerservice.exceptions.ServerException(status, reason, body=None, *args)