Runscope API Monitoring and Testing    Learn More →

Making Requests to the AWS API with Signature Version 4 and Script Libraries

By Heitor Tashiro Sergent on .

We recently had a customer that wanted to test and monitor a few endpoints for the AWS API. For security reasons, most requests to AWS APIs have to be signed using their Signature Version 4 signing process. There are several SDKs and libraries that can help with that signing process, but we wanted something that we could integrate with our script engine with plain JavaScript.
 
One of the most powerful features that Runscope has is the ability to add pre-request or post-response scripts to your API tests, so you can programmatically change your requests based on your API requirements. For example, you can add custom headers before your API request is made, or remove sensitive information from your API responses before they are stored and shared for viewing.
 
So, we put together an aws4.js library based off of mhart/aws4 Node.js library, that you can add to your Runscope account and then use it in your pre-request scripts to sign your AWS requests!
 
You can find the library in our GitHub repository for Runscope/script-libraries, which includes the JavaScript file and detailed instructions on how to use it. Basically, it involves 3 steps:

  1. Adding aws4.js as a custom library to your Runscope account
  2. Activating library in your test's environment settings
  3. Editing the test step pre-request script

If you have any questions or suggestions about the library, please help us make it better by opening an issue or PR on GitHub! And big thanks to mhart for the original Node.js library!

Categories: apis, code samples, testing, tutorial

Everything is going to be 200 OK®