title: Calling AWS API Gateway using IAM Roles
body: <p>I have an API Gateway that I have been calling from Node.js using the aws4 library using this format:</p>
  
  <pre><code>let aws4 = require('aws4');
  
  let request = {
    host: 'myapi.execute-api.us-west-2.amazonaws.com',
    method: 'GET',
    url: 'https://myapi.execute-api.us-west-2.amazonaws.com/Prod/foos',
    path: '/Prod/foos'
  }
  
  let signedRequest = aws4.sign(request,
    {
      secretAccessKey: AWS.config.credentials.secretAccessKey,
      accessKeyId: AWS.config.credentials.accessKeyId
    })
  
  delete signedRequest.headers['Host']
  delete signedRequest.headers['Content-Length']
  
  let response = await axios(signedRequest)
  </code></pre>
  
  <p>Now, we want to stop saving the credentials directly on the server and use IAM Roles instead. </p>
  
  <p>When I try calling it without the credentials, regardless of whether it is signed using aws4, I get this error:</p>
  
  <pre><code>The security token included in the request is invalid.
  </code></pre>