Configuring eG Agent container in AWS ECS Fargate Task
A new revision is required whenever the task configuration changes. This includes updating the container image to a new tag or digest, such as when deploying new application code, changing the CPU or memory allocation, modifying environment variables or secrets, updating the IAM task role or execution role, adding or removing containers, volumes, or mount points, changing the networking mode, port mappings, or log configuration, and updating health check commands. In short, any modification to the task definition, whether minor or significant, requires registering a new revision, since existing revisions cannot be edited in place. The configuration of eG Agent container in ECS Fargate Task includes the steps on how to create new revision as well as new revision with JSON in AWS console under different environments as they are explained in the upcoming sections:
-
Creating a new revision in AWS Cloud environment.
-
Creating a new revision with JSON in AWS Cloud environment.
-
Creating new revision for enabling auto discovery of Container Apps
-
Creating new revision with JSON for enabling auto discovery of Container Apps
-
Creating new revision for enabling eG BTM in Node JS App
-
Creating new revision with JSON for enabling eG BTM in Node JS App
-
Creating new revision for enabling eG BTM and JMX in JAVA/TOMCAT in Java App
-
Creating new revision with JSON for enabling eG BTM and JMX in JAVA/TOMCAT in Java App
Initial steps for creating new revision and creating a new revision with JSON in AWS Cloud
The initial steps for creating a new revision and creating a new revision with JSON in AWS Cloud is the same as given below. These steps are common for all other environments as listed above.
-
In AWS console, navigate to Elastic Container Service option.
Figure 1 : Elastic container service option
-
Navigate to Task definitions list in the Cluster section.
Figure 2 : Selecting Task definitions menu item
-
Click on the Task definition to which eG Agent needs to be attached.
Figure 3 : Selecting specific task definition
-
Click on Create new revision button.
Figure 4 : Clicking Create new revision drop down
-
From the Create new revision drop down, select your desired option. The options are Create new revision and Create new revision with JSON.
Figure 5 : Create new revision and create new revision with JSON options
Creating new revision in AWS console
Follow the below steps when Create new revision option is selected from the Create new revision drop-down as indicated in step 5 of the Initial steps for creating new revision and creating a new revision with JSON in AWS Cloud topic:
-
Once you click on Create new revisionoption, scroll below to click the Add Container button.
Figure 6 : Add container
-
In the Container definition page, specify name of the eG agent container as eG Agent in the Name text box and mention the image URI of the eG agent container as docker.io/eginnovations/agent:7.6.0 in the Image URI text box.
Figure 7 : Container name and URI
-
Specify CPU, Memory hard limit and Memory soft limit as per requirement. Click on Add environment variable button.
Figure 8 : Specifying resource allocation limits
-
In the Environment variables section, configure the following environment variables (see Figure 9) by clicking the Add environment variable button.
-
Add EG_AGENT_IDENTIFIER_IDin the Key text box , select Value option from the Value type drop down, and specify the eG agent's UAID as the value in the Value text box.
-
Add EG_AWS_ECS_FARGATEin the Key text box , select Value option from the Value type drop down, and specify the value as true in the Value text box.
-
Add EG_MANAGER_SSL in the Key text box , select Value option from the Value type drop down, and specify the value as true/false in the Value text box based on SSL availability of the eG Manager.
-
Add EG_CONTAINER_RUNTIME in the Key text box , select Value option from the Value type drop down, and specify the value as ECS in the Value text box.
-
Add EG_MANAGER in the Key text box , select Value option from the Value type drop down, and specify the value of the eG Manager's domain in the Value text box.
-
Add EG_MANAGER_PORT in the Key text box , select Value option from the Value type drop down, and specify the value of the eG Manager's port in the Value text box.
-
-
In the HealthCheck section, specify Health Check conditions for eG Agent container.
Figure 10 : Healthcheck specifications
-
Once you are done with all changes, scroll to end and click on Create button.
Figure 11 : Saving all changes using create button
Creating new revision with JSON in AWS cloud environment
Follow the below steps when Create new revision with JSON option is selected from the Create new revision drop down as indicated in step 5 of the Initial steps for creating new revision and creating a new revision with JSON in AWS Cloud topic:
-
Add the eG agent container definition JSON to the existing containerDefinitions section and modify the dynamic values in the aforementioned JSON.
Figure 12 : Adding JSON script
The format of JSON file is given below:
{
"name": "egagent",
"image": "docker.io/eginnovations/agent:7.6.0",
"cpu": 0,
"portMappings": [],
"essential": false,
"environment": [
{
"name": "EG_AGENT_IDENTIFIER_ID",
"value": "vrsudufksmlhdyxq6h3v2ybnpcc5hjqi" --> eG agent's UAID
},
{
"name": "EG_AWS_ECS_FARGATE",
"value": "true"
},
{
"name": "EG_MANAGER_SSL",
"value": "true" --> true/false based on SSL availability of eG Manager
},
{
"name": "EG_MANAGER_PORT",
"value": "7077" --> Port of eG Manager
},
{
"name": "EG_CONTAINER_RUNTIME",
"value": "ECS"
},
{
"name": "EG_MANAGER",
"value": "172.16.14.95" --> domain of eG Manager
}
],
"mountPoints": [{}],
"volumesFrom": [],
"dockerLabels": {},
"logConfiguration": {},
"secretOptions": []
},
"healthCheck": {
"command": [
"CMD-SHELL",
"echo 'healthy'"
],
"interval": 60,
"timeout": 5,
"retries": 1,
"startPeriod": 60
},
"systemControls": []
}
-
Once you are done with all changes, scroll to end and click on Create button.
Figure 13 : Saving changes using create button
-
Creating new revision for enabling auto discovery of Container Apps
To enable the auto discovery of container apps while using AWS console for creating task revision, follow the below steps when Create new revision option is selected from the Create new revision drop down as indicated in step 5 of the Initial steps for creating new revision and creating a new revision with JSON in AWS Cloud topic:
-
Identify which containers need to be auto-discovered, edit their Docker labels to enter the eG Component type and the container’s port in the following manner:
eg.instance.port:3000
eg.instance.type:NodeJS
The above example is highlighted for NodeJS server, but it varies for other server type.
Figure 14 : Containers port details for new revision
-
Once you are done with all changes, scroll to end and click on Create button.
Figure 15 : Saving changes using create button
Creating new revision with JSON for enabling auto discovery of Container Apps
To enable the auto discovery of container apps while using AWS console for creating task revision with JSON, follow the below steps when Create new revision with JSON option is selected from the Create new revision drop down as indicated in step 5 of the Initial steps for creating new revision and creating a new revision with JSON in AWS Cloud topic:
-
To all other existing containers which needs to be auto-discovered, edit their Docker labels to enter the eG Component type and the container’s port in the following manner:
eg.instance.port:3000
eg.instance.type:NodeJS
The above example is highlighted for NodeJS, but it varies for other server type.
Figure 16 : Containers port details for new revision with JSON
-
Once you are done with all changes, scroll to end and click on Create button.
Figure 17 : Saving changes using create button
Creating new revision for enabling eG BTM in Node JS App
To enable eG BTM in Node JS while using AWS console for creating task revision, follow the below steps when Create new revision option is selected from the Create new revision drop down as indicated in step 5 of the Initial steps for creating new revision and creating a new revision with JSON in AWS Cloud topic:
-
Click on Add volume button in Task definition page.
Figure 18 : Adding volume when creating new revision
-
Specify eg-apm in Volume name text box, select Configure at task definition creation for Configuration type, and select Bind mount for Volume type. Once done, scroll down.
Figure 19 : Defining volume name
-
Click on Add mount points button.
Figure 20 : Adding mount points
-
Click on the Container drop down list in the Container mount points section.
Figure 21 : Container selection
-
Select the Node JS app container from the Container drop down list.
Figure 22 : Selection of Node JS app container
-
In Source volume drop down, select eg-apm.
Figure 23 : Selection of source volume
-
In Container path text box, specify /opt/egbtm/nodejs and then click Add mount point button.
Figure 24 : Adding container path
-
Select the eG agent container from the Container drop down list and repeat the same container path entry done for Node JS app container.
Figure 25 : Selection of egagent container option
-
In the Environment variables section, configure the following environment variables (see Figure 26) by clicking the Add environment variable button:
-
Add NODE_OPTION in the Keytext box , select Value option from the Value type drop down, and specify the value as --require=/opt/egbtm/nodejs/start.js in the Value text box. If NODE_OPTION key is already available, then add --require=/opt/egbtm/nodejs/start.js to the existing value.
Figure 26 : Adding environment variables for Node JS App container
-
-
In the Docker configuration section, provide the entry point command as until [ -r /opt/egbtm/nodejs/start.js ]; do echo 'Waiting for readable eG agent files...'; sleep 2; done; node server.js to run the application. This is to ensure that the application waits for eG BTM files to be available at common volume mount.
Figure 27 : Adding command in Docker configuration
-
In Startup dependency ordering for NodeJS container,
-
Click on Add container dependency button.
-
Select egagent from the Container namedrop down , select Healthyfrom the Condition drop down.
Figure 28 : Checking health of eG Agent container
-
-
Once you are done with all changes, scroll to end and click on Create button.
Figure 29 : Saving changes using create button
Creating new revision with JSON for enabling eG BTM in Node JS App
To enable eG BTM in Node JS while using AWS console for creating task revision, follow the below steps when Create new revision with JSON option is selected from the Create new revision drop down as indicated in step 5 of the Initial steps for creating new revision and creating a new revision with JSON in AWS Cloud topic:
-
Scroll down to volumes key of the Node JS container and add the following entries.
"volumes": [
{
"name": "eg-apm",
"host": {}
}
]
Figure 30 : Adding volume with object
-
Scroll to the mountPoints key of the Node JS container and add the following entries.
"mountPoints": [
{
"sourceVolume": "eg-apm",
"containerPath": "/opt/egbtm/nodejs",
"readOnly": false
}
],
Note:
If the key mountPoints not available, then create a one.
Figure 31 : Adding mount point entries for Node JS container
-
Scroll to the mountPoints key of the eG agent container and add the following entries. It is to be noted that if the key mountPoints is not available, then create a one.
"mountPoints": [
{
"sourceVolume": "eg-apm",
"containerPath": "/opt/egbtm/nodejs",
"readOnly": false
}
],
Figure 32 : Adding mount point entries for eG Agent container
-
Scroll to the environment key of the Node JS container. It is to be noted that if the key NODE_OPTIONS is not available, then create a one.

