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 display.

The Add Task Definition-Basic Options page
  1. In the Name field, give the task definition a name.

  2. Specify the Operating System/Architecture.

  3. Specify the vCPU and Memory:

    • vCPUs: Specifies the number of CPU units used by the task. It can be expressed as an integer using CPU units, for example 1024, or as a string using vCPUs, for example 1 vCPU or 1 vcpu.

    • Memory: Specifies the amount of memory (in MiB) used by the task. It can be expressed as an integer using MiB, for example 1024, or as a string using GB, for example 1GB or 1 gb.

  4. Optionally, specify Volumes for the Task Definition.

  5. Click Next. The Add Task Definition-Advanced Options display.

    The Add Task Definition-Advanced Options
  6. In the Container-1 field, specify your primary Container details.

    • Add additional containers by clicking the add icon ( ) to create up to five (5) containers.

    • Be sure to select the Essential Container option when defining your containers, as the task will fail if the essential container stops or fails to run.

  7. Click Submit.

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?