---
title: "Java APM with AWS ECS"
slug: "java-apm-with-aws-ecs"
updated: 2020-05-05T22:26:16Z
published: 2020-05-05T22:26:16Z
---

> ## 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.

# Java APM with AWS ECS

This document details how to install the **Java APM Profiler** in your **Java** application running on **AWS Elastic Container Service (ECS)**.

## Prerequisite

Follow the [Retrace AWS ECS](/docs/aws-elastic-container-service-ecs) Guide.

## Java Application Setup

#### Dockerfile Configuration

Adjust your **Dockerfile** to include the Java Profiler.

```
RUN mkdir -p /stackify-java-apm && \
    cd /stackify-java-apm && \
    wget https://download.stackify.com/stackify-java-apm/stackify-java-apm-latest.tar.gz; tar -zxvf  stackify-java-apm-latest.tar.gz; rm stackify-java-apm-latest.tar.gz && \
    ./install.sh
```

#### Enabling the Java Agent

Follow **[Enable the Stackify Java Profiler](/docs/java-apm-with-linux#enable-the-stackify-java-profiler)** instructions based on the application server being used.

**Note:** Adjust the Java Profiler path to: `/stackify-java-apm/stackify-java-apm.jar`.

#### Task Configuration

Application containers are required to have the **stackify** volume mount configured in the [Retrace AWS ECS](/docs/aws-elastic-container-service-ecs) Guide.

Add the **stackify** volume to the task definition:

```
{
  "volumes": [
    {
      "name": "stackify",
      "host": {
        "sourcePath": "/var/stackify"
      }
    }
  ]
}
```

Add **stackify** mount points to the container definition:

```
{
 "containerDefinitions": [
   {
     "environment": [
       {
         "name": "STACKIFY_APPLICATION_NAME",
         "value": "My Java Application"
       },
       {
         "name": "STACKIFY_ENVIRONMENT_NAME",
         "value": "Production"
       }
     ],
     "mountPoints": [
       {
         "readOnly": false,
         "containerPath": "/usr/local/stackify",
         "sourceVolume": "stackify"
       }
     ]
   }
 ]
}
```

Customize the `STACKIFY_APPLICATION_NAME` and `STACKIFY_ENVIRONMENT_NAME` values.

## Verify

Start up your Java application task and make requests. You can then verify results in the Retrace dashboard.