Figure 33 : Adding environment entries for Node JS container
-
Provide the entry point command as until [ -r /opt/egbtm/nodejs/start.js ]; do echo 'Waiting for readable eG agent files...'; sleep 2; done; node server.jsto run the application. Ensure that entryPoint and command keys are available.
-
Once you are done with all changes, scroll to end and click on Create button.
Figure 35 : Saving changes using create button
Creating new revision for enabling eG BTM for JAVA/TOMCAT applications
To enable eG BTM in JAVA/TOMCAT applications while using AWS UI for creating task revision, follow the below steps when Create new revision option is selected from the Create new revision drop down as indicated in step 5 of the Initial steps for creating new revision and creating a new revision with JSON in AWS Cloud topic:
-
Click on Add volume button
Figure 36 : Adding volume when creating new revision
-
Specify eg-apm in Volume name text box, select Configure at task definition creation from Configuration type, and select Bind mount for Volume type. Once done, scroll down.
Figure 37 : Defining volume name
-
Click on Add mount points button.
Figure 38 : Adding mount points
-
Click on the Container drop down list.
Figure 39 : Container selection
-
Select your JAVA/TOMCAT app container option from the Container drop down list.
Figure 40 : Selection of JAVA/TOMCAT app container
-
Select eg-apm from Source volume drop down.
Figure 41 : Selection of source volume
-
In Container path text box, specify as /opt/egbtm/java
Figure 42 : Adding container path
-
Select the egagent container from the Container drop down list and repeat the same container path entry done for JAVA/TOMCAT app container.
Figure 43 : Selection of egagent container option
-
In the Environment variables section of the Java application for which you need to enable BTM, configure the following environment variables (see Figure 44) by clicking the Add environment variable button:
-
Add EG_COLLECTOR_IP in the Key text box, select Value option from the Value type drop down, and specify the value as silly in the Value text box.
-
Add JAVA_TOOL_OPTIONS in the Key text box , select Value option from theValue type drop down, and specify the value as -javaagent:/opt/egbtm in the Value text box
-
Add TZ in the Key text box , select Value option from the Value type drop down, and specify the value as Asia/Kolkata in the Value text box.
-
-
In the Docker configuration section, provide a 30 seconds sleep to the entry point command used to run the application. This is to ensure that eG Agent has enough time to copy files to common volume mount.
Figure 45 : Adding command in Docker configuration
-
In Startup dependency ordering for best bag container, ensure eG Agent’s container is present with condition Healthy.
Figure 46 : Checking health of eG Agent container
-
Once you are done with all changes, scroll to end and click on Create button.
Figure 47 : Saving changes using create button
Creating new revision for enabling JMX for JAVA/TOMCAT applications
To enable JMX in JAVA/TOMCAT applications while using AWS UI for creating task revision, follow the below steps when Create new revision option is selected from the Create new revision drop down as indicated in step 5 of the Initial steps for creating new revision and creating a new revision with JSON in AWS Cloud topic:
-
Navigate to Environment variables section of the JAVA/TOMCAT application. Add JAVA_OPTIONS in the Key text box, select Value option from the Value type drop down, and specify the value for this key in the Value text box as shown below.
Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.rmi.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1
Figure 48 : Adding values for JAVA_OPTIONS key
-
Once you are done with all changes, scroll to end and click on Create button.
Figure 49 : Saving changes using create button
-
Creating new revision with JSON for enabling eG BTM for JAVA/TOMCAT applications
To enable eG BTM in JAVA/TOMCAT applications while using AWS UI for creating task revision with JSON, follow the below steps when Create new revision with JSON option is selected from the Create new revision drop down as indicated in step 5 of the Initial steps for creating new revision and creating a new revision with JSON in AWS Cloud topic:
-
Scroll down to volumes key and add the entries for volume as shown in Figure 50.
-
Scroll to the mountPoints key of the Node JS container (If not available, create one) and add the entries for mountPoints as shown in Figure 51
Figure 51 : Adding mount point entries for Node JS container
-
Scroll to the mountPoints key of the eG Agent container (If not available, create one) and add the entries for mountPoints as shown in Figure 52
Figure 52 : Adding mount point entries for eG Agent container
-
Provide a 30 seconds sleep to the entry point command used to run the application. Ensure entryPoint and command keys are present as shown in Figure 53.
-
Scroll to the environment key of the JAVA/TOMCAT container (If absent, create one) and add the entry for JAVA_TOOL_OPTIONS as shown in Figure 54.
-
Once you are done with all changes, scroll to end and click on Create button.
Figure 55 : Saving changes using create button
Creating new revision with JSON for enabling JMX in JAVA/TOMCAT applications
To enable JMX in JAVA/TOMCAT applications while using AWS UI for creating task revision with JSON, follow the below steps when Create new revision with JSON option is selected from the Create new revision drop down as indicated in step 5 of the Initial steps for creating new revision and creating a new revision with JSON in AWS Cloud topic:
-
Scroll to the environment key of the JAVA/TOMCAT container (If absent, create one) and add the entry for JAVA_OPTIONS as shown in Figure 54.
-
Once you are done with all changes, scroll to end and click on Create button.
Figure 57 : Saving changes using create button
-