Install Tooling and Configure AppDynamics

Overview

Now with the Cloud9 workspace provisioned and setup, we’ll proceed with installing the tooling needed to add observability to our Lambda functions.

The steps we will execute are as follows:

  1. Clone the repository for our sandboxed environment.
  2. Install necessary tools for deployment and running our sandboxed environment.
  3. Install components of sandboxed environment and start application.

Clone the repository for our sandboxed environment

All of the artifacts that we will use for this exercise are available in the repository for our sandboxed environment. To clone, let’s make sure that we are in the environment directory. Execute the following command:

pwd

If the result is /home/ec2-user/environment, then we are ready to go. Otherwise, change to the environment directory by running the following in your terminal window:

cd $HOME/environment

To clone the repo, run the below command in the terminal:

git clone https://github.com/Appdynamics/appd_aws_lambda_lab.git

This repo contains the following artifacts:

  • Setup and cleanup scripts
  • Lambda functions in Java, NodeJS, and Python that will be deployed and instrumented
  • A docker-compose application that will be our sandboxed application

image

Install tooling

Now that we have a local copy of the repository, we will install the tooling needed. All of the tooling installation is contained within a single script. Our next steps are to change to the repository directory and run the installation script.

cd appd_aws_lambda_lab
source ./install_tooling.sh

This script increases the disk size of the EC2 instance and installs the following components:

image

The final outputs of the script will display the versions of each of the components installed.

image

Install Sandbox Environment Components

The sandboxed version of our application runs as a Docker compose application. To install all of the components, first make sure that we are within the repository directory:

pwd

If the output is /home/ec2-user/environment/appd_aws_lambda_lab, then we are ready to go. Otherwise change to the repository directory in the terminal.

cd $HOME/environment/appd_aws_lambda_lab

Now, execute the setup script by running the following command:

source ./setup.sh

This script will take anywhere from 5-10 minutes to execute and does the following:

  • Saves our current AWS region to an environment variable (which will be used later)
  • Creates a login within AppDynamics and the corresponding application
  • Deploys our Python, NodeJS, and Java-based Lambda functions to AWS (along with DynamoDB, S3, and API Gateway dependencies)
  • Configures our sandbox application to use the recently deployed Lambda functions

All that is left to do is to start our application! We’re going to move to the docker-compose folder within our repository and run a startup script.

cd $HOME/environment/appd_aws_lambda_lab/docker-compose
source ./start.sh

This script pulls down all of the appropriate containers and starts up the docker-compose application.

image

If you happen to get an error about running out of disk space, then you will need to manually resize the EBS volume attached to the EC2 instance. The setup script resizes the volume to 80 GB. See the AWS documentation for how to resize the instance.

The next thing that we will do is introduce load to our application. By putting our application under load, AppDynamics will be able to not only detect the different components of the application, but it will map out data flows between application components.

Allow 2-3 minutes for all of the application components to fully come online. During this period of time, the following things are happening for each service:

  • AppDynamics APM agents start up and register with the controller.
  • Application starts and comes online.
  • Endpoints become available.

Once the 2-3 minutes have passed, start the load by executing the following command:

./startLoad.sh

You will see a message stating appending output to 'nohup.out'. This is totally expected for how we are running the load generation for the application. We’ll let the application run under load for about 5 minutes or so to allow AppDynamics to fully learn the components and data flows between components. Once this amount of time has passed, we’ll view our application in AppDynamics before instrumenting our Lambda functions.