---
title: "Java APM with AWS Fargate"
slug: "java-apm-with-aws-fargate"
updated: 2020-06-23T19:15:00Z
published: 2020-06-23T19:15:00Z
---

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

This document details how to install the **Java APM Profiler** in your **Java** application running on **AWS Fargate**.

**Stackify** supports **AWS Fargate** by adding our **Retrace Container** to your **AWS Fargate** tasks.

![aws-fargage-diagram](https://cdn.document360.io/3fcaf473-a1ef-4778-aa2c-fd28411c2b01/Images/Documentation/aws-fargage-diagram.png)

The configuration is in two parts; adjusting your **Dockerfile** config to include the appropriate Stackify profiler and then adjusting task/container definition configuration in **AWS Fargate**. The configuration details are provided below in JSON samples.

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

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

```
{
  "volumes": [
    {
      "name": "stackify"
    }
  ]
}
```

1. Add the **stackify-retrace**  container  to the **task definition**:

```
{
 "containerDefinitions": [
   {
     "name": "stackify-retrace",
     "image": "stackify/retrace:latest",
     "memoryReservation": "512",
     "essential": true,
     "environment": [
       {
         "name": "STACKIFY_KEY",
         "value": "[YOUR_ACTIVATION_KEY]"
       },
       {
         "name": "STACKIFY_ENV",
         "value": "[YOUR_ENVIRONMENT_NAME]"
       }, 
        {
         "name": "STACKIFY_DEVICE_ALIAS",
         "value": "AWS Fargate"
       }
     ],
     "mountPoints": [
       {
         "sourceVolume": "stackify",
         "containerPath": "/var/stackify"
       }
     ]
   }
 ]
}
```

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

1. Add **stackify mount points** to your application **container definition**:

```
{
  "containerDefinitions": [
    {
      "environment": [
        {
          "name": "STACKIFY_APPLICATION_NAME",
          "value": "My Java Application"
        },
        {
          "name": "STACKIFY_ENVIRONMENT_NAME",
          "value": "Production"
        }
      ],
      "mountPoints": [
        {
          "sourceVolume": "stackify",
          "containerPath": "/usr/local/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.

Server Metrics Notice
 Server metrics are not provided with AWS Fargate. A server named **AWS Fargate** will be created but will not contain metrics.
