> 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-5-create-the-ecs-service-and-load-balancer.md).

# Step 5: Create the ECS Service and Load Balancer

Now that you've created a Task Definition, create a Service, which creates a Task (from the definition) to run your application. A Task is the instantiation of a Task Definition within a cluster. After you create a task definition for your application within Amazon ECS, you can specify multiple tasks to run on your cluster, based on your performance and availability requirements.

Once a Service is created, you must create a Load Balancer to expose the Service on the network. An Amazon ECS service runs and maintains the desired number of tasks simultaneously in an Amazon ECS cluster. If any of your tasks fail or stop, the Amazon ECS service scheduler launches another instance based on parameters specified in your Task Definition. It does so in order to maintain the desired number of tasks created.

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

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

Before creating the ECS Service and Load Balancer, verify that you accomplished 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).
* A [Task Definition named **sample-task-def**](/docs/automation-platform/overview/quick-start/quick-start-ecs-services/step-4-create-app-via-ecs.md) has been created.

## Creating an ECS Service and Load Balancer

1. In the DuploCloud Portal's **Tenant** list box, select **dev01**.<br>

   <div align="left"><figure><img src="/files/FQtAjsKlGqbaYE3WNx2Y" alt=""><figcaption><p>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 Definitions** tab, select the Task Definition Family Name, **DUPLOSERVICES-DEV01-SAMPLE-TASK-DEF**. This is the [Task Definition **Name** you created ](/docs/automation-platform/overview/quick-start/quick-start-ecs-services/step-4-create-app-via-ecs.md#creating-a-task-definition)prepended by a unique identifier, which includes your Tenant name (**DEV01**) and part of your Infrastructure name (**ECS-TEST**).
4. In the **Service Details** tab, click the **Configure ECS Service** link. The **Add ECS Service** page displays.

<figure><img src="/files/7GEhgAKTUoV3mvlapVLN" alt=""><figcaption><p>The <strong>Service Details</strong> tab</p></figcaption></figure>

<figure><img src="/files/0uY3u9OBExyswNLRaZOM" alt=""><figcaption><p>The <strong>Add ECS Service</strong> page</p></figcaption></figure>

5. In the **Name** field, enter **sample-httpd-app** as the Service name.
6. In the **LB Listeners** area, click **Add**. The **Add Load Balancer Listener** pane displays.<br>

   <div align="left"><figure><img src="/files/j1DqZUsw7YqjnqNcbE2Q" alt=""><figcaption><p><strong>Add Load Balancer Listener</strong> pane for an ECS Service</p></figcaption></figure></div>
7. From the **Select Type** list box, select **Application LB**.
8. In the **Container Port** field, enter **3000**.
9. In the **External Port** field, enter **80**.
10. From the **Visibility** list box, select **Public**.
11. In the **Heath Check** field, enter **/**, specifying `root`, the location of Kubernetes Health Check logs.
12. From the **Backend Protocol** list box, select **HTTP**.
13. From the **Protocol Policy** list box, select **HTTP1**.
14. On the **Add ECS Service** page, click **Submit**.

## Checking Your Work

In the **Service Details** tab, information about the Service and Load Balancer you created is displayed. Verify that the Service and Load Balancer configuration details in the **Service Details** tab are correct.

<figure><img src="/files/BRgAzjOL1bCwYYiVI0AS" alt=""><figcaption><p><strong>Service Details</strong> tab displaying Service and Load Balancer configuration details</p></figcaption></figure>


---

# 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-5-create-the-ecs-service-and-load-balancer.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.
