> 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/aws-services/containers/ecs-containers-and-task-definitions/sharing-ec2-auto-scaling-groups-across-tenants-for-ecs.md).

# Sharing EC2 Auto Scaling Groups Across Tenants for ECS

DuploCloud supports sharing EC2 Auto Scaling Groups (ASGs) across Tenants for ECS services. This allows multiple Tenants to consume a common pool of ECS hosts, improving host utilization and centralizing infrastructure management. Tenant isolation is preserved, as each Tenant can only view and manage its own ECS tasks, even when those tasks are running on shared hosts.

## Configuring EC2 ASG Sharing for ECS Services

### Enabling Host Sharing Tenant Settings

To allow ECS tasks to run on Hosts from another Tenant, both Tenants must have the correct settings enabled:

1. Navigate to **Administrator** → **Tenants**.
2. Select the Tenant in the **NAME** column.
3. Select the **Settings** tab.
4. Click **Add**. The **Add Tenant Feature** pane displays.
5. In the **Select Feature** list box, select the appropriate setting for the Tenant:
   * Tenant running hosts: **Allow hosts to run K8S pods/ECS Task from other tenants**
   * Tenant(s) running tasks: **Enable option to run K8S pods/ECS Task on any host**<br>

{% columns %}
{% column width="50%" %}

<figure><img src="/files/oWW0eQ14iTp5fNe9bXHU" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column width="50%" %}

<figure><img src="/files/W33SfwYzHU5PxOk1ohhl" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

6. Select **Enable**, and click **Add** to save.

### Creating a Shared ASG

In the Tenant that you want to run the hosts:

1. [Create an ASG](/docs/automation-platform/overview/use-cases/hosts-vms/auto-scaling/auto-scaling-groups.md#creating-autoscaling-groups-asg).
   * Select **ECS** in the **Agent Platform** field.
2. Wait until at least one EC2 host is running and registered with ECS before using it.

### Using a Shared ASG in ECS Services

In the Tenant that you want to run ECS tasks:

1. [Create an ECS Task Definition](/docs/automation-platform/overview/aws-services/containers/ecs-containers-and-task-definitions.md#creating-a-task-definition).
   * In the **Launch Type** field, select **EC2**.
2. Using this task definition, [create an ECS Service](/docs/automation-platform/overview/aws-services/containers/ecs-containers-and-task-definitions.md#creating-an-ecs-service).
   * Select the shared ASG from the **Capacity Provider** list box.

{% hint style="info" %}
The shared ASG only appears in the Capacity Provider list box if the following conditions are met:

* **Host sharing settings are enabled** in both Tenants.
* **At least one ECS Linux Host** is running in the provider ASG.
* The **launch type is EC2** (shared ASGs are not supported for Fargate tasks).
  {% endhint %}


---

# 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/aws-services/containers/ecs-containers-and-task-definitions/sharing-ec2-auto-scaling-groups-across-tenants-for-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.
