---
title: "Ruby APM with AWS Elastic Beanstalk"
slug: "ruby-apm-with-aws-elastic-beanstalk"
description: "Add Profiler to your Ruby Application. Easily configure with Gemfile and YAML. Also, learn how to install Stackify Linux Agent for enhanced monitoring. Deploy with ease!"
updated: 2020-06-18T20:38:51Z
published: 2020-06-18T20:38:51Z
---

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

# Ruby APM with AWS Elastic Beanstalk

Instructions on how to install the Retrace Linux Agent and Ruby APM on [AWS Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk).

## Add Profiler to Application

Modify application `Gemfile`:

```
gem 'stackify-ruby-apm'
```

### Configure Application

Add `config/stackify_apm.yml` to your application, modify **application_name** and **environment_name**.

```
application_name: 'Ruby Application'
environment_name: 'Production'
```

#### Rails

Profiler will startup automatically, no additional configuration.

#### Non-Rails

Include **StackifyRubyAPM::Middleware** when starting your application:

```
# config.ru

require 'stackify-ruby-apm'
use StackifyRubyAPM::Middleware
StackifyRubyAPM.start

# application startup

at_exit { StackifyRubyAPM.stop }
```

## Installing Stackify Linux Agent

1. Create a new file named **stackify.config** in your application’s **.ebextensions** folder. [Learn More about .ebextensions](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html).
2. Add the following to your **stackify.config** file: Replace `[INSERT ACTIVATION KEY]` with your activation key value. Optionally you can include the device name by replacing the `[aliasname]` with the desired device alias. You can find your activation key under [Settings: Account](https://s1.stackify.com/Manage/AccountInfo).

```
sources:
  /home/ec2-user: https://s1.stackify.com/Account/AgentDownload/Linux
    
commands:
  01:
    command: sudo ./agent-install.sh --key [INSERT ACTIVATION KEY] --environment "Production" --devicealias [aliasname]
    cwd: /home/ec2-user/stackify-agent-install-32bit
```

1. Deploy your app to Elastic Beanstalk
  - [Deploy using the **AWS Console**](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.deploy-existing-version.html)
  - [Deploy using **eb deploy**](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-deploy.html)
