---
title: "AWS Elastic Container Service (ECS / EC2)"
slug: "aws-elastic-container-service-ecs"
description: "Effortlessly install Retrace on AWS ECS EC2 Cluster and optimize application performance with APM guides for .NET Core, Java, PHP, Node.js, Ruby, and Python."
updated: 2020-06-23T19:11:40Z
published: 2020-06-23T19:11:40Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS Elastic Container Service (ECS / EC2)

This document details how to install **Retrace** in an **AWS ECS EC2 Cluster**.

> **Requirements:** AWS ECS running with EC2 using a x86/ARM AMI (AWS Fargate Support is at: [AWS Elastic Container Service (ECS / Fargate](/docs/aws-fargate)).

## Create Task Definition

Adjust the following configuration and publish to AWS: `stackify-retrace-task.json` :

```
{
  "containerDefinitions": [
    {
      "name": "stackify-retrace",
      "image": "stackify/retrace:latest",
      "cpu": 10,
      "memory": 512,
      "essential": true,
      "mountPoints": [
        {
          "containerPath": "/hostfs",
          "sourceVolume": "hostfs",
          "readOnly": true
        },
        {
          "containerPath": "/var/stackify",
          "sourceVolume": "stackify",
          "readOnly": false
        }
      ],
      "environment": [
        {
          "name": "STACKIFY_KEY",
          "value": "[YOUR_ACTIVATION_KEY]"
        },
        {
          "name": "STACKIFY_ENV",
          "value": "[YOUR_ENVIRONMENT_NAME]"
        }
      ]
    }
  ],
  "volumes": [
    {
      "host": {
        "sourcePath": "/"
      },
      "name": "hostfs"
    },
    {
      "host": {
        "sourcePath": "/var/stackify"
      },
      "name": "stackify"
    }
  ],
  "family": "stackify-retrace-task"
}
```

**Note:** Replace `[YOUR_ACTIVATION_KEY]` and `[YOUR_ENVIRONMENT_NAME]`. Use Image `stackify/retrace-arm64` if running on an ARM processor.

**Publish with AWS CLI:**

```
aws ecs register-task-definition --cli-input-json file://[PATH_TO_CONFIG]/stackify-retrace-task.json
```

## Run Daemon Service

The **Stackify Retrace** container will be setup to run once on each EC2 instance.

1. Log in to your **AWS Web Console**
2. Goto **Services** > **Amazon ECS** > **Clusters** and select the desired cluster.
3. Setup Service
  1. Click **Create** on the **Services** tab
  2. Select **EC2** as **Launch Type**
  3. Select **stackify-retrace-task** as **Task Definition**
  4. Set **Service name** to **stackify-retrace**
  5. Select **DAEMON** as **Service type**
  6. Click **Next Step**
  7. Select **None** as **Load balancer type**
  8. Click **Next Step**
  9. Confirm Auto Scaling is not enabled for Daemon service
  10. Click **Next Step**
  11. Click **Create Service**

---

## Application Setup

The following guides detail how to configure your application containers for APM.

- [.NET Core](/docs/net-apm-with-aws-ecs)
- [Java](/docs/java-apm-with-aws-ecs)
- [PHP](/docs/php-apm-with-aws-ecs)
- [Node.js](/docs/nodejs-apm-with-aws-ecs)
- [Ruby](/docs/ruby-apm-with-aws-ecs)
- [Python](/docs/python-apm-with-aws-ecs)
