> For the complete documentation index, see [llms.txt](https://docs.duplocloud.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.duplocloud.com/docs/automation-platform/overview/quick-start/quick-start-ecs-services/step-4-create-app-via-ecs.md).

# Step 4: Create a Task Definition for an Application

You enabled ECS cluster creation when you created the [Infrastructure](/docs/automation-platform/overview/quick-start/step-1-infrastructure.md). In order to create a Service using ECS, you first need to create a [Task Definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html) that serves as a blueprint for your application.

Once you create a Task Definition, you can run it as a Task or as a Service. In this tutorial, we run the Task Definition as a Service.

*Estimated time to complete Step 4: 10 minutes.*

## Prerequisites <a href="#id-0-toc-title" id="id-0-toc-title"></a>

Before creating an RDS, verify that you completed the tasks in the previous tutorial steps. Using the DuploCloud Portal, confirm that:

* An [Infrastructure and Plan](/docs/automation-platform/overview/quick-start/step-1-infrastructure.md) exist, both named **NONPROD**.
* The **NONPROD** infrastructure has [ECS **Enabled**](/docs/automation-platform/overview/quick-start/step-1-infrastructure.md#check-your-work).
* A Tenant named [**dev01** has been created](/docs/automation-platform/overview/quick-start/step-2-tenant.md).

## Creating a Task Definition

1. In the **Tenant** list box, select the **dev01 Tenant.**<br>

   <div align="left"><figure><img src="/files/FQtAjsKlGqbaYE3WNx2Y" alt=""><figcaption><p>The DuploCloud <strong>Tenant</strong> list box with <strong>dev01</strong> selected</p></figcaption></figure></div>
2. Navigate to **Cloud Services** -> **ECS**.
3. In the **Task Definition** tab, click **Add**. The **Add Task Definition-Basic Options** area displays.<br>

   <figure><img src="/files/ICoftmH2gXUXJzPYEY8D" alt=""><figcaption><p>The <strong>Add Task Definition-Basic Options</strong> area</p></figcaption></figure>
4. In the **Name** field, enter `sample-task-def`.
5. From the **vCPU** list box, select **0.5 vCPU**.
6. From the **Memory** list box, select **1 GB**.
7. Click Next. The **Advanced Options** area displays.<br>

   <figure><img src="/files/8ZU2tGo1L7OEVNjJPqfr" alt=""><figcaption><p>The <strong>Add Task Definition-Advanced Options</strong> page</p></figcaption></figure>
8. In the **Container - 1** section, enter **Container Name** `sample-task-def-c1`.
9. In the **Image** field, enter `duplocloud/nodejs-hello:latest`.
10. In the **Port Mappings** section, in the **Port** field, enter `3000`. Port mappings allow containers to access ports for the host container instance to send or receive traffic.
11. Click **Create**.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.duplocloud.com/docs/automation-platform/overview/quick-start/quick-start-ecs-services/step-4-create-app-via-ecs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
