.NET APM with AWS Fargate
  • 1 Minute to read
  • Dark
    Light
  • PDF

.NET APM with AWS Fargate

  • Dark
    Light
  • PDF

Article Summary

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

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

aws-fargage-diagram

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.

.NET Core Application Setup

Dockerfile Configuration

Adjust your Dockerfile to include the .Net Core Profiler:

RUN mkdir -m 0755 -p /stackify-dotnet-apm && \
    cd /stackify-dotnet-apm && \
    wget http://download.stackify.com/stackify-dotnet-apm/stackify-dotnet-apm-install-linux-latest.tar.gz && \
    tar -zxvf stackify-dotnet-apm-install-linux-latest.tar.gz && \
    cd stackify-dotnet-apm-install-linux && \
    ./install.sh --docker && \
    cd .. && \
    rm -rf stackify-dotnet-apm-install-linux && \
    rm stackify-dotnet-apm-install-linux-latest.tar.gz

ENV CORECLR_PROFILER={cf0d821e-299b-5307-a3d8-b283c03916da}
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER_PATH="/stackify-dotnet-apm/StackifyProfiler.so"

Configure Application

Create a file named Stackify.json and copy it to your container in the same folder as your application.

{
    "AppName": "MyApp",
    "Environment": "Production"
}

Environment is optional, STACKIFY_ENV value will be used if not present.

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": [
    {
      "mountPoints": [
        {
          "sourceVolume": "stackify",
          "containerPath": "/usr/local/stackify"
        }
      ]
    }
  ]
}

Verify

Start up your .NET Core 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.

Was this article helpful?