Skip to content

EcsService

Bases: DuploTenantResourceV2

Manage Duplo ECS Resources

A collection of commands to manage ECS services and task definitions.

apply

Apply a service.

delete_service

Delete an ECS service.

Parameters:

Name Type Description Default
name NAME

The name of the ECS service to delete.

required

Returns:

Name Type Description
message dict

A message indicating the service has been deleted.

find

Find a EcsService by name.

cli usage
duploctl ecsservice find <name>

Parameters:

Name Type Description Default
name NAME

The name of the EcsService to find.

required

Returns:

Name Type Description
resource dict

The EcsService object.

Raises:

Type Description
DuploError

If the {{kind}} could not be found.

find_def

Find the latest version of an ECS task definition by family name.

Parameters:

Name Type Description Default
name NAME

The family name of the ECS task definition to find.

required

Returns:

Name Type Description
task_definition

The latest version of that ECS task definition in the family.

Raises:

Type Description
DuploError

If the ECS task definition could not be found.

find_def_by_arn

Find a ECS task definition by ARN.

Find a task definition by its AWS ARN.

Parameters:

Name Type Description Default
arn ARN

The ARN of the ECS task definition to find.

required

Returns:

Name Type Description
task_definition dict

The ECS task definition object.

Raises:

Type Description
DuploError

If the ECS task definition could not be found.

find_service_family

Find Service Family by Name

Find an ECS Services task definition family by name.

Parameters:

Name Type Description Default
name NAME

The name of the ECS task definition to find.

required

Returns:

Name Type Description
task_definition_family

The ECS task definition object.

Raises:

Type Description
DuploError

If the ECS task definition could not be found.

find_task_def_family

Find a ECS task definition family by name.

Parameters:

Name Type Description Default
name NAME

The name of the ECS task definition to find.

required

Returns:

Type Description

The ECS task definition object.

Raises:

Type Description
DuploError

If the ECS task definition could not be found.

list

Retrieve a List of EcsService

cli usage
duploctl ecsservice list

Returns:

Name Type Description
list list

A list of EcsService.

list_services

List ECS Services

Retrieve a list of all ECS services in a tenant.

CLI Usage
duploctl ecs list_services

Returns:

Name Type Description
list list

A list of ECS services in the tenant.

list_task_def_family

List ECS Task Definitions

Retrieve a list of all ECS task definitions in a tenant.

Example

CLI usage

duploctl ecs list_definitions

Returns:

Name Type Description
task_def_family dict

The historical list of ECS task definitions within a family.

list_tasks

List Tasks

List ECS tasks given a name.

Basic CLI Use
duploctl ecs list_tasks <service-name>

Parameters:

Name Type Description Default
name NAME

The name of the ECS service to list tasks for.

required

Returns:

Name Type Description
list list

A list of ECS tasks associated with the service.

run_task

Run a task from an ECS task definition family's latest definition version."

Execute a task based on some definition.

Basic CLI Use
duploctl ecs run_task <task-definition-family-name> <replicas>
Wait for task to complete

This supports the global --wait flag to hold the terminal until the task is complete. Waits for the status of the task to be the desired complete status.

duploctl ecs run_task myapp 3 --wait

Parameters:

Name Type Description Default
name NAME

The name of the ECS task definition family the task will be spawned from.

required
replicas REPLICAS

The number of replicas to run.

required

Returns:

Name Type Description
message dict

A message indicating the task has been run.

update_image

Update Image

Creates a new task definition version cloning the latest existing version in the family except for image arguments

If task family is used by an ECS service, method also updates the service to use that newly created definition version

Basic CLI Use

  duploctl ecs update_image <task-definition-family-name> <new-image>
  duploctl ecs update_image <task-definition-family-name> --container-image <container-name> <new-container-image>

Update image and wait

This supports the global --wait flag to hold the terminal until the service update is complete. Waits for the status of the service to be the desired running status.

  duploctl ecs update_image myapp myimage:latest --wait

Parameters:

Name Type Description Default
name NAME

The name of the ECS task definition family to update.

required
image IMAGE

The new image to use for the container.

None
container-image

A list of key-value pairs to set as container image.

required

Returns:

Name Type Description
dict dict

A dictionary containing a message about the update status.

Raises:

Type Description
DuploError

If the ECS task definition family could not be updated.

update_service

Update an ECS service.

Parameters:

Name Type Description Default
body dict

The updated ECS service object.

required

Returns:

Name Type Description
message dict

A success message.

Raises:

Type Description
DuploError

If the ECS service could not be updated.

update_taskdef

Update an ECS task definition.

Updates a task definition. This creates a new revision of the task definition and returns the new ARN. Note each definition is immutable so this is effectively a create operation for one item in a set and the latest one is the active one.

Parameters:

Name Type Description Default
body BODY

The updated ECS task definition object.

required

Returns:

Name Type Description
task_definition dict

The updated ECS task definition object.

Raises:

Type Description
DuploError

If the ECS task definition could not be updated.