# Step 4: Create a Task Definition for an Application

You enabled ECS cluster creation when you created the [Infrastructure](https://docs.duplocloud.com/docs/automation-platform/overview/quick-start/step-1-infrastructure). 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](https://docs.duplocloud.com/docs/automation-platform/overview/quick-start/step-1-infrastructure) exist, both named **NONPROD**.
* The **NONPROD** infrastructure has [ECS **Enabled**](https://docs.duplocloud.com/docs/automation-platform/overview/step-1-infrastructure#check-your-work).&#x20;
* A Tenant named [**dev01** has been created](https://docs.duplocloud.com/docs/automation-platform/overview/quick-start/step-2-tenant).

## Creating a Task Definition

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

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FOBlI1RJksUL52ADgp8y1%2Ftenant_dev01.png?alt=media&#x26;token=22f139f9-ac74-4918-91d8-6f2453c418d6" 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="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FdoEaYFNKvE2c8WR7Ko30%2FScreenshot%20(105).png?alt=media&#x26;token=d1ff7011-948f-4c3f-a652-9504c58e422f" alt=""><figcaption><p>The <strong>Add Task Definition-Basic Options</strong> area</p></figcaption></figure>

4. In the **Name** field, enter `sample-task-def`.&#x20;

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="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FcaiZA0e9oIjp0If7Stwe%2FScreenshot%20(106).png?alt=media&#x26;token=9e6e8e7e-37cd-4740-a3b6-fe7eeaf43ea1" 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`.&#x20;

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.&#x20;

11. Click **Create**.
