cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Michael.Englert
AppDynamics Team (Retired)

Overview

This article walks you through deploying an example macOS application on AWS Elastic Beanstalk using a script provided by AppDynamics. The example application can then be monitored with the AppDynamics Java Agent. This exercise uses the Spring Music application and tutorial found on GitHub.

 

Table of Contents

Overview

Review prerequisites and prepare options

Construct and deploy the script

Verify the configurations

 

How do I prepare to deploy the application?

To deploy the Spring Music sample application with AWS Beanstalk, you must have:

  • the Spring Music sample application successfully running on your local machine
  • an AWS account
  • the EB CLI (the Elastic Beanstalk CLI) installed
  • an AppDynamics license (the type of license impacts your monitoring and debugging options)

 

Choose your monitoring and debugging options 

There are three options for you to monitor and debug an application on AppDynamics:

Java Uses a Java agent only
Java-Machine Uses a Java agent that includes a Machine Agent for Server Visibility
Java Machine Analytics Uses a Java agent that includes Analytics, and can also optionally enable Server Visibility

 

You’ll need to have the AppDynamics license that corresponds with your choices. 

Analytics

Depending on the Controller you intend to use for monitoring, you can monitor the example Java application with or without Analytics. The Analytics Dynamic Service extends your app server agent functionality to collect and forward data to the Analytics Agent.

 

Server Visibility Module

If you do choose to monitor with Analytics, you can also decide whether or not to enable the Server Visibility module. Server visibility includes additional windows in the Controller UI that enable you to quickly see underlying infrastructure issues impacting your application performance.

 

Once you decide which monitoring and debugging option suits your purpose, use the table below to identify the corresponding tutorial target directory. You will need to input this directory path later on when you build your deployment script.

 
Tutorial Target Directory
Analytics
Server Visibility
Path
License

no

no

aws-elasticbeanstalk/java

APM Pro

no

yes

aws-elasticbeanstalk/java-machine

APM Advanced

yes

yes or no

aws-elasticbeanstalk/java-machine-analytics

APM Peak

 

For each directory, there is a folder called testing.

  1. Navigate to the agent tutorial target directory you want to test. In this example, we’re using a Java machine with Analytics.

    cd ./aws-elasticbeanstalk/<platform>-(machine)-(analytics)/testing

  2. Open a command prompt and execute the test script with the corresponding options, for example:

    cd ./aws-elasticbeanstalk-master/java-machine-analytics/testing/test.sh

NOTE: If you deploy your own application, you’ll need to write your own script, or deploy your application manually. See Deploying applications manually.

 

SSH considerations

Finally, decide whether or not to SSH into the EC2 instance on which the application runs. Development, test, and staging environments require this technique more often than production environments.

 

Decide whether to create a VPC and a Key Pair in AWS (optional)

If you decide to SSH into EC2 instances, choose a pre-existing Key Pair, or create a new one. Note the name of your chosen Key Pair.

 

  1. Navigate to the AWS Management Console.
  2. Sign in to your AWS account. 
  3. Search for Virtual Private Cloud.
  4. Choose an existing Virtual Private Cloud (VPC) or create a new one.
  5. Note the ID of your chosen VPC (unless you’re using the default VPC).
  6. (Optional) Connect your VPC using an SSH client. If you want to SSH into EC2 instances, choose a pre-existing Key Pair, or create a new one. Note the name of your chosen Key Pair.

 

Construct the test.sh command

To deploy applications with AWS Elastic Beanstalk, you need to know the environment variable settings for every AppDynamics Agent your application needs. 

 

A note about security

Do not use the procedure as described here, with your secret key entered at the command line in plain text, in a production environment.

It may not even be considered acceptable for testing, depending on practices at your organization. See Best Practices for Managing AWS Access Keys.

 

This exercise only uses the Java Agent, which keeps the list of required settings short

  1. Open a text editor and create a string that begins with ./test.sh
  2. Append the script options and environment variable settings to the command string as described in the table below. 
  3. The completed string is your test.sh command for the sample application.

 

Script option
Environment variable
Notes

-c

<APPDYNAMICS_CONTROLLER_HOST_NAME>

Fully-qualified domain name for the AppDynamics Controller with which you intend to monitor your application

-p

<APPDYNAMICS_CONTROLLER_PORT>

Primary port used by the monitoring AppDynamics Controller (the Default is 8090)

