AWS Elastic Beanstalk

This guide walks you through instrumenting AWS Elastic Beanstalk with OpenTelemetry and Middleware.

Introduction

OpenTelemetry offers a standardized method for collecting telemetry data across applications. However, integrating OpenTelemetry with AWS Elastic Beanstalk poses specific challenges due to its serverless infrastructure. This guide aims to simplify the process of setting up OpenTelemetry for various programming languages within Elastic Beanstalk.

Key Challenges

Since AWS Elastic Beanstalk runs on EC2 instances, you would typically SSH into the underlying instance to instrument your application. However, any changes made to the EC2 instance are lost when the environment is restarted, as Elastic Beanstalk replaces the instance with a fresh one, which lacks the previous instrumentation.

PHP/Laravel

Features Supported

TracesMetricsApp LogsCustom LogsProfiling

Installation

1 Create .ebextensions Directory

In your Laravel project’s root directory, create a folder named .ebextensions and add a 99-mwinstrumentation.config file with the following content:

2 Configure Environment Variables

In the Elastic Beanstalk environment configurations, add the following environment variables:

For frontend-backend trace correlation, add this additional environment variable:

3 Additional Configuration

For enabling metrics and further customization, refer to the Laravel instrumentation documentation.