AWS Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS.
If needed, set up the Amazon Web Services integration first. To receive Elastic Beanstalk metrics, you must enable the Enhanced Health Reporting feature for your environment, and configure your environment to publish enhanced health metrics to CloudWatch.
Note: These settings increase your CloudWatch custom metric charges.
If you use Docker containers in your Elastic Beanstalk environment, use the containerized Datadog Agent to monitor Docker usage. Follow the steps below to configure your environment to integrate the Datadog Agent container.
To run docker environments with multiple containers per instance, Elastic Beanstalk relies on Amazon EC2 Container Service (ECS).
For this reason you need to describe the containers you want to deploy the ECS-way. In Elastic Beanstalk this is configured using a file named Dockerrun.aws.json
.
A Dockerrun.aws.json
file is an Elastic Beanstalk–specific JSON file that describes how to deploy a set of Docker containers as an Elastic Beanstalk application. You can use this file for a multicontainer Docker environment. Dockerrun.aws.json
describes the containers to deploy to each container instance in the environment and the data volumes to create on the host instance for the containers to mount.
A Dockerrun.aws.json
file can be used on its own or zipped up with additional source code in a single archive. Source code that is archived with Dockerrun.aws.json
is deployed to container instances and accessible in the /var/app/current/
directory. Use the volumes
section of the config to provide mount points for the containers running on the instance and the mountPoints
section of the embedded container definitions to mount them from the containers.
The following code sample illustrates a Dockerrun.aws.json
declaring the Datadog Agent. Update the containerDefinitions
section with your Datadog API Key, tags (optional), and any additional container definitions. If your are using the Datadog EU site, set DD_SITE
to datadoghq.eu
. If needed, this file can be zipped with additional content as described above. For more info about the syntax of this file you can refer to the Beanstalk documentation.
Notes:
agent:7
to a specific minor version of the Docker image.{
"AWSEBDockerrunVersion": 2,
"volumes": [
{
"name": "docker_sock",
"host": {
"sourcePath": "/var/run/docker.sock"
}
},
{
"name": "proc",
"host": {
"sourcePath": "/proc/"
}
},
{
"name": "cgroup",
"host": {
"sourcePath": "/cgroup/"
}
}
],
"containerDefinitions": [
{
"name": "dd-agent",
"image": "gcr.io/datadoghq/agent:7",
"environment": [
{
"name": "DD_API_KEY",
"value": "<YOUR_DD_API_KEY>"
},
{
"name": "DD_SITE",
"value": "datadoghq.com"
},
{
"name": "DD_TAGS",
"value": "<SIMPLE_TAG>, <KEY:VALUE_TAG>"
}
],
"memory": 256,
"mountPoints": [
{
"sourceVolume": "docker_sock",
"containerPath": "/var/run/docker.sock",
"readOnly": false
},
{
"sourceVolume": "proc",
"containerPath": "/host/proc",
"readOnly": true
},
{
"sourceVolume": "cgroup",
"containerPath": "/host/sys/fs/cgroup",
"readOnly": true
}
]
}
]
}
Once the container definition is ready, ship it to Elastic Beanstalk. For specific instructions, refer to Multicontainer Docker Environments in the AWS Elastic Beanstalk documentation.
To collect custom metrics from your application container using DogStatsD in the Multicontainer Docker Environment, add the following to your Dockerrun.aws.json
:
Add the environment variable DD_DOGSTATSD_NON_LOCAL_TRAFFIC
under the dd-agent
container:
{
"name": "DD_DOGSTATSD_NON_LOCAL_TRAFFIC",
"value": "true"
}
Add a link to the dd-agent
container under your application container:
"links": [ "dd-agent:dd-agent"]
See DogStatsD and Docker for additional information.
Follow these steps to install the Datadog Agent in Elastic Beanstalk using Advanced Environment Customization with Configuration Files (.ebextensions).
.ebextensions
in the root of your application source bundle..ebextensions
.DD_API_KEY
within option_settings
in 99datadog.config
to your Datadog API Key.DD_AGENT_VERSION
under option_settings
, to ensure all hosts run the same version of the Agent..ebextensions
in the root of your application source bundle..ebextensions
.DD_API_KEY
within option_settings
in 99datadog-amazon-linux-2.config
to your Datadog API Key.DD_AGENT_VERSION
under option_settings
, to ensure all hosts run the same version of the Agent.Add more settings to datadog.yaml
by updating the "/configure_datadog_yaml.sh"
section of 99datadog.config. The line below enables the Datadog Process Agent.
echo -e "process_config:\n enabled: \"true\"\n" >> /etc/datadog-agent/datadog.yaml
When the application isn’t containerized and the Datadog Agent is configured with 99datadog.config
, tracing is enabled without any additional configuration, provided the application is instrumented with the tracing library setup.
If the application is containerized and the Datadog Agent is configured with 99datadog.config
, do this additional configuration to enable tracing:
"/configure_datadog_yaml.sh"
section in 99datadog.config
file with apm_non_local_traffic
, formatted like this:
echo -e "apm_config:\n enabled: \"true\"\n" >> /etc/datadog-agent/datadog.yaml
echo -e " apm_non_local_traffic: \"true\"\n" >> /etc/datadog-agent/datadog.yaml
172.17.0.1
from inside the application container. (If you’re not sure this is the Gateway IP, run docker inspect <container id>
to confirm.)For all languages, you can set an environment variable called DD_AGENT_HOST
to the Gateway IP.
Alternatively, for the languages below, you can programmatically set the host name:
from ddtrace import tracer
tracer.configure(hostname="172.17.0.1")
const tracer = require('dd-trace');
tracer.init({ hostname: "172.17.0.1" });
require 'ddtrace'
Datadog.configure do |c|
c.tracer hostname: "172.17.0.1")
end
package main
import (
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
)
func main() {
tracer.Start(tracer.WithAgentAddr("172.17.0.1"))
defer tracer.Stop()
// ...
}
Dockerrun.aws.json
as the application, add a Datadog Agent container using the gcr.io/datadoghq/agent
image. Add the following:portMappings
section, add a hostPort
8126 with containerPort
8126.environment
section, setDD_APM_ENABLED
and DD_APM_NON_LOCAL_TRAFFIC
to true
.environment
section, add an environment variable called DD_AGENT_HOST
to the name of the Datadog Agent container.links
section, set the Agent container to be used as an environment variable.An example can be seen below:
"containerDefinitions": [ {
"name": "dd-agent",
"image": "gcr.io/datadoghq/agent:latest",
"environment": [
{
"name": "DD_API_KEY",
"value": "<api key>"
},
{
"name": "DD_APM_ENABLED",
"value": "true"
},
{
"name": "DD_APM_NON_LOCAL_TRAFFIC",
"value": "true"
},
# any other environment variables needed
],
"portMappings": [
{
"hostPort": 8126,
"containerPort": 8126
}
],
"memory": 256,
"mountPoints": [
# any mountpoints needed
}
]
},
{
"name": "application-container",
"image": "<application image name>",
"environment": [
{
"name": "DD_AGENT_HOST",
"value": "dd-agent",
# any other environment variables needed
}
],
"links": [
"dd-agent:dd-agent"
],
aws.elasticbeanstalk.application_latency_p_1_0 (gauge) | The average time to complete the fastest 10 percent of requests. Shown as second |
aws.elasticbeanstalk.application_latency_p_5_0 (gauge) | The average time to complete the fastest 50 percent of requests. Shown as second |
aws.elasticbeanstalk.application_latency_p_7_5 (gauge) | The average time to complete the fastest 75 percent of requests. Shown as second |
aws.elasticbeanstalk.application_latency_p_8_5 (gauge) | The average time to complete the fastest 85 percent of requests. Shown as second |
aws.elasticbeanstalk.application_latency_p_9_0 (gauge) | The average time to complete the fastest 90 percent of requests. Shown as second |
aws.elasticbeanstalk.application_latency_p_9_5 (gauge) | The average time to complete the fastest 95 percent of requests. Shown as second |
aws.elasticbeanstalk.application_latency_p_9_9 (gauge) | The average time to complete the fastest 99 percent of requests. Shown as second |
aws.elasticbeanstalk.application_latency_p_9_9_9 (gauge) | The average time to complete the fastest 99.9 percent of requests. Shown as second |
aws.elasticbeanstalk.application_requests_2xx (count) | The number of requests that completed with a 2XX status code. Shown as request |
aws.elasticbeanstalk.application_requests_3xx (count) | The number of requests that completed with a 3XX status code. Shown as request |
aws.elasticbeanstalk.application_requests_4xx (count) | The number of requests that completed with a 4XX status code. Shown as request |
aws.elasticbeanstalk.application_requests_5xx (count) | The number of requests that completed with a 5XX status code. Shown as request |
aws.elasticbeanstalk.application_requests_total (count) | The number of requests completed by the instance or environment. Shown as request |
aws.elasticbeanstalk.cpuidle (gauge) | [Instance] The percentage of time the CPU was in the idle state in the last minute. Shown as percent |
aws.elasticbeanstalk.cpuiowait (gauge) | [Instance] The percentage of time the CPU was in the iowait state in the last minute. Shown as percent |
aws.elasticbeanstalk.cpuirq (gauge) | [Instance] The percentage of time the CPU was in the interrupt request state in the last minute. Shown as percent |
aws.elasticbeanstalk.cpunice (gauge) | [Instance] The percentage of time the CPU was in the nice state in the last minute. Shown as percent |
aws.elasticbeanstalk.cpusoftirq (gauge) | [Instance] The percentage of time the CPU was in the soft interrupt request state in the last minute. Shown as percent |
aws.elasticbeanstalk.cpusystem (gauge) | [Instance] The percentage of time the CPU was in the system state in the last minute. Shown as percent |
aws.elasticbeanstalk.cpuuser (gauge) | [Instance] The percentage of time the CPU was in the user state in the last minute. Shown as percent |
aws.elasticbeanstalk.environment_health (gauge) | [Environment] The health status of the environment. The possible values are 0 (OK) 1 (Info) 5 (Unknown) 10 (No data) 15 (Warning) 20 (Degraded) and 25 (Severe). |
aws.elasticbeanstalk.instance_health (gauge) | [Instance] The health status of the instance. Shown as instance |
aws.elasticbeanstalk.instances_degraded (count) | [Environment] The number of instances with Degraded health status. Shown as instance |
aws.elasticbeanstalk.instances_info (count) | [Environment] The number of instances with Info health status. Shown as instance |
aws.elasticbeanstalk.instances_no_data (count) | [Environment] The number of instances with no health status data. Shown as instance |
aws.elasticbeanstalk.instances_ok (count) | [Environment] The number of instances with OK health status. Shown as instance |
aws.elasticbeanstalk.instances_pending (count) | [Environment] The number of instances with Pending health status. Shown as instance |
aws.elasticbeanstalk.instances_severe (count) | [Environment] The number of instances with Severe health status. Shown as instance |
aws.elasticbeanstalk.instances_unknown (count) | [Environment] The number of instances with Unknown health status. Shown as instance |
aws.elasticbeanstalk.instances_warning (count) | [Environment] The number of instances with Warning health status. Shown as instance |
aws.elasticbeanstalk.load_average_1min (gauge) | [Instance] The average CPU load over the last minute. |
aws.elasticbeanstalk.load_average_5min (gauge) | [Instance] The average CPU load over the last five minutes. |
aws.elasticbeanstalk.root_filesystem_util (gauge) | [Instance] The percentage of disk space in use. Shown as percent |
Each of the metrics retrieved from AWS will be assigned the same tags that appear in the AWS console, including but not limited to host name, security-groups, and more.
The AWS Elastic Beanstalk integration does not include any events.
The AWS Elastic Beanstalk integration does not include any service checks.
Need help? Contact Datadog support.
On this Page