-K

<APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY>

Find the Controller under Settings > License > Account

-E

<APPDYNAMICS_ANALYTICS_EVENT_ENDPOINT>

Include only if your Controller has Analytics

Tells the Analytics plugin the target URL for the Events Service. The Analytics plugin sends data to the Events Service, not the Controller

-g

<APPDYNAMICS_AGENT_GLOBAL_ACCOUNT_NAME>

Include only if your Controller has Analytics: See Controller details under Settings > License > Account

-s

<APPDYNAMICS_SIM_ENABLED>

Note: Include and set to true only if you want to enable Server Visibility

-r

<REGION>

Must be the code for the region shown in your AWS console. For example, if the console shows Ohio, the code is us-east-2

See the AWS documentation on Available Regions

-a

<APP_NAME>

Choose a name for the example application

-e

<ENV_NAME>

Choose a name for the new environment that the script creates

-b

<BASE_DIR>

Specifies the local filesystem location from which the script should copy the sample application, after cloning it from GitHub

-k

<KEY>

Include only if you want to use eb ssh, which allows you to log into the EC2 instance on which the script deploys the app

For the value, use the name of your chosen Key Pair

-i

<INSTANCE>

Optional—if not specified, AWS uses a default

Must be t2.small or larger for this demo to run properly

 

For example, a test.sh command, without Analytics, without Server Visibility, and without SSH, might look something like this:

 

Syntax

./test.sh -c <APPDYNAMICS_CONTROLLER_HOST_NAME> -p <APPDYNAMICS_CONTROLLER_PORT> -K <APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY> -r <REGION> -a <APP_NAME> -e <ENV_NAME> -b <BASE_DIR> -i <INSTANCE>


Example

./test.sh -c master-saas-controller.example.com -p 8090 -K abc123sjklasdf -r us-east-2 -a tutorialapp -e tutorialenv -b /Users/exampleperson/aws-elasticbeanstalk/java -i t2.smal

 

Run the demo script

In a terminal, within the exercise target directory:

  1. Change directories to testing
  2. Run your constructed test.sh command. When prompted, provide any options you omitted from the command.

How do I verify the configuration?

Verify that the EC2 Node is Registered with the Controller

To verify that the AWS EC2 node is properly registered with the Controller:

  1. Navigate to the AWS Management Console.
  2. Sign in to your AWS account. 
  3. Search for Applications.

You should see the example application listed under Applications.

 

Verify that the Application is Running in the Cloud

  1. Navigate to the AWS Management Console.
  2. Sign in to your AWS account. 
  3. Search for Virtual Private Cloud.
  4. Choose an existing Virtual Private Cloud (VPC) or create a new one.
  5. Note the ID of your chosen VPC (unless you’re using the default VPC).
  6. (Optional) Connect your VPC using an SSH client. If you want to SSH into EC2 instances, choose a pre-existing Key Pair, or create a new one. Note the name of your chosen Key Pair. 
  7. In the AWS Elastic Beanstalk console, you should see the sample Spring Music application under All Applications and the environment you named at launch.
    AWS Beanstalk console header, showing sample Spring Music ApplicationAWS Beanstalk console header, showing sample Spring Music Application

  8. Click the URL (at bottom right in the screenshot above). The Spring Music example application should open in a browser.
    Spring Music example applicationSpring Music example application
  9. Use the button to add albums to the web page. This step is required to generate load for AppDynamics to monitor.

Spring Music "Add Album" buttonSpring Music "Add Album" button

Monitor your Cloud Application with AppDynamics

You should be able to view the example in the Flow Map, and (if applicable) Analytics Agent and/or Server Visibility screens.

  1. Navigate and sign in to your Controller
  2. See Cross Application Flow 

 

How do I deploy my own applications?

After you successfully complete this exercise, if you want to deploy your own application, you’ll need to either create your own similar script or deploy it manually.

 

To deploy AppDynamics Agents within an AWS Elastic Beanstalk environment, see the README of the GitHub repository and the AWS Elastic Beanstalk documentation.

Version history
Last update:
‎11-09-2019 04:14 PM
Updated by:
Join Us On December 10
Learn how Splunk and AppDynamics are redefining observability


Register Now!

Observe and Explore
Dive into our Community Blog for the Latest Insights and Updates!


Read the blog here