How can I create a signed GET curl request using aws cli?


I'm trying to do something I thought was easy, but my google fu is failing me. I have been provided an API gateway endpoint that I must call a get on the d/l a file onto my EC2 instance. The request has to be signed. I see all kinds of SDK's and examples, but nothing for cli. I don't see aws cli command that will let me call a gateway endpoint (test-invoke) doesn't seem right. Is there one.

If not, is there a simple way to use the aws cli to create a signed request that I can send with invoke-webrequest (powershell) to d/l the file.

The IAM permissions are in place and the EC2 instance profile does have the invoke permission for the API.

1 Answer
Accepted Answer

AWS CLI does not provide an option to get signed request. Since you're making a HTTPS call to API gateway, using IAM user permissions, you need to use SigV4 to add authentication information to the request.

More info -

This page explains the steps required to sign the request. I can think of two options - (1) try to generate the signature in power shell by following the steps described on the link above, or (2) Write a function in language you prefer using one of the code sample (links provided on this page) to generate the signature and use powershell to invoke the same and send request using invoke-webrequest.

answered a year ago
  • Yea, kinda what I was trying to avoid. :)

  • I decided to create a lambda that will d/l the file and put it in s3 so my instance can download it from there using the AWS cli. Thanks for your suggestions.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions