Tracing with X-Ray

Length: 00:10:49

Lesson Summary:

In this video, we're going to learn about tracing our application with AWS X-Ray.

We are going to deploy a sample Flask application that is instrumented with the X-Ray SDK, make some sample requests, and then examine the traces and service maps in the AWS Management Console.

Zappa GitHub Repo:

Create a DynamoDB Table

  1. Create a table called Flask with a primary partition key called key.

     aws dynamodb create-table --table-name Flask \
       --attribute-definitions AttributeName=key,AttributeType=S \
       --key-schema AttributeName=key,KeyType=HASH \

Configure Zappa

  1. Run the following command:

     cd example
     pipenv --python 3.7
     pipenv shell
     pipenv install aws-xray-sdk flask zappa requests
     pipenv lock -r > requirements.txt
     zappa init
  2. Add the following property to zappa_settings.json:

     "xray_tracing": true
  3. Deploy the application.

     zappa deploy

Enable X-Ray Tracing for API Gateway

In this step, we will interact with the API Gateway Console to enable X-Ray tracing.

  1. Sign in to the AWS Management Console and open the API Gateway Console at https://console\.aws\.amazon\.com/apigateway/.
  2. Select your API (e.g., example-dev).
  3. Select Stages.
  4. Choose the name of your deployment stage (e.g., dev).
  5. On the Logs/Tracing tab, select the Enable X-Ray Tracing box.
  6. Click Save Changes.
  7. Navigate to the endpoint in your browser.

This lesson is only available to Linux Academy members.

Sign Up To View This Lesson

Or Log In

Looking For Team Training?

Learn More