title: REST API call with AWS Signature Version 4 (cannot sign AWS API requests)
body: <p>I've never been able to get AWS API calls to work.  I am trying to work on a Linux server on my network to issue REST APIs to interact with my enterprise AWS account.</p>
  
  <p>I am trying to sign AWS Requests with Signature Version 4.  Do I need to do this on an AWS instance?  I have the shared access key, the RSA private key (begin RSA private key... end RSA private key), and the AWS Access key (e.g., the AKAI... value).</p>
  
  <p>The problem I have have trouble with is creating the canonical request.  I get an error "Malformed URL."  Bash parses my curl but has a problem with the parameter after this:</p>
  
  <p><code>curl -i ... -X GET / action=listusers</code> ... </p>
  
  <p>I am trying to follow these directions:</p>
  
  <p><a href="http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html" rel="nofollow">http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html</a></p>
  
  <p>I think my command should work because the above link shows this as an example canonical request:</p>
  
  <pre><code>GET
  /
  Action=ListUsers&amp;Version=2010-05-08
  content-type:application/x-www-form-urlencoded; charset=utf-8
  host:iam.amazonaws.com
  x-amz-date:20150830T123600Z
  
  content-type;host;x-amz-date
  e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
  </code></pre>
  
  <p>This has many parameters.  A curl command to the above canonical request would result in an error about a "malformed url" and a bash command not recognized with this line:</p>
  
  <pre><code>content-type:application/x-www-form-urlencoded; charset=utf-8
  </code></pre>
  
  <p>The above directions do not explain how to determine the URI.  How do I determine the URI?  How do I use long curl commands with correct parsing of the URI so I do not get a space between the arguments to invoke Bash's response about an unrecognized command?</p>
  
  <p>I have tried many permutations of curl commands to list the servers or users associated with my AWS account.  Nothing seems to work.</p>
  
  <p>I want to issue a basic API command to verify it works.  I'd love to list the AWS instances or list the users associated with the AWS account.  But I am stuck at creating a canonical request because apparently I do not know how to determine which URI or URL to use in a Curl command.  If I knew how, I could sign requests.  If I could get Linux curl commands to work, I could eventually use Python's subprocess to invoke them.</p>