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.
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 a ECS task definition 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 |
The ECS task definition object. |
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
list_services
list_task_def_family
list_tasks
List Tasks
List ECS tasks given a 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 for an ECS service."
Execute a task based on some definition.
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the ECS service to run the task for. |
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
Update the image for an ECS task definition and service container if one exists.
Basic CLI Use
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the ECS service 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 service 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. |