# ECS Services and Load Balancers

## Prerequisites

Before you create an ECS Service and Load Balancer, you must create a [Task Definition](https://docs.duplocloud.com/docs/automation-platform/overview/aws-services/containers/ecs-containers-and-task-definitions) to run the Service. You can define multiple containers in your Task Definition.

## Adding an ECS Service and Load Balancer Listener

{% hint style="info" %}
For an end-to-end example of deploying an application using an ECS Service, see the [AWS Quick Start Tutorial](https://docs.duplocloud.com/docs/automation-platform/overview/quick-start) and choose the [Creating an ECS Service](https://docs.duplocloud.com/docs/automation-platform/overview/quick-start/quick-start-ecs-services) option.
{% endhint %}

Tasks run until an error occurs or a user terminates the Task in the ECS Cluster.

1. Navigate to **Cloud Services** -> **ECS**.
2. In the **Task Definitions** tab, select the Task Definition Family Name. This is the [Task Definition **Name** that you created ](https://docs.duplocloud.com/docs/automation-platform/overview/aws-services/containers/ecs-containers-and-task-definitions)prepended by a unique DuploCloud identifier.
3. In the **Service Details** tab, click the **Configure ECS Service** link. The **Add ECS Service** page displays.
4. In the **Name** field, enter the Service name.
5. In the **LB Listeners** area, click **Add**. The **Add Load Balancer Listener** pane displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FXZCWi703geRbU8WVVbXf%2Fdockerq.png?alt=media&#x26;token=6b9777f7-7171-4337-93b4-02e1360e47b6" alt=""><figcaption><p><strong>Add Load Balancer Listener</strong> pane for an ECS Service</p></figcaption></figure></div>
6. Complete the fields on the **Add Load Balancer Listener** pane, and click **Add**.
7. On the **Add ECS Service** page, click **Submit**.

## Viewing ECS Services

Verify that the Service and Load Balancer configuration details in the Service Details tab are correct.

1. Navigate to **Cloud Services** -> **ECS**.
2. Select the **Services** tab.
3. Select the Service you want to view from the **NAME** column. Service details display.

<figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2F5w5NDq2ofjxXVTSWW5Ov%2Fecs_8.png?alt=media&#x26;token=639af872-cd3d-426f-b22a-1232bb22c643" alt=""><figcaption><p><strong>Service Details</strong> tab displaying Service and Load Balancer configuration details</p></figcaption></figure>

## Additional Load Balancer Settings

You can use the **Other Settings** card in the DuploCloud Portal to set the following features:

* WAF Web ACL
* Enable HTTP to HTTPS redirects
* Enable Access Logging
* Set Idle Timeout
* Drop invalid headers
* Delete Protection

1. In the DuploCloud Portal, navigate to **Cloud Services** -> **ECS**, and select the **Services** tab.
2. Select the Service to which your Load Balancer is attached from the **NAME** column.
3. Click the **Load Balancers** tab.
4. In the **Other Settings** card, click **Edit**.<br>

   <figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FDwtHdlwgtPhZuN8sqn1h%2Fothersettingsnew.png?alt=media&#x26;token=0d45a66f-4edd-4237-8dca-7fc5e1c6f55d" alt=""><figcaption><p>The <strong>ECS</strong> details page with the <strong>Edit Other Settings</strong> option highlighted</p></figcaption></figure>
5. The **Other Load Balancer Settings** pane displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2Fhx8au07vvvFmtaccEv46%2FScreenshot%20(68).png?alt=media&#x26;token=3887b3b5-0d94-4521-ab6c-35099e319f93" alt=""><figcaption><p><strong>Other Load Balancer Settings</strong> pane</p></figcaption></figure></div>
6. Configure the settings, as needed.
7. Click **Save**. The Load Balancer settings are updated.


---

# Agent Instructions: 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:

```
GET https://docs.duplocloud.com/docs/automation-platform/overview/aws-services/load-balancers/ecs-services-and-load-balancers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
