ECS Containers, Task Definitions and Services

Managing Containers and Service with ECS

DuploCloud supports running containerized workloads using Amazon Elastic Container Service (ECS) on both EC2 and Fargate. Using the DuploCloud Portal, you can define tasks, configure services, and manage container deployments without manually writing JSON task definitions or navigating the AWS Console. For a complete, step-by-step example of deploying an ECS Task Definition, Service, and Load Balancer, see this tutorial.

Creating a Task Definition

A Task Definition defines how your containers should run, including images, ports, CPU/memory settings, environment variables, volumes, and more.

  1. Select the Tenant from the Tenant list box.

  2. Navigate to Cloud Services -> ECS.

  3. Select the Task Definition tab, click Add. The Add Task Definition-Basic Options pane displays.

Add Task Definition-Basic Options page
  1. Complete the following fields:

Name

Enter a unique name for your task definition.

Operating System/Architecture

Select the operating system and CPU architecture for the task (e.g., Linux | x86_64).

Launch Type

Select one or more launch types (Fargate, EC2).

Network Mode

Select the network mode for the task, e.g., awsvpc.

vCPUs

Specify the CPU units allocated to the task, e.g., 1 vCPU.

Memory

Specify the memory allocated to the task, e.g., 1 GB.

Volumes

Optionally, define one or more storage volumes to be used by containers in the task.

  1. Click Next. The Add Task Definition-Advanced Options pane displays.

Add Task Definition-Advanced Options pane
  1. Configure settings for Container - 1 (primary):

  2. and runtime options for the ECS task:

Container Name

Enter the name for the primary container.

Image

Specify the Docker image to use for this container.

  1. To add more containers, click the plus (+) icon, enter the Container Name and Image, and optionally mark it as Essential. Repeat as needed for all additional containers.

  2. Configure the ECS task’s runtime options

Port

Enter the port number your container listens on, e.g., 80.

Protocol

Select the network protocol for the port (default is tcp).

Environments

Optionally, add environment variables for the container.

Command

Optionally, specify commands to run inside the container.

Health Check

Optionally, configure health checks to monitor container health.

Secret

Optionally, add secrets or credentials securely injected into the container.

Container Other Config

Optionally, specify any other container configurations as needed.

  1. Click Create.

Running a Task (Optional)

Execute a single instance of a container based on your Task Definition. This option is useful for jobs, scripts, and testing.

  1. Select the Tenant from the Tenant list box.

  2. Navigate to Cloud Services -> ECS.

  3. Select the Task Definition tab

  4. From the TASK DEFINITION FAMILY NAME list, locate the Task Definition to run. Note that this is the Task Definition Name prepended by a unique identifier, which includes your Tenant name and part of your Infrastructure name.

  5. Click on the Actions menu, and select Execute. The Run ECS Tasks pane displays.

    The Run ECS Tasks pane
  6. Select the Version and Specify the No of Tasks.

  7. Click Create to run the task.

Creating an ECS Service

Deploy a long-running ECS service that manages task replication, health checks, and optional load balancing.

  1. Select the Tenant from the Tenant list box.

  2. Navigate to Cloud Services -> ECS.

  3. Select the Task Definitions tab.

  4. Select the Task Definition from the TASK DEFINITION FAMILY NAME list. Note that this is the Task Definition Name prepended by a unique identifier, which includes your Tenant name and part of your Infrastructure name.

  5. Select the Service Details tab, and click Configure ECS Service. The Add ECS Service page displays.

The Add ECS Service page
  1. In the Name field, a name for the Service.

  2. Optionally, click Add in the LB Listeners area to add Load Balancer.

    • Complete the required fields on the Add Load Balancer Listener pane, and click Add.

  3. Complete additional fields, as needed, on the Add ECS Service page.

  4. Click Submit. The ECS Service is created.

Managing ECS Tasks and Task Definitions

The Task Definition details page in the DuploCloud Portal lets you manage Task Definitions, view individual versions, and inspect launched Tasks. To open the detail page, navigate to Cloud ServicesECS, select the Task Definition tab, then select the Task Definition from the TASK DEFINITION FAMILY NAME list. Note that this is the Task Definition Name prepended by a unique identifier, which includes your Tenant name and part of your Infrastructure name.

Managing Task Definitions

From the Task Definition details page, click Actions to access the following options:

View JSON

Displays the full configuration of the Task Definition family in JSON format.

Execute

Runs a one-off ECS Task based on this Task Definition.

Edit Task Definition

Opens the Task Definition in edit mode for changes to containers, resources, etc.

Managing Task Definition Versions

From the Task Definition details page, select the Task Definitions tab, then the menu icon () next to any Task Definition version to access the following options:

View JSON

Shows the JSON configuration for that specific version.

Edit Task Definition

Opens the version for editing.

Console

Opens the version in the AWS ECS Console.

Delete

Deletes the version (if it is not in use).

Additional Options for Tasks

From the Task Definition detail page, select the Tasks tab, then click the menu icon () next to any task to access the following options:

View JSON

Displays the runtime configuration of the Task in JSON format.

Console

Opens the ECS Task in the AWS Console.

Logs

Opens the CloudWatch Logs stream for the container.

Shell Access

Launches a shell session in the container.

Managing ECS Services

  1. Select the Tenant from the Tenant list box.

  2. Navigate to Cloud Services ECS.

  3. Select the Services tab.

  4. Select the Service from the NAME column.

  5. Click Actions to access the following options:

View JSON

View the JSON configuration for the Task Definition family.

Console

Open the Task Definition in the AWS Console.

Logs

View logs associated with the Task Definition.

Execute

Run a one-off ECS Task from this Task Definition.

Edit Task Definition

Open the Task Definition in edit mode.

Edit Service

Modify the configuration of the ECS Service.

Delete Service

Deletes the selected ECS Service.

Actions menu for ECS Service

Configuring ECS with EC2 Capacity Provider

Set up a containerized environment where ECS uses EC2 instances to host containers. By leveraging an Auto Scaling Group (ASG), ECS can automatically launch and scale EC2 instances as needed to run your containers.

  1. Create an ASG with the following specifications:

Agent Platform

ECS

Image

Other

Other Image ID

ECS-Optimized AMI ID

  1. Create a Task Definition following the steps shown above.

  2. Add an ECS Service to the Task Definition. During ECS Service creation, click Capacity Provider and select the ASG you created in step 1.

Elastic Container Service (ECS) Fargate

Fargate is a technology that you can use with ECS to run containers without having to manage servers or clusters of EC2 instances.

For information about Fargate, contact the DuploCloud support team.

Last updated

Was this helpful?