Inject HTTP requests into your API

We now inject HTTP requests towards the ListRestApiEndpointMonitorOper API. Follow the steps below to start sending traffic to the API endpoint.

  1. Find the ListRestApiEndpointMonitorOper API endpoint either on the Outputs tab of the myServerless-Stack CloudFormation stack, or by running this command:
aws cloudformation describe-stacks --stack-name myServerless-Stack --query Stacks[0].Outputs
  1. Open the file sendAPIRequest.py and update the url variable with the ListRestApiEndpointMonitorOper API url value from the previous step.

  2. After the script is saved, trigger the script using the following command:

python sendAPIRequest.py

Make sure you’re getting an output of status 200 with the records that we fed into the DynamoDB table (see the following screenshot). You may have to launch multiple tabs (preferably 4 separate tabs) of the terminal to run the script to increase the rate of traffic. In every new terminal, change directory using command: cd amazon-devopsguru-samples/generate-devopsguru-insights/ and then run command: python sendAPIRequest.py.

Terminal showing script executing and injecting traffic to API

After approximately 10 minutes of the script running in a loop, an operational insight is generated in DevOps Guru